diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 095bd5faa03..580cc0115cf 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -651,7 +651,12 @@ define-globalized-minor-mode (dolist (buf buffers) (when (buffer-live-p buf) (with-current-buffer buf - (,MODE-enable-in-buffer)))))) + ;; If `delay-mode-hooks' is set, it indicates that + ;; the current buffer's mode is not fully setup yet, + ;; and also that `run-mode-hooks' will be run afterwards + ;; anyway, so we don't need to keep BUF in MODE-buffers. + (unless delay-mode-hooks + (,MODE-enable-in-buffer))))))) (put ',MODE-enable-in-buffers 'definition-name ',global-mode) (defun ,MODE-check-buffers ()