From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Shynur Xie <one.last.kiss@outlook.com>
Cc: 64415@debbugs.gnu.org
Subject: bug#64415: [PATCH] Use first match in dir-local `auto-mode-alist'
Date: Sat, 08 Jun 2024 19:38:09 -0400 [thread overview]
Message-ID: <jwvtti3t48b.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <PH0PR11MB747042BADD45AB375A9B4BBAD728A@PH0PR11MB7470.namprd11.prod.outlook.com> (Shynur Xie's message of "Sun, 2 Jul 2023 10:29:13 +0000")
> * lisp/files.el (set-auto-mode): Reverse the reversed alist.
> ---
> lisp/files.el | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/files.el b/lisp/files.el
> index 148f47cbc97..fc3b47082ea 100644
> --- a/lisp/files.el
> +++ b/lisp/files.el
> @@ -3396,8 +3396,9 @@ we don't actually set it to the same mode the buffer already has."
> (unless done
> (with-demoted-errors "Directory-local variables error: %s"
> ;; Note this is a no-op if enable-local-variables is nil.
> - (let* ((mode-alist (cdr (hack-dir-local--get-variables
> - (lambda (key) (eq key 'auto-mode-alist))))))
> + (let* ((mode-alist (reverse (cdr (hack-dir-local--get-variables
> + (lambda (key)
> + (eq key 'auto-mode-alist)))))))
> (setq done (set-auto-mode--apply-alist mode-alist
> keep-mode-if-same t)))))
> (and (not done)
AFAICT the reversal happens within `dir-locals-collect-mode-variables`.
I think this is a bug in `hack-dir-local--get-variables`: it should return the
vars in the same order as found in the file.
Stefan
prev parent reply other threads:[~2024-06-08 23:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-02 10:29 bug#64415: [PATCH] Use first match in dir-local `auto-mode-alist' Shynur Xie
2023-07-02 10:58 ` Eli Zaretskii
2023-07-02 11:16 ` Shynur Xie
2023-07-02 11:29 ` Shynur Xie
2024-06-08 23:38 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvtti3t48b.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=64415@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=one.last.kiss@outlook.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.