From: Juri Linkov <juri@jurta.org>
To: Francesc Rocher <francesc.rocher@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: file local variables
Date: Mon, 14 Dec 2009 23:29:16 +0200 [thread overview]
Message-ID: <87iqc9b5xv.fsf@mail.jurta.org> (raw)
In-Reply-To: <ade856a30912141024j30bab697u2af81e76d74f96b1@mail.gmail.com> (Francesc Rocher's message of "Mon, 14 Dec 2009 19:24:27 +0100")
> File local variables doesn't work as expected. If you 'emacs -Q' a file with
>
> Local Variables:
> mode: text
> mode: auto-fill
> End:
>
> or with any other combination of a major and a minor mode, then the major
> mode is ignored. Is this a bug? This works fine with emacs-23.1, where both
> modes are activated...
(info "(emacs) Specifying File Variables") says:
You can use the `mode' "variable" to set minor modes as well as the
major modes; in fact, you can use it more than once, first to set the
major mode and then to set minor modes which are specific to particular
buffers. But most minor modes should not be specified in the file at
all, because they represent user preferences.
Since the user should be able to specify minor modes more than once,
the following patch fixes this by allowing duplicate modes:
=== modified file 'lisp/files.el'
--- lisp/files.el 2009-11-25 17:11:29 +0000
+++ lisp/files.el 2009-12-14 21:28:58 +0000
@@ -2978,8 +2978,8 @@
(or (eq enable-local-eval t)
(hack-one-local-variable-eval-safep (eval (quote val)))
(push elt unsafe-vars))))
- ;; Ignore duplicates in the present list.
- ((assq var all-vars) nil)
+ ;; Ignore duplicates (except `mode') in the present list.
+ ((and (assq var all-vars) (not (eq var 'mode))) nil)
;; Accept known-safe variables.
((or (memq var '(mode unibyte coding))
(safe-local-variable-p var val))
@@ -2999,7 +2999,7 @@
(hack-local-variables-confirm all-vars unsafe-vars
risky-vars dir-name))
(dolist (elt all-vars)
- (unless (eq (car elt) 'eval)
+ (unless (memq (car elt) '(eval mode))
(unless dir-name
(setq dir-local-variables-alist
(assq-delete-all (car elt) dir-local-variables-alist)))
@@ -3427,7 +3427,7 @@
(dir-locals-get-class-variables class) dir-name nil)))
(when variables
(dolist (elt variables)
- (unless (eq (car elt) 'eval)
+ (unless (memq (car elt) '(eval mode))
(setq dir-local-variables-alist
(assq-delete-all (car elt) dir-local-variables-alist)))
(push elt dir-local-variables-alist))
--
Juri Linkov
http://www.jurta.org/emacs/
next prev parent reply other threads:[~2009-12-14 21:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-14 18:24 file local variables Francesc Rocher
2009-12-14 21:29 ` Juri Linkov [this message]
2009-12-14 22:26 ` Francesc Rocher
2009-12-14 21:34 ` Juri Linkov
2009-12-14 23:39 ` Juri Linkov
2009-12-15 0:20 ` Juri Linkov
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=87iqc9b5xv.fsf@mail.jurta.org \
--to=juri@jurta.org \
--cc=emacs-devel@gnu.org \
--cc=francesc.rocher@gmail.com \
/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).