GNU bug report logs - #9214
`fundamental-mode-hook' not run when setting up `fundamental-mode' under certain circumstances; Info documentation incorrect

Previous Next

Package: emacs;

Reported by: Štěpán Němec <stepnem <at> gmail.com>

Date: Mon, 1 Aug 2011 10:28:01 UTC

Severity: normal

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Štěpán Němec <stepnem <at> gmail.com>
To: 9214 <at> debbugs.gnu.org
Subject: bug#9214: `fundamental-mode-hook' not run when setting up `fundamental-mode' under certain circumstances; Info documentation incorrect
Date: Mon, 01 Aug 2011 12:22:09 +0200
(emacs-version)

"GNU Emacs 24.0.50.6 (i686-pc-linux-gnu) of 2011-01-15 on headley"

Steps to reproduce:
-------------------
emacs -Q

(defvar f-m-hook-run 0)

(add-hook 'fundamental-mode-hook
          (lambda () (setq f-m-hook-run (1+ f-m-hook-run))))

(with-current-buffer (get-buffer-create "f-m-test-buf")
  major-mode)
;=> fundamental-mode

f-m-hook-run
;=> 0

(with-current-buffer (get-buffer-create "f-m-test-buf")
  (fundamental-mode)
  major-mode)
;=> fundamental-mode

f-m-hook-run
;=> 1


A related problem: (info "(elisp)Auto Major Mode") states:

 -- Command: fundamental-mode
     Fundamental mode is a major mode that is not specialized for
     anything in particular.  Other major modes are defined in effect
     by comparison with this one--their definitions say what to change,
     starting from Fundamental mode.  The `fundamental-mode' function
     does _not_ run any mode hooks; you're not supposed to customize
     it.  (If you want Emacs to behave differently in Fundamental mode,
     change the _global_ state of Emacs.)

Which is incorrect, as the recipe above shows (the hook _is_ run when
`fundamental-mode' is called explicitly).

-- 
Štěpán




This bug report was last modified 13 years and 175 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.