all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rolf Ade <rolf@pointsman.de>
To: Glenn Morris <rgm@gnu.org>
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 23:56:12 +0100	[thread overview]
Message-ID: <5694330C.8080602@pointsman.de> (raw)
In-Reply-To: <3f8u3vhhvl.fsf@fencepost.gnu.org>

Am 01/11/2016 11:27 PM, Glenn Morris wrote:
> 
> Gosh, that's rather a long bug report. :)

Sorry. Unfortunately I feel a bit uncomfortable to express myself in
English; I'm afraid I can't make my point clear enough.

But you're right. Being longish doesn't help either.

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

Yes, I know, I even mentioned that in the bug report, somewhere within
the endless words ...

I probably should have written better "Some Hooks doesn't run ...".
But that would have been an even longer title ...

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

There's an explanation for why it behaves as it does, I'm sure. My
main point is it shouldn't behave this way. I think, your "that's the
real issue here" does this say, too, right?







  reply	other threads:[~2016-01-11 22:56 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
2016-01-11 22:56   ` Rolf Ade [this message]
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=5694330C.8080602@pointsman.de \
    --to=rolf@pointsman.de \
    --cc=22348@debbugs.gnu.org \
    --cc=rgm@gnu.org \
    /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.