]> git.eshelyaron.com Git - emacs.git/commit
(set-auto-mode): Streamline to fix bug#67795
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 15 Mar 2024 02:15:41 +0000 (22:15 -0400)
committerEshel Yaron <me@eshelyaron.com>
Fri, 15 Mar 2024 09:05:48 +0000 (10:05 +0100)
commit6a81d48e345bb62f84561736edfca4697d1a4465
treea08d8e28dc74a39fb9ccd462eea8b8c7932b7be1
parentad34de36383d373eb96384901cccf56851aecbde
(set-auto-mode): Streamline to fix bug#67795

The old code tested if the mode function is `fboundp` but in an
inconsistent way and without paying attention to
`major-mode-remap`.

* lisp/files.el (set-auto-mode-0): Return `:keep` rather than nil if
the mode was already set.  And emit a warning when the mode function
doesn't exist.
(set-auto-mode): Remove checks that the mode function exists now that
`set-auto-mode-0` does it for us.  Adjust to the new return values of
that function, and simplify the code using a big `or` instead of
a sequence of steps each setting&testing `done`.
(hack-local-variables--find-variables): Use `major-mode-remap`
when skipping the "mode:" entries that specify modes we don't have.
Also, when (eq handle-mode t), don't bother building a list of results
only to return a single element in the end.

(cherry picked from commit 9422a6737447b186ca017929da79985cef7898a8)
lisp/files.el