Subject: Re: bug#9214: `fundamental-mode-hook' not run when setting up `fundamental-mode' under certain circumstances; Info documentation incorrect

From: Štěpán Němec <[email-masked]>
Date: Mon, 30 Jan 2012 05:45:50 +0100

On Sun, Jan 29, 2012 at 11:16:11PM -0500, Stefan Monnier wrote:
> > 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
>
> There is a way: whether they call a major-mode function or not.

Ooh, I did not know that. Thanks. Is this documented somewhere? (I.e., a
recommendation that a major mode function should be called in any buffer
of potential interest to the user.)

In that case, `after-change-major-mode-hook' should do, after all.

> Of course, some packages may erroneously forget to call a major-mode
> function for those buffers, but the problem is in those packages.

Yes, I admit I have code around that does(n't do) that myself (e.g.
simple dumping of some text into a buffer left in fundamental-mode), as
I had no idea calling e.g. `fundamental-mode' in a buffer already in
fundamental-mode was supposed to be of some value (until I bumped into
this problem, that is).

-- 
Štěpán