Subject: bug#38111: 27.0.50; globalized-minor-mode not enabled on get-buffer-create

From: Juri Linkov <[email-masked]>
Date: Wed, 13 Nov 2019 23:12:29 +0200

>> Sounds like globalized-minor-mode machinery somehow doesn't support
>> the latter method of creating a buffer?
>
> Yep, globalized modes use `after-change-major-mode-hook' to call the
> buffer-local minor mode, and that hook is not triggered in these cases
> because, although new buffers are in `fundamental-mode' by default,
> the `fundamental-mode' function is not actually called, and so no mode
> change occurs.
>
> I believe this has cropped up in past discussion, but I don't recall
> where offhand.
>
> I agree that it's surprising when you are expecting the global mode(s)
> to be enabled (I first realised it when attempting to use a globalized
> mode for my custom key bindings, and discovering they were not being
> enabled in various buffers).
>
> If this were changed then there *might* be undesirable consequences to
> having lots of created-behind-the-scenes buffers suddenly doing things
> they never did before.
>
> If the current behaviour is kept, the documentation for globalized
> modes and for creating buffers should probably say something about the
> matter.

Thanks for referring to the documentation.  It already explains this in
(info "(elisp) Defining Minor Modes")

 -- Macro: define-globalized-minor-mode global-mode mode turn-on
          keyword-args... body...
...
     Globally enabling the mode also affects buffers subsequently
     created by visiting files, and buffers that use a major mode other
     than Fundamental mode; but it does not detect the creation of a new
     buffer in Fundamental mode.