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: Alan Mackenzie
Subject: Re: 23.0.60; M-x compile gives args out of range 0, 0
Date: Tue, 8 Apr 2008 19:21:47 +0000
User-agent: Mutt/1.5.9i

Hi, Stefan!

On Tue, Apr 08, 2008 at 02:05:07PM -0400, Stefan Monnier wrote:
> >> > 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).

Well, that's a bit philosophical.  In practice, major mode maintainers
_will_ be setting such variables without explicitly localising them,
causing just that little bit extra in debugging, stress, curse words, and
so on.

There's a category of variables which are _essentially_ buffer local, and
nobody ever explicitly localises them first - things like major-mode,
mark-ring, foo-minor-mode, buffer-undo-list, .....  fl-e-ac-rf is in this
category.

There are several other variables in font-lock.el which are explicity
buffer-localised, amongst them the similar variable
font-lock-extend-region-functions.  So it would promote consistency if we
did the same with fl-extend-ac-region-function.

[ .... ]

> 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.

I don't think it's clear at all.  The same "bug", if such it be, exists
in font-lock.el itself, L1452:

        (setq font-lock-syntactically-fontified end))

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

For portability's sake.  font-lock-defaults in XEmacs has a different
format.  In particular, it lacks the "other-vars" bit at the end.  It's
less hassle just not to use it.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).




reply via email to

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