1

I am using Emacs 28.2. Here is my code:

;;; foo.el
(define-minor-mode foo-mode
  "Foo mode"
  :lighter " Foo"
  (message "foo-mode %s in buffer %s" foo-mode (buffer-name)))

(defun foo-mode-on ()
  (foo-mode 1))

(define-globalized-minor-mode global-foo-mode foo-mode foo-mode-on)

This works like I want.

emacs -q -l foo.el

Then I run these things:

C-x b *scratch*
M-x global-foo-mode
C-x b foo
C-x b bar
C-x b baz

I find that all buffers foo, bar and baz have Foo mode enabled. But https://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Minor-Modes.html has got this to tell

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.

But in my case, it did work for fundamental mode buffers too. Why did it work when the documentation says it should not have worked? Or the documentation does not say that and I am misunderstanding something?

1 Answer 1

1

I think you're right that the doc says what you suggest, and that the doc is wrong (the implementation doesn't seem to do what the doc says).

The behavior seems to be the same as far back as Emacs 26, but not in Emacs 25 or prior. IOW, the bug seems to have been introduced in Emacs 26.1. Whether it's a doc bug or the new behavior is the bug I can't say. A guess is that the new behavior is deliberate and Someone (TM) just neglected to remove that statement from the doc.

I suggest you report this as a bug: M-x report-emacs-bug.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.