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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23444 in the body.
You can then email your comments to 23444 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23444
; Package
emacs
.
(Wed, 04 May 2016 12:06:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Nicolas Richard <youngfrog <at> members.fsf.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 04 May 2016 12:06:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
activate-mark-hook contains the following in its docstring:
> 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.
FWIW this was mentionned in bug#902 (and then promptly forgotten, due to
the main topic being something else in that report).
(side note : in the git repo these docstrings were introduced in commit
0251bafb90e63cc7f428e1b91db436c32ad2677c authored by Richard Stallman.
In the lisp/ChangeLog.12 the author of those lines is said to be Chong
Yidong. I guess I will pretend I did not see this.)
In GNU Emacs 25.0.92.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2016-03-04 built on localhost
Repository revision: 620951fe22a6ecc2edc1f78d961f52566a7fe2b6
Windowing system distributor 'The X.Org Foundation', version 11.0.11604000
System Description: Gentoo Base System release 2.2
Configured using:
'configure --with-x-toolkit=lucid 'CFLAGS= ''
--
Nicolas Richard
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23444
; Package
emacs
.
(Wed, 04 May 2016 16:47:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 23444 <at> debbugs.gnu.org (full text, mbox):
> From: Nicolas Richard <youngfrog <at> members.fsf.org>
> Date: Wed, 04 May 2016 14:04:01 +0200
>
> (side note : in the git repo these docstrings were introduced in commit
> 0251bafb90e63cc7f428e1b91db436c32ad2677c authored by Richard Stallman.
> In the lisp/ChangeLog.12 the author of those lines is said to be Chong
> Yidong. I guess I will pretend I did not see this.)
You don't need to pretend. I'm quite sure Chong wrote the code and
Richard just committed the change, for some reason. CVS doesn't have
the equivalent of the --author switch to the 'commit' command, so you
will see a lot of similar cases in old commits. E.g., all of my
commits were done by Richard or others at first, until I got write
access several years later.
There's nothing funky here.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23444
; Package
emacs
.
(Sun, 07 Feb 2021 13:32:02 GMT)
Full text and
rfc822 format available.
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
Added tag(s) moreinfo.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 07 Feb 2021 13:32:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23444
; Package
emacs
.
(Sun, 07 Feb 2021 15:22:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 23444 <at> debbugs.gnu.org (full text, mbox):
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Sun, 07 Feb 2021 14:30:51 +0100
> Cc: 23444 <at> debbugs.gnu.org
>
> 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.
Yes, I think the manual actually intended to describe what the
implementation does, but failed to be accurate enough. So it needs to
be fixed.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23444
; Package
emacs
.
(Sun, 07 Feb 2021 21:03:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 23444 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> Yes, I think the manual actually intended to describe what the
> implementation does, but failed to be accurate enough. So it needs to
> be fixed.
I've now made an attempt in emacs-27.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) fixed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 07 Feb 2021 21:03:03 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 28.1, send any further explanations to
23444 <at> debbugs.gnu.org and Nicolas Richard <youngfrog <at> members.fsf.org>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 07 Feb 2021 21:03:03 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#23444
; Package
emacs
.
(Mon, 08 Feb 2021 06:46:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 23444 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/html, inline)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 08 Mar 2021 12:24:08 GMT)
Full text and
rfc822 format available.
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.