From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: file local variables Date: Mon, 14 Dec 2009 23:29:16 +0200 Organization: JURTA Message-ID: <87iqc9b5xv.fsf@mail.jurta.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1260827185 28397 80.91.229.12 (14 Dec 2009 21:46:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Dec 2009 21:46:25 +0000 (UTC) Cc: emacs-devel@gnu.org To: Francesc Rocher Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 14 22:46:17 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NKIge-0003t3-Fq for ged-emacs-devel@m.gmane.org; Mon, 14 Dec 2009 22:42:36 +0100 Original-Received: from localhost ([127.0.0.1]:36896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NKIge-0007e1-9M for ged-emacs-devel@m.gmane.org; Mon, 14 Dec 2009 16:42:36 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NKIgX-0007dm-Bf for emacs-devel@gnu.org; Mon, 14 Dec 2009 16:42:29 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NKIgS-0007ck-Eg for emacs-devel@gnu.org; Mon, 14 Dec 2009 16:42:28 -0500 Original-Received: from [199.232.76.173] (port=34684 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NKIgS-0007cb-Bq for emacs-devel@gnu.org; Mon, 14 Dec 2009 16:42:24 -0500 Original-Received: from smtp-out3.starman.ee ([85.253.0.5]:49142 helo=mx1.starman.ee) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NKIgR-0007cv-TV for emacs-devel@gnu.org; Mon, 14 Dec 2009 16:42:24 -0500 X-Virus-Scanned: by Amavisd-New at mx1.starman.ee Original-Received: from mail.starman.ee (82.131.94.164.cable.starman.ee [82.131.94.164]) by mx1.starman.ee (Postfix) with ESMTP id 59E2E3F41F2; Mon, 14 Dec 2009 23:42:16 +0200 (EET) In-Reply-To: (Francesc Rocher's message of "Mon, 14 Dec 2009 19:24:27 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (x86_64-pc-linux-gnu) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:118624 Archived-At: > 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/