unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9214: `fundamental-mode-hook' not run when setting up `fundamental-mode' under certain circumstances; Info documentation incorrect
@ 2011-08-01 10:22 Štěpán Němec
  2012-01-28 10:37 ` Chong Yidong
  0 siblings, 1 reply; 10+ messages in thread
From: Štěpán Němec @ 2011-08-01 10:22 UTC (permalink / raw)
  To: 9214


(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





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-01-30  4:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-01 10:22 bug#9214: `fundamental-mode-hook' not run when setting up `fundamental-mode' under certain circumstances; Info documentation incorrect Štěpán Němec
2012-01-28 10:37 ` Chong Yidong
2012-01-28 20:24   ` Štěpán Němec
2012-01-28 22:54     ` Stefan Monnier
2012-01-28 23:34     ` Juanma Barranquero
2012-01-29  1:40       ` Chong Yidong
2012-01-29  1:44         ` Juanma Barranquero
2012-01-29 16:34           ` Štěpán Němec
2012-01-30  4:16             ` Stefan Monnier
2012-01-30  4:45               ` Štěpán Němec

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).