[Top][All Lists]

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

bug#22348: 24.5; Mode hooks doesn't run as expected if the major mode of

From: Rolf Ade
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
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

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 via email to

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