unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-pretest-bug@gnu.org, Jan Dj\x1fFFFFFFFFFFFFFFrv <jan.h.d@swipnet.se>
Subject: Re: 23.0.60; M-x compile gives args out of range 0, 0
Date: Tue, 08 Apr 2008 14:05:07 -0400	[thread overview]
Message-ID: <jwvbq4kxm9n.fsf-monnier+emacsbugreports@gnu.org> (raw)
In-Reply-To: <20080408172227.GA3399@muc.de> (Alan Mackenzie's message of "Tue,  8 Apr 2008 17:22:27 +0000")

>> > 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	other threads:[~2008-04-08 18:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-08 10:52 23.0.60; M-x compile gives args out of range 0, 0 Jan Djärv
2008-04-08 15:03 ` Stefan Monnier
2008-04-08 16:32   ` Jan Djärv
2008-04-08 17:22   ` Alan Mackenzie
2008-04-08 18:05     ` Stefan Monnier [this message]
2008-04-08 19:21       ` Alan Mackenzie
2008-04-08 20:22         ` Stefan Monnier
2008-04-09  9:24           ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvbq4kxm9n.fsf-monnier+emacsbugreports@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=acm@muc.de \
    --cc=emacs-pretest-bug@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).