bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9214: `fundamental-mode-hook' not run when setting up `fundamental-m


From: Štěpán Němec
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

On Sun, 29 Jan 2012 02:44:27 +0100
Juanma Barranquero wrote:

> On Sun, Jan 29, 2012 at 02:40, Chong Yidong <address@hidden> 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]