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: Juanma Barranquero <lekktu <at> gmail.com>
Cc: Chong Yidong <cyd <at> gnu.org>, 9214 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: bug#9214: `fundamental-mode-hook' not run when setting up `fundamental-mode' under certain circumstances; Info documentation incorrect
Date: Sun, 29 Jan 2012 17:34:27 +0100
On Sun, 29 Jan 2012 02:44:27 +0100
Juanma Barranquero wrote:

> On Sun, Jan 29, 2012 at 02:40, Chong Yidong <cyd <at> gnu.org> wrote:
>
>> Or use after-change-major-mode-hook.
>
> The OP's use case
>
> (with-current-buffer (get-buffer-create "f-m-test-buf")
>  major-mode)
>
> does not run after-change-major-mode-hook, I think.

Exactly. I need a way to run code for _any_ new buffer (I don't really
need to run the code for temporary buffers which never get any user
interaction, but I don't think there is a way to set those apart), no
matter how it is created.

Is that really so much to ask?

If so, I suppose a `display-buffer-functions' hook as proposed by Juanma
on emacs-devel just now[1] would be something I could make do with (the
problem with that solution would be that I only need to run the code
once when the buffer is created, but I guess testing a variable every
time a buffer is displayed isn't worse than running useless code for
never-displayed temporary buffers).

`after-change-major-mode-hook' is what I use, but it is not run for new
default-moded buffers, even when I setq-default `major-mode' to
something else than `fundamental-mode' (maybe because `major-mode' is
only used when the buffer is created by `find-file'? The `major-mode'
docstring needs some clarification in that respect).

[1] <http://permalink.gmane.org/gmane.emacs.devel/147999>

-- 
Š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.