From unknown Thu Aug 14 18:32:26 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#8586 <8586@debbugs.gnu.org> To: bug#8586 <8586@debbugs.gnu.org> Subject: Status: 23.3.50; Directory-local variable ignored when file-local variables set mode Reply-To: bug#8586 <8586@debbugs.gnu.org> Date: Fri, 15 Aug 2025 01:32:26 +0000 retitle 8586 23.3.50; Directory-local variable ignored when file-local vari= ables set mode reassign 8586 emacs submitter 8586 Reuben Thomas severity 8586 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 29 15:38:46 2011 Received: (at submit) by debbugs.gnu.org; 29 Apr 2011 19:38:46 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QFtWW-0001Cz-Sh for submit@debbugs.gnu.org; Fri, 29 Apr 2011 15:38:45 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QFtWT-0001CU-H9 for submit@debbugs.gnu.org; Fri, 29 Apr 2011 15:38:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QFtWN-0004GN-5R for submit@debbugs.gnu.org; Fri, 29 Apr 2011 15:38:36 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:44285) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFtWN-0004GC-3N for submit@debbugs.gnu.org; Fri, 29 Apr 2011 15:38:35 -0400 Received: from eggs.gnu.org ([140.186.70.92]:37385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFtWL-0002mW-NQ for bug-gnu-emacs@gnu.org; Fri, 29 Apr 2011 15:38:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QFtWK-0004FO-4Q for bug-gnu-emacs@gnu.org; Fri, 29 Apr 2011 15:38:33 -0400 Received: from exprod7og127.obsmtp.com ([64.18.2.210]:57883) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QFtWJ-0004DV-RY for bug-gnu-emacs@gnu.org; Fri, 29 Apr 2011 15:38:32 -0400 Received: from mail-ww0-f43.google.com ([74.125.82.43]) (using TLSv1) by exprod7ob127.postini.com ([64.18.6.12]) with SMTP ID DSNKTbsTsiw2/bqohNjkwFtB2jeCLxgooaqB@postini.com; Fri, 29 Apr 2011 12:38:31 PDT Received: by wwb17 with SMTP id 17so3720440wwb.24 for ; Fri, 29 Apr 2011 12:38:21 -0700 (PDT) Received: by 10.216.65.203 with SMTP id f53mr1115409wed.54.1304105900040; Fri, 29 Apr 2011 12:38:20 -0700 (PDT) Received: from canta (87-194-87-241.bethere.co.uk [87.194.87.241]) by mx.google.com with ESMTPS id n2sm1515783wej.22.2011.04.29.12.38.17 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 29 Apr 2011 12:38:18 -0700 (PDT) From: Reuben Thomas To: bug-gnu-emacs@gnu.org Subject: 23.3.50; Directory-local variable ignored when file-local variables set mode Date: Fri, 29 Apr 2011 20:38:16 +0100 Message-ID: <87vcxwzw47.fsf@sc3d.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.0 (------) I have the following .dir-locals.el in a directory: ((nil . ((indent-tabs-mode . nil) (tab-width . 4)))) and two other files, foo and foo.pl, with the same contents: ## Local Variables: ## mode : perl ## End: When I open foo, tab-width and indent-tabs-mode are set to their default values. When I open foo.pl, they are set to the values given by .dir-locals.el. If I remove the mode: setting from foo and add other local variables, both they and the .dir-locals.el values are used. If I change the initial nil in .dir-locals.el to perl-mode, it has no effect. The bug here is that the .dir-locals.el settings should be applied in both cases AFAICS, but they are only applied in one, and ignored in the other (even when the mode matches exactly!). Apparently, it is something to do with the mode being set at a late stage. In GNU Emacs 23.3.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.4) of 2011-04-24 on canta Windowing system distributor `The X.Org Foundation', version 11.0.11001000 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_GB.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Help Minor modes in effect: recentf-mode: t show-paren-mode: t savehist-mode: t minibuffer-electric-default-mode: t iswitchb-mode: t icomplete-mode: t global-whitespace-mode: t global-auto-revert-mode: t desktop-save-mode: t nxhtml-menu-mode: t mouse-wheel-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 column-number-mode: t line-number-mode: t transient-mark-mode: t view-mode: t Recent input: C-x C-f . . r e d i n i l l C-x C-s C-x b C-x k C-x b C-x k C-x C-f C-c C-h v C-x C-f C-x C-f C-x C-f C-g C-x C-s C-x k C-x C-f SPC . SPC C-x C-s ( t a b - w i d t h SPC 4 ) C-e C-x C-s C-x b C-g C-n C-n C-n C-n C-n C-n C-x C-f C-g SPC . C-x C-s M-x r e p o r t - e m a c s - D i r e c t o r r y y - l o c a l SPC v a r i a b l e s C-_ P r o C l a s h SPC b e t w e e n SPC P r o b l e m SPC C-] C-] C-] C-h v M-x r e p o r t - e m a c s - b u g Recent messages: Saving file /home/rrt/repo/gnulib/.dir-locals.el... Wrote /home/rrt/repo/gnulib/.dir-locals.el Saving file /home/rrt/repo/gnulib/.dir-locals.el... Wrote /home/rrt/repo/gnulib/.dir-locals.el Quit [2 times] Mark set Saving file /home/rrt/repo/gnulib/.dir-locals.el... Wrote /home/rrt/repo/gnulib/.dir-locals.el Read only text copied to kill ring Quit call-interactively: No recursive edit is in progress [2 times] Load-path shadows: /home/rrt/local/share/emacs/nxhtml/util/rnc-mode hides /usr/share/emacs-snapshot/site-lisp/rnc-mode/rnc-mode /home/rrt/local/share/emacs/nxhtml/related/php-mode hides /home/rrt/local/share/emacs/site-lisp/php-mode /home/rrt/.emacs.d/elpa/dictionary-1.8.7/link hides /usr/local/share/emacs/23.3.50/site-lisp/dictionary-el/link /home/rrt/.emacs.d/elpa/dictionary-1.8.7/connection hides /usr/local/share/emacs/23.3.50/site-lisp/dictionary-el/connection /home/rrt/.emacs.d/elpa/dictionary-1.8.7/dictionary-init hides /usr/local/share/emacs/23.3.50/site-lisp/dictionary-el/dictionary-init /home/rrt/.emacs.d/elpa/dictionary-1.8.7/dictionary hides /usr/local/share/emacs/23.3.50/site-lisp/dictionary-el/dictionary /home/rrt/local/share/emacs/site-lisp/graphviz-dot-mode hides /usr/local/share/emacs/23.3.50/site-lisp/emacs-goodies-el/graphviz-dot-mode /home/rrt/local/share/emacs/site-lisp/dict hides /usr/local/share/emacs/23.3.50/site-lisp/emacs-goodies-el/dict /usr/local/share/emacs/23.3.50/site-lisp/css-mode/css-mode hides /usr/local/share/emacs/23.3.50/lisp/textmodes/css-mode /usr/share/emacs-snapshot/site-lisp/ruby1.8-elisp/ruby-mode hides /usr/local/share/emacs/23.3.50/lisp/progmodes/ruby-mode /usr/local/share/emacs/23.3.50/site-lisp/css-mode/css-mode hides /usr/share/emacs/site-lisp/css-mode/css-mode /usr/local/share/emacs/23.3.50/site-lisp/auctex/tex-info hides /usr/share/emacs/site-lisp/auctex/tex-info /usr/local/share/emacs/23.3.50/site-lisp/auctex/context-nl hides /usr/share/emacs/site-lisp/auctex/context-nl /usr/local/share/emacs/23.3.50/site-lisp/auctex/context-en hides /usr/share/emacs/site-lisp/auctex/context-en /usr/local/share/emacs/23.3.50/site-lisp/auctex/latex hides /usr/share/emacs/site-lisp/auctex/latex /usr/local/share/emacs/23.3.50/site-lisp/auctex/tex-mik hides /usr/share/emacs/site-lisp/auctex/tex-mik /usr/local/share/emacs/23.3.50/site-lisp/auctex/tex-buf hides /usr/share/emacs/site-lisp/auctex/tex-buf /usr/local/share/emacs/23.3.50/site-lisp/auctex/tex-jp hides /usr/share/emacs/site-lisp/auctex/tex-jp /usr/local/share/emacs/23.3.50/site-lisp/auctex/tex-bar hides /usr/share/emacs/site-lisp/auctex/tex-bar /usr/local/share/emacs/23.3.50/site-lisp/auctex/tex hides /usr/share/emacs/site-lisp/auctex/tex /usr/local/share/emacs/23.3.50/site-lisp/auctex/multi-prompt hides /usr/share/emacs/site-lisp/auctex/multi-prompt /usr/local/share/emacs/23.3.50/site-lisp/auctex/tex-fptex hides /usr/share/emacs/site-lisp/auctex/tex-fptex /usr/local/share/emacs/23.3.50/site-lisp/auctex/tex-font hides /usr/share/emacs/site-lisp/auctex/tex-font /usr/local/share/emacs/23.3.50/site-lisp/auctex/tex-fold hides /usr/share/emacs/site-lisp/auctex/tex-fold /usr/local/share/emacs/23.3.50/site-lisp/auctex/texmathp hides /usr/share/emacs/site-lisp/auctex/texmathp /usr/local/share/emacs/23.3.50/site-lisp/auctex/context hides /usr/share/emacs/site-lisp/auctex/context /usr/local/share/emacs/23.3.50/site-lisp/auctex/font-latex hides /usr/share/emacs/site-lisp/auctex/font-latex /usr/local/share/emacs/23.3.50/site-lisp/auctex/bib-cite hides /usr/share/emacs/site-lisp/auctex/bib-cite /usr/local/share/emacs/23.3.50/site-lisp/auctex/toolbar-x hides /usr/share/emacs/site-lisp/auctex/toolbar-x /usr/local/share/emacs/23.3.50/site-lisp/auctex/tex-style hides /usr/share/emacs/site-lisp/auctex/tex-style Features: (shadow sort mail-extr message sendmail 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 mailheader canlock hashcash mail-utils emacsbug two-column iso-transl cus-edit time-stamp multi-isearch jka-compr find-func pp help-mode view parse-time vc-cvs tex-info texinfo tex cperl-mode sh-script executable inform-mode autoconf autoconf-mode make-mode info vc-git vc-bzr sha1 hex-util face-remap filladapt flyspell completing-help recentf tree-widget wid-edit uniquify paren savehist minibuf-eldef iswitchb icomplete whitespace autorevert time as-external wrap-to-fill cus-start cus-load desktop server nxhtml-autostart nxhtml-autoload majmodpri rnc-mode nxhtml-menu web-autoload nxhtml-base php-mode etags cc-langs cc-mode cc-fonts cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs speedbar sb-image ezimage dframe lua-mode regexp-opt comint ring ropemacs pymacs ffap ispell smart-quotes auto-dictionary-autoloads c-eldoc-autoloads dictionary-autoloads diff-git-autoloads dired-isearch-autoloads full-ack-autoloads guess-style-autoloads kill-ring-search-autoloads magit-autoloads mv-shell-autoloads tumble-autoloads http-post-simple-autoloads package reporter advice advice-preload yasnippet help-fns derived edmacro kmacro easymenu assoc cl cl-19 muse-autoloads emacs-goodies-el emacs-goodies-custom emacs-goodies-loaddefs easy-mmode preview-latex tex-site auto-loads tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd font-setting 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 system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs) -- http://rrt.sc3d.org/ From debbugs-submit-bounces@debbugs.gnu.org Mon May 02 20:45:21 2011 Received: (at 8586) by debbugs.gnu.org; 3 May 2011 00:45:21 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QH3js-00010k-QI for submit@debbugs.gnu.org; Mon, 02 May 2011 20:45:20 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QH3jq-00010Z-Rb for 8586@debbugs.gnu.org; Mon, 02 May 2011 20:45:19 -0400 Received: from localhost ([127.0.0.1]:37541) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QH3jk-00070T-Ba; Mon, 02 May 2011 20:45:12 -0400 From: Glenn Morris To: Reuben Thomas Subject: Re: bug#8586: 23.3.50; Directory-local variable ignored when file-local variables set mode References: <87vcxwzw47.fsf@sc3d.org> X-Spook: Glock SCUD missile INS Ft. Bragg United Nations argus X-Ran: (Zv%TM/Q0)+l]|zMo8G}g:\r\*v`^~g[U@0wio|2_A2-`JX"x+_#5oUk>l0A&:ok]rxggA X-Hue: red X-Debbugs-No-Ack: yes X-Attribution: GM Date: Mon, 02 May 2011 20:45:11 -0400 In-Reply-To: <87vcxwzw47.fsf@sc3d.org> (Reuben Thomas's message of "Fri, 29 Apr 2011 20:38:16 +0100") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.8 (----) X-Debbugs-Envelope-To: 8586 Cc: 8586@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) Reuben Thomas wrote: > The bug here is that the .dir-locals.el settings should be applied in > both cases AFAICS, but they are only applied in one, and ignored in the > other (even when the mode matches exactly!). Apparently, it is something > to do with the mode being set at a late stage. I imagine this is an unintended version of this: 57.3.4.1 Specifying File Variables [...] If `mode' is used to set a major mode, it should be the first "variable" in the list. Otherwise, the entries that precede it will usually have no effect, since most major modes kill all local variables as part of their initialization. From debbugs-submit-bounces@debbugs.gnu.org Sat May 21 21:36:00 2011 Received: (at 8586) by debbugs.gnu.org; 22 May 2011 01:36:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QNxaJ-0007qp-Lu for submit@debbugs.gnu.org; Sat, 21 May 2011 21:36:00 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QNxaG-0007qc-DL for 8586@debbugs.gnu.org; Sat, 21 May 2011 21:35:57 -0400 Received: from localhost ([127.0.0.1]:51784) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNxaA-0004GW-Az; Sat, 21 May 2011 21:35:50 -0400 From: Glenn Morris To: Reuben Thomas Subject: Re: bug#8586: 23.3.50; Directory-local variable ignored when file-local variables set mode References: <87vcxwzw47.fsf@sc3d.org> X-Spook: TELINT Jiang Zemin ammunition Aladdin quiche Dateline X-Ran: 6,&3.y(a(_WxV{+U2K-l^Q:EG|^0Da_nw)w?\=$9gI.\d!U5+R4YagY/7g1uc9ffls+pEP X-Hue: blue X-Attribution: GM Date: Sat, 21 May 2011 21:35:49 -0400 In-Reply-To: (Glenn Morris's message of "Mon, 02 May 2011 20:45:11 -0400") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: 8586 Cc: 8586@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.3 (------) I think this area is a bit of mess, but here is an attempt at a fix. In the longer term, since they do a lot of the same thing, unifying set-auto-mode and set-auto-coding might make sense (eg to solve bug#7169). *** lisp/files.el 2011-05-22 01:18:49 +0000 --- lisp/files.el 2011-05-22 01:28:30 +0000 *************** *** 2244,2250 **** (report-errors "File mode specification error: %s" (set-auto-mode)) (report-errors "File local-variables error: %s" ! (hack-local-variables))) ;; Turn font lock off and on, to make sure it takes account of ;; whatever file local variables are relevant to it. (when (and font-lock-mode --- 2244,2250 ---- (report-errors "File mode specification error: %s" (set-auto-mode)) (report-errors "File local-variables error: %s" ! (hack-local-variables nil t))) ;; Turn font lock off and on, to make sure it takes account of ;; whatever file local variables are relevant to it. (when (and font-lock-mode *************** *** 2616,2631 **** "Select major mode appropriate for current buffer. To find the right major mode, this function checks for a -*- mode tag, checks if it uses an interpreter listed in `interpreter-mode-alist', matches the buffer beginning against `magic-mode-alist', compares the filename against the entries in `auto-mode-alist', then matches the buffer beginning against `magic-fallback-mode-alist'. ! It does not check for the `mode:' local variable in the ! Local Variables section of the file; for that, use `hack-local-variables'. ! ! If `enable-local-variables' is nil, this function does not check for a ! -*- mode tag. If the optional argument KEEP-MODE-IF-SAME is non-nil, then we set the major mode only if that would change it. In other words --- 2616,2629 ---- "Select major mode appropriate for current buffer. To find the right major mode, this function checks for a -*- mode tag, + checks for a `mode:' entry in the Local Variables section of the file, checks if it uses an interpreter listed in `interpreter-mode-alist', matches the buffer beginning against `magic-mode-alist', compares the filename against the entries in `auto-mode-alist', then matches the buffer beginning against `magic-fallback-mode-alist'. ! If `enable-local-variables' is nil, this function does not check for ! any mode: tag. If the optional argument KEEP-MODE-IF-SAME is non-nil, then we set the major mode only if that would change it. In other words *************** *** 2667,2672 **** --- 2665,2677 ---- (or (set-auto-mode-0 mode keep-mode-if-same) ;; continuing would call minor modes again, toggling them off (throw 'nop nil)))))) + (and (not done) + (setq mode (hack-local-variables t)) + (not (memq mode modes)) ; already tried and failed + (if (not (functionp mode)) + (message "Ignoring unknown mode `%s'" mode) + (setq done t) + (set-auto-mode-0 mode keep-mode-if-same))) ;; If we didn't, look for an interpreter specified in the first line. ;; As a special case, allow for things like "#!/bin/env perl", which ;; finds the interpreter anywhere in $PATH. *************** *** 3144,3155 **** (assq-delete-all (car elt) file-local-variables-alist))) (push elt file-local-variables-alist))))) ! (defun hack-local-variables (&optional mode-only) "Parse and put into effect this buffer's local variables spec. If MODE-ONLY is non-nil, all we do is check whether a \"mode:\" is specified, and return the corresponding mode symbol, or nil. In this case, we try to ignore minor-modes, and only return a ! major-mode." (let ((enable-local-variables (and local-enable-local-variables enable-local-variables)) result) --- 3149,3164 ---- (assq-delete-all (car elt) file-local-variables-alist))) (push elt file-local-variables-alist))))) ! (defun hack-local-variables (&optional mode-only keep-mode-if-same) "Parse and put into effect this buffer's local variables spec. If MODE-ONLY is non-nil, all we do is check whether a \"mode:\" is specified, and return the corresponding mode symbol, or nil. In this case, we try to ignore minor-modes, and only return a ! major-mode. ! ! If the optional argument KEEP-MODE-IF-SAME is non-nil, then we ! ignore a mode: entry if it specifies the same major-mode as the ! buffer already has." (let ((enable-local-variables (and local-enable-local-variables enable-local-variables)) result) *************** *** 3186,3192 **** (forward-line 1) (let ((startpos (point)) endpos ! (thisbuf (current-buffer))) (save-excursion (unless (let ((case-fold-search t)) (re-search-forward --- 3195,3202 ---- (forward-line 1) (let ((startpos (point)) endpos ! (thisbuf (current-buffer)) ! (thismajor major-mode)) (save-excursion (unless (let ((case-fold-search t)) (re-search-forward *************** *** 3242,3248 **** "-minor\\'" (setq val2 (symbol-name val)))) (setq result (intern (concat val2 "-mode")))) ! (unless (eq var 'coding) (condition-case nil (push (cons (if (eq var 'eval) 'eval --- 3252,3266 ---- "-minor\\'" (setq val2 (symbol-name val)))) (setq result (intern (concat val2 "-mode")))) ! (or (eq var 'coding) ! (and keep-mode-if-same ! (eq var 'mode) ! (functionp ! (setq val2 ! (intern ! (concat (symbol-name val) "-mode")))) ! (eq (indirect-function thismajor) ! (indirect-function val2))) (condition-case nil (push (cons (if (eq var 'eval) 'eval From debbugs-submit-bounces@debbugs.gnu.org Sun May 22 12:53:43 2011 Received: (at 8586) by debbugs.gnu.org; 22 May 2011 16:53:43 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QOBuR-0003SB-3s for submit@debbugs.gnu.org; Sun, 22 May 2011 12:53:43 -0400 Received: from exprod7og125.obsmtp.com ([64.18.2.28]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1QOBuN-0003Rv-W4 for 8586@debbugs.gnu.org; Sun, 22 May 2011 12:53:41 -0400 Received: from mail-yi0-f45.google.com ([209.85.218.45]) (using TLSv1) by exprod7ob125.postini.com ([64.18.6.12]) with SMTP ID DSNKTdk/jUNi5AJ6gYf2s7Tf25YuL2xYEJks@postini.com; Sun, 22 May 2011 09:53:39 PDT Received: by yib19 with SMTP id 19so2154720yib.4 for <8586@debbugs.gnu.org>; Sun, 22 May 2011 09:53:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.185.38 with SMTP id t26mr1831240yhm.164.1306083213383; Sun, 22 May 2011 09:53:33 -0700 (PDT) Received: by 10.236.103.164 with HTTP; Sun, 22 May 2011 09:53:33 -0700 (PDT) In-Reply-To: References: <87vcxwzw47.fsf@sc3d.org> Date: Sun, 22 May 2011 17:53:33 +0100 Message-ID: Subject: Re: bug#8586: 23.3.50; Directory-local variable ignored when file-local variables set mode From: Reuben Thomas To: Glenn Morris Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: 8586 Cc: 8586@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.4 (------) On 22 May 2011 02:35, Glenn Morris wrote: > > I think this area is a bit of mess, but here is an attempt at a fix. Thanks very much for this. While it would fix this bug, I'm not sure I approve: it looks as though it makes things more complicated, and when the "real fix" eventually arrives, would presumably have to remain in place for those who'd adopted this partial solution in the mean time...not great. -- http://rrt.sc3d.org From debbugs-submit-bounces@debbugs.gnu.org Mon May 23 13:04:45 2011 Received: (at 8586) by debbugs.gnu.org; 23 May 2011 17:04:45 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QOYYf-0006b6-7b for submit@debbugs.gnu.org; Mon, 23 May 2011 13:04:45 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QOYYc-0006am-SK for 8586@debbugs.gnu.org; Mon, 23 May 2011 13:04:43 -0400 Received: from localhost ([127.0.0.1]:38422) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOYYV-0000MS-GS; Mon, 23 May 2011 13:04:35 -0400 From: Glenn Morris To: Reuben Thomas Subject: Re: bug#8586: 23.3.50; Directory-local variable ignored when file-local variables set mode References: <87vcxwzw47.fsf@sc3d.org> X-Spook: high security Treasury CISU Glock AMW fissionable militia X-Ran: B@VxQg&OGP=i|5ZZQ}0T[dJfM[[+?#3vWkmJ\,Cx+Zy>&4|{"=):tm8)<)HPgen:J_>9?L X-Hue: magenta X-Debbugs-No-Ack: yes X-Attribution: GM Date: Mon, 23 May 2011 13:04:34 -0400 Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: 8586 Cc: 8586@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.3 (------) Reuben Thomas wrote: > While it would fix this bug, I'm not sure I approve: it looks as > though it makes things more complicated, and when the "real fix" > eventually arrives, would presumably have to remain in place for those > who'd adopted this partial solution in the mean time...not great. These comments don't apply. This isn't a partial solution, and no-one needs to "adopt" anything. I'm making set-auto-mode respect mode: cookies whether they be at the start or end of the file. That's how it should work, IMO. It also removes the "major mode must be specified first" restriction (bug#5239). The only issue I see with it is that normal-mode will be less efficient than it could be, because set-auto-mode and hack-local-variables may parse similar regions of the file in similar ways. Ideally, the file would be parsed only once to get coding:, mode: and variables, which would then be applied (also allowing bug#7169 to be fixed). But this is not straightforward to do, because these features are currently spread over at least 4 functions, so I don't see it happening any time soon. From debbugs-submit-bounces@debbugs.gnu.org Mon May 23 14:11:23 2011 Received: (at 8586) by debbugs.gnu.org; 23 May 2011 18:11:23 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QOZb9-0008Ei-1q for submit@debbugs.gnu.org; Mon, 23 May 2011 14:11:23 -0400 Received: from exprod7og124.obsmtp.com ([64.18.2.26]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1QOZb6-0008EP-6F for 8586@debbugs.gnu.org; Mon, 23 May 2011 14:11:21 -0400 Received: from mail-yx0-f182.google.com ([209.85.213.182]) (using TLSv1) by exprod7ob124.postini.com ([64.18.6.12]) with SMTP ID DSNKTdqjPOZ5O0gPz+s2VrvRVlOWhDSo/U8x@postini.com; Mon, 23 May 2011 11:11:20 PDT Received: by yxl31 with SMTP id 31so2845469yxl.13 for <8586@debbugs.gnu.org>; Mon, 23 May 2011 11:11:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.170.225 with SMTP id p61mr3447352yhl.231.1306174267488; Mon, 23 May 2011 11:11:07 -0700 (PDT) Received: by 10.236.103.164 with HTTP; Mon, 23 May 2011 11:11:06 -0700 (PDT) In-Reply-To: References: <87vcxwzw47.fsf@sc3d.org> Date: Mon, 23 May 2011 19:11:06 +0100 Message-ID: Subject: Re: bug#8586: 23.3.50; Directory-local variable ignored when file-local variables set mode From: Reuben Thomas To: Glenn Morris Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: 8586 Cc: 8586@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.4 (------) On 23 May 2011 18:04, Glenn Morris wrote: > > These comments don't apply. This isn't a partial solution, and no-one > needs to "adopt" anything. I'm sorry, I misread the patch. Looks good. -- http://rrt.sc3d.org From debbugs-submit-bounces@debbugs.gnu.org Thu May 26 21:01:11 2011 Received: (at 8586-done) by debbugs.gnu.org; 27 May 2011 01:01:11 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QPlQM-0004O5-Tm for submit@debbugs.gnu.org; Thu, 26 May 2011 21:01:11 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QPlQK-0004Nt-0n for 8586-done@debbugs.gnu.org; Thu, 26 May 2011 21:01:08 -0400 Received: from localhost ([127.0.0.1]:38136) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPlQE-0001xj-L1; Thu, 26 May 2011 21:01:02 -0400 From: Glenn Morris To: 8586-done@debbugs.gnu.org Subject: Re: bug#8586: 23.3.50; Directory-local variable ignored when file-local variables set mode References: <87vcxwzw47.fsf@sc3d.org> X-Spook: assassination target Maple CID Bin Laden Manfurov bce X-Ran: |pCnhB(sW$a5vT'O{G!|oqlg6hQZMh)VXE5Da|zsP)ZKr[L"0_hJ9x.FK_4.@#zqJPT]C$ X-Hue: yellow X-Debbugs-No-Ack: yes X-Attribution: GM Date: Thu, 26 May 2011 21:01:01 -0400 Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: 8586-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.3 (------) Version: 24.1 Applied. (Discovered the hack-local-variables part was not needed, since it already doesn't change the mode needlessly.) From debbugs-submit-bounces@debbugs.gnu.org Thu May 26 21:02:37 2011 Received: (at control) by debbugs.gnu.org; 27 May 2011 01:02:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QPlRl-0004Qa-7v for submit@debbugs.gnu.org; Thu, 26 May 2011 21:02:37 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QPlRj-0004QP-NB for control@debbugs.gnu.org; Thu, 26 May 2011 21:02:35 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1QPlRe-00021U-Ih for control@debbugs.gnu.org; Thu, 26 May 2011 21:02:30 -0400 Date: Thu, 26 May 2011 21:02:30 -0400 Message-Id: Subject: control message for bug 5239 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.3 (------) forcemerge 8586 5239 From unknown Thu Aug 14 18:32:26 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 24 Jun 2011 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator