emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 23.0.60; M-x compile gives args out of range 0, 0


From: Stefan Monnier
Subject: Re: 23.0.60; M-x compile gives args out of range 0, 0
Date: Tue, 08 Apr 2008 14:05:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>> > When doing M-x compile I get:
>> > font-lock-extend-region-multiline: Args out of range: 0, 0
>> 
>> Does the patch below make it disappear, by any chance?
>> 
>> 
>> Stefan
>> 
>> 
>> === modified file 'lisp/progmodes/cc-mode.el'
>> --- lisp/progmodes/cc-mode.el        2008-04-07 16:37:22 +0000
>> +++ lisp/progmodes/cc-mode.el        2008-04-08 15:01:47 +0000

> With respect, that's the wrong place to patch.  It is liable to catch
> out anybody else who uses font-lock-extend-after-change-region-function
> in the future.  This variable should be made buffer-local once and for
> all, like this:

I disagree.  A major mode should basically *never* change globally
a defvar, except maybe for its own vars (plus a few exceptions, of
course).  I.e. `setq' should only ever be used on let-bound variables.
If you happen to know that the variable is "automatically buffer-local",
it's OK to use `setq', but it's always safer to use
`make-local-variable', especially because unless the package that does
the defvar (and make-variable-buffer-local) is preloaded you may end up
calling `setq' before make-variable-buffer-local and get into trouble.

I'm not opposed to make-variable-buffer-local, but the bug was clearly
in CC-mode, because a major mode should by default use
(set (make-local-variable ...) ...) rather than setq.

BTW, why doesn't CC-mode set those vars via font-lock-defaults, as the
author of font-lock intended?


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]