bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#347: marked as done (C mode asks twice about local variables)


From: Emacs bug Tracking System
Subject: bug#347: marked as done (C mode asks twice about local variables)
Date: Thu, 31 Jul 2008 07:20:05 -0700

Your message dated Thu, 31 Jul 2008 10:14:42 -0400
with message-id <address@hidden>
and subject line Re: C mode asks twice about local variables
has caused the Emacs bug report #343,
regarding C mode asks twice about local variables
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact address@hidden
immediately.)


-- 
343: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=343
Emacs Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Re: C mode asks twice about local variables Date: Sun, 1 Jun 2008 17:21:44 +0000 User-agent: Mutt/1.5.9i
Hi, Glenn,

On Sat, May 31, 2008 at 06:51:35PM -0400, Glenn Morris wrote:

> This applies in Emacs 22.2 and CVS trunk.

> emacs -Q lib-src/etags.c

>     The local variables list in etags.c
>     contains values that may not be safe (*).

>     Do you want to apply it?  You can type
>     y  -- to apply the local variables list.
>     n  -- to ignore the local variables list.
>     !  -- to apply the local variables list, and permanently mark these
>     values (*) as safe (in the future, they will be set automatically.)

>     indent-tabs-mode: t
>     tab-width: 8
>     fill-column: 79
>   * c-font-lock-extra-types: ("FILE" "bool" "language" "linebuffer" "fdesc" 
> "node" "regexp")
>     c-file-style: "gnu"


> If I answer `y', nothing happens. I have to press `y' a second time.

Yes.  This needs fixing, somehow.

The way this happens is that in a C file's local variables list, there
are two "special" variables, e.g. `c-file-style'.

When 

    c-basic-offset: 11
    c-file-style: "k&r"

occurs in the local variable list, this triggers a hook function which
calls (c-set-style "k&r").  The hook is hack-local-variables-hook.  The
problem is that this c-set-style call will overwrite the explicit value
for c-basic-offset.  The explicit value MUST take precedence here.

My solution was to call hack-local-variables a second time from within
the hook function, first having deleted any occurrences of `mode',
`c-file-style' etc. from the Local Variables.  This kludge worked
reasonably well until the handling of safe/dangerous-local-variables was
changed for Emacs 22.

Simply marking all pertinent variables as "safe" is not the right fix,
because they aren't: some can contain arbitrary functions.

Emacs doesn't really have the requisite hooks here:
`before-hack-local-variables-hook' and `after-hack-local-variables-hook'
would let the problem be fixed (rather than kludged), but it kind of
feels like overkill.

If Emacs were not to rebind the do-you-want-to-apply-it variable inside
hack-local-variables, that would allow the kludge to work.

Suggestions and helpful comments would be appreciated here.

-- 
Alan Mackenzie (Nuremberg, Germany).




--- End Message ---
--- Begin Message --- Subject: Re: C mode asks twice about local variables Date: Thu, 31 Jul 2008 10:14:42 -0400
I believe this is now fixed in the trunk.  We'll leave it unfixed in the
branch, since the fix involves the hack-local-variables code and needs
to be tested thoroughly.


--- End Message ---

reply via email to

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