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

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

bug#7767: 23.2.91; file-local-variables-alist should have the permanent-


From: Alex Harsanyi
Subject: bug#7767: 23.2.91; file-local-variables-alist should have the permanent-local property
Date: Sat, 1 Jan 2011 12:12:31 +0800

Here is a scenario that illustrates the problem.  Save the following
into a file named hello.cc:

----------
#include <iostream>

int main()
{
  std::cout << "Hello World\n";
}

/*
  Local Variables:
  mode: c++
  compile-command: "g++ -o hello hello.cc"
  End:
*/
----------

After visiting this file in Emacs, and typing M-x compile RET, I expect
the default compilation command to be the one set in the local variables
section of the file.  Instead it is "make -k" which is the default one
for the  `compile-command' variable.

I tried to debug the problem and it seems that `hack-local-variables'
will collect the local variables into `file-local-variables-alist' than
run the hook `before-hack-local-variables-hook' which containts the
function `c-before-hack-hook'.

`c-before-hack-hook' will see the `mode' variable and call `c++-mode'
which than will call `kill-all-local-variables' setting
`file-local-variables-alist' to nil so that the remaining variables are
not processed.

Adding the `permanent-local' property to `file-local-variables-alist'
seems to fix the problem.

Note that the problem does not seem too occur if the mode is set to 'c',
but it does for 'c++' and 'python'.  I'm not sure why this is.

This happens both on the trunk and on the emacs-23 branch.


In GNU Emacs 23.2.91.1 (x86_64-apple-darwin10.5.0, NS apple-appkit-1038.35)
of 2010-12-31 on karinji-2.local
Windowing system distributor `Apple', version 10.3.1038
configured using `configure  '--with-ns''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_AU.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: C++/l

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
C-x C-f ~ / P r o <tab> h e <tab> <return> M-x c o 
m p i l e <return> C-g M-x r e p o r t - e m <tab> 
<return> C-g C-h f h a c k <tab> l o <tab> <return> 
<help-echo> <help-echo> <help-echo> <down-mouse-1> 
<mouse-2> <help-echo> <wheel-down> <wheel-down> <double-wheel-down> 
<down-mouse-1> <mouse-1> C-v C-v C-v C-v <down-mouse-1> 
<mouse-movement> <mouse-movement> <drag-mouse-1> s-w 
M-w <help-echo> <down-mouse-1> <mouse-1> M-x <up> 
<return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Quit [2 times]
Type C-x 1 to delete the help window.
uncompressing files.el.gz...done
Loading vc-bzr...done
call-interactively: Attempt to delete the sole visible or iconified frame

Load-path shadows:
None found.

Features:
(shadow sort mail-extr message ecomplete rfc822 mml mml-sec
password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231
rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc
time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock
hashcash mail-utils vc-bzr sha1 hex-util jka-compr find-func help-mode
view help-fns emacsbug compile comint ring cc-mode cc-fonts cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs regexp-opt tooltip
ediff-hook vc-hooks lisp-float-type mwheel ns-win easymenu tool-bar dnd
fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer
select scroll-bar mldrag mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces
cus-face files text-properties overlay md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote
make-network-process dbusbind ns multi-tty emacs)





reply via email to

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