From: Glenn Morris <rgm@gnu.org>
To: Rolf Ade <rolf@pointsman.de>
Cc: 22348@debbugs.gnu.org
Subject: bug#22348: 24.5; Mode hooks doesn't run as expected if the major mode of a new buffer is determined by the default major mode
Date: Mon, 11 Jan 2016 17:27:10 -0500 [thread overview]
Message-ID: <3f8u3vhhvl.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <87wprg2snf.fsf@linux-qg7d.fritz.box> (Rolf Ade's message of "Mon, 11 Jan 2016 13:43:32 +0100")
Gosh, that's rather a long bug report. :)
If you do:
./src/emacs -Q --eval "(progn (setq-default major-mode 'text-mode)
(add-hook 'text-mode-hook (lambda () (message \"FOO\") (sit-for 3))))"
/tmp/foo.bar
you'll see it works fine. This suggest that the issue is specific to
point-motion (your example used end-of-buffer).
set-auto-mode calls set-buffer-major-mode if nothing else specifies a mode.
set-buffer-major-mode can operate on buffers other than the current one,
and uses save-excursion to preserve buffer. But set-auto-mode calls it
to operate on current-buffer. Thus save-excursion undoes your hook's
point changes. So that's the real issue here.
next prev parent reply other threads:[~2016-01-11 22:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-11 12:43 bug#22348: 24.5; Mode hooks doesn't run as expected if the major mode of a new buffer is determined by the default major mode Rolf Ade
2016-01-11 22:27 ` Glenn Morris [this message]
2016-01-11 22:56 ` Rolf Ade
2016-01-11 23:16 ` Glenn Morris
2016-01-12 17:34 ` Eli Zaretskii
2016-01-13 17:52 ` Glenn Morris
2016-01-13 4:05 ` Michael Heerdegen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3f8u3vhhvl.fsf@fencepost.gnu.org \
--to=rgm@gnu.org \
--cc=22348@debbugs.gnu.org \
--cc=rolf@pointsman.de \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.