GNU bug report logs -
#23444
25.0.92; activate-mark-hook does not run after a command has changed the region
Previous Next
Reported by: Nicolas Richard <youngfrog <at> members.fsf.org>
Date: Wed, 4 May 2016 12:06:02 UTC
Severity: normal
Tags: fixed, moreinfo
Found in version 25.0.92
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 23444 <at> debbugs.gnu.org (full text, mbox):
Nicolas Richard <youngfrog <at> members.fsf.org> writes:
>> It is also run at the end of a command, if the mark is active and
>> it is possible that the region may have changed.
>
> However, when changing the region, nothing happens. As an example I
> tried evaluating:
>
> (defun foo ()
> (message "ran: %s" this-command))
> (add-hook 'activate-mark-hook 'foo)
>
> then using C-M-SPC (mark-sexp) correctly showed "ran: mark-sexp", but
> moving the cursor afterwards doesn't produce any more message.
Indeed, and the manual even has this bit, added in 2012:
@defvar activate-mark-hook
@defvarx deactivate-mark-hook
These normal hooks are run, respectively, when the mark becomes active
and when it becomes inactive. The hook @code{activate-mark-hook} is
also run at the end of the command loop if the mark is active and it
is possible that the region may have changed.
@ignore
This piece of command_loop_1, run unless deactivating the mark:
if (current_buffer != prev_buffer || MODIFF != prev_modiff)
{
Lisp_Object hook = intern ("activate-mark-hook");
Frun_hooks (1, &hook);
}
@end ignore
And that code snippet, which is (surprisingly enough), still in Emacs
today, pretty much contradicts what the manual says in the visible text?
That is, the hook is only run if the command changes the buffer, which
then reactivates the mark. And I can confirm that that's how it's
actually working: If you mark a region in a buffer, switch to a
different buffer, and then back again, the hook is run (after the region
has been activated again).
And that makes sense to me, I think? Does anybody know whether this is
how it's supposed to work? If so, the fix would be to alter the
documentation.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 4 years and 108 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.