unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Štěpán Němec" <stepnem@gmail.com>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: Chong Yidong <cyd@gnu.org>, 9214@debbugs.gnu.org
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	[thread overview]
Message-ID: <87pqe2zcvg.fsf@gmail.com> (raw)
In-Reply-To: <CAAeL0ST4ncsvY8mgsSgAY4dSAmu1i2p=AZYt0cmb=XeO7Hi84A@mail.gmail.com> (Juanma Barranquero's message of "Sun, 29 Jan 2012 02:44: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@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





  reply	other threads:[~2012-01-29 16:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2012-01-30  4:16             ` Stefan Monnier
2012-01-30  4:45               ` Štěpán Němec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pqe2zcvg.fsf@gmail.com \
    --to=stepnem@gmail.com \
    --cc=9214@debbugs.gnu.org \
    --cc=cyd@gnu.org \
    --cc=lekktu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).