[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#64415: [PATCH] Use first match in dir-local `auto-mode-alist'
From: |
Stefan Monnier |
Subject: |
bug#64415: [PATCH] Use first match in dir-local `auto-mode-alist' |
Date: |
Sat, 08 Jun 2024 19:38:09 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> * 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 in Thread] |
Current Thread |
[Next in Thread] |
- bug#64415: [PATCH] Use first match in dir-local `auto-mode-alist',
Stefan Monnier <=