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 16:22:23 -0400	[thread overview]
Message-ID: <jwvtzicw1d2.fsf-monnier+emacsbugreports@gnu.org> (raw)
In-Reply-To: <20080408192147.GB3399@muc.de> (Alan Mackenzie's message of "Tue,  8 Apr 2008 19:21:47 +0000")

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

It's not philosophical.  It's simply needed so as to avoid undesired
interference between unrelated buffers.  I know it's a common bug.

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

It's hard to clearly define which ones are "essentially" buffer local
and which ones aren't.

> fl-e-ac-rf is in this category.

In my mind, it's definitely not in the same category as `major-mode' or
`buffer-undo-list'.  But it doesn't matter anyway.

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

As I said:

>> I'm not opposed to make-variable-buffer-local,

So feel free to apply your patch (except for the part that changes the
docstring, since C-h v will take care of warning the user that the
variable is automatically made 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))

As I said "If you happen to know that the variable is "automatically
buffer-local", it's OK to use `setq'".

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

Duh!


        Stefan




  reply	other threads:[~2008-04-08 20:22 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
2008-04-08 19:21       ` Alan Mackenzie
2008-04-08 20:22         ` Stefan Monnier [this message]
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=jwvtzicw1d2.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).