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-devel@gnu.org
Subject: Re: bug#347: C mode asks twice about local variables
Date: Wed, 11 Jun 2008 10:41:38 -0400	[thread overview]
Message-ID: <jwvy75epfv1.fsf-monnier+emacsbugreports@gnu.org> (raw)
In-Reply-To: <20080609190750.GC6098@muc.de> (Alan Mackenzie's message of "Mon,  9 Jun 2008 19:07:50 +0000")

[ Moving this over to emacs-devel. ]

>> >> Can you try and call `c-file-style' with some extra "don't override"
>> >> (when called from that hack-local-variables-hook) argument so that any
>> >> variable that already has a buffer-local binding will not be
>> >> overridden?
>> Any comment about this suggestion?
> YUCK!!!  ;-)

> I don't know off-hand what the significance of buffer locality is in CC
> Mode styles.

Could you ask the CC mode maintainer, maybe?

> But trying to get a "don't override" parameter to work
> would be horrendous.  hack-local-variables is actually called after the
> language hook, isn't it?  By that time, the CC Mode style will already
> have been set, and the pertinent variables will already be buffer local.
> At least I think so.

I see, yes, it might be messy or even impossible.

>> Non-portability might indeed be a problem (tho, it's obviously "your"
>> problem rather than mine), but introducing a new hook in Emacs-23 won't
>> help you there, so it's not relevant to this discussion.

> What I had in mind was using an (if (boundp 'before-hack-local-variables)
> ...) to separate out new strategy from old.

I'm sure we can come up with a good test to decide whether :safe
will do the right thing.

> Oh, and the hook would need documenting in the Elisp manual, but I can
> manage that.

> Hey, this is so easy and obviously the right thing.  Let's do it!

It's going in the right direction but I'm still not completely satisfied.
How 'bout something like the following:

Some variables can be flagged as being special, in that when they apper
in the file-local list of settings, they "get set" by calling
a function.  E.g. `mode' is globally special and "setting it" will
actually call the corresponding mode.

Then `c-mode' can define `c-file-style' and `c-file-offsets' as being
special so that setting them actually calls a function of yours
(probably a function that could also be used for the :set in defcustom,
BTW).

Of course, the interesting bit is that hack-local-variables will be
careful to reorder the file-local settings such that special variables
are set first.


        Stefan




       reply	other threads:[~2008-06-11 14:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <s8abi6ccjs.fsf@fencepost.gnu.org>
     [not found] ` <20080601172143.GA5899@muc.de>
     [not found]   ` <jwvfxrvt49x.fsf-monnier+emacsbugreports@gnu.org>
     [not found]     ` <20080609143651.GA6098@muc.de>
     [not found]       ` <jwvr6b6r6ci.fsf-monnier+emacsbugreports@gnu.org>
     [not found]         ` <20080609190750.GC6098@muc.de>
2008-06-11 14:41           ` Stefan Monnier [this message]
2008-06-11 16:37             ` bug#347: C mode asks twice about local variables Glenn Morris
2008-06-11 17:51               ` Stefan Monnier
2008-06-15 22:04             ` Alan Mackenzie
2008-07-26 10:44               ` Alan Mackenzie
2008-07-26 15:05                 ` Chong Yidong
2008-07-26 15:58                   ` Chong Yidong
2008-07-28 18:11                   ` Johan Bockgård
2008-07-31  1:37                 ` Chong Yidong

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=jwvy75epfv1.fsf-monnier+emacsbugreports@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=acm@muc.de \
    --cc=emacs-devel@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).