From bc413b3507c19a376af08808c4e00c3e5842d4b7 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Fri, 6 Feb 2026 22:50:49 +0100 Subject: [PATCH] Use 'buffer-file-name' when matching 'auto-mode-alist' * lisp/emacs-lisp/package-activate.el (package--suggestion-applies-p): The file name associated with a buffer is a better match for entries in 'auto-mode-alist', so we use that instead of the buffer name that can have additional noise to make the name unique. --- lisp/emacs-lisp/package-activate.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/package-activate.el b/lisp/emacs-lisp/package-activate.el index cc73860708d..3965906f5d8 100644 --- a/lisp/emacs-lisp/package-activate.el +++ b/lisp/emacs-lisp/package-activate.el @@ -588,7 +588,7 @@ what command to invoke to enable the package." `(,(pred package-installed-p) . ,_)) nil) (`(,_ auto-mode-alist ,ext . ,_) - (and (string-match-p ext (buffer-name)) t)) + (and (buffer-file-name) (string-match-p ext (buffer-file-name)) t)) (`(,_ magic-mode-alist ,mag . ,_) (without-restriction (save-excursion