Subject: Re: bug#75961: set-auto-mode--apply-alist

From: nat chapman <[email-masked]>
Date: Sun, 16 Feb 2025 14:50:49 +0000

On Sunday, February 16th, 2025 at 00:19, Eli Zaretskii <[email-masked]> wrote:

> 
> 
> > From: Stefan Monnier [email-masked]
> 
> > Cc: nat chapman [email-masked], [email-masked],
> > [email-masked]
> > Date: Sat, 15 Feb 2025 18:53:16 -0500
> > 
> > > > emacs -Q --eval '(progn (define-derived-mode test-mode fundamental-mode
> > > > "TEST" (message "Test mode called")) (add-to-list (quote auto-mode-alist)
> > > > (quote ("\\.test$" test-mode t))))' file.html.test file.test
> > > > 
> > > > Buffer visiting file.html.test is in mhtml-mode, buffer visiting file.test
> > > > is in fundamental mode, no message is emitted.
> > 
> > Yup.
> > 
> > The patch below seems to do the trick. Any comment/objection?
> 
> 
> Not from me.

I'm not an expert, but the supplied test doesn't appear to check that text-mode is actually called when the mode falls through. I suspect that test would succeed even if you didn't make any change to set-auto-mode--apply alist, so I'm not sure it's useful (or at least not sufficient; maybe there wasn't a test of the (regexp mode t) behavior at all before).