GNU bug report logs - #25992
perform-replace leaves mark-active when not transient-mark-mode

Previous Next

Package: emacs;

Reported by: Keith David Bershatsky <esq <at> lawlist.com>

Date: Mon, 6 Mar 2017 02:03:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.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 25992 in the body.
You can then email your comments to 25992 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25992; Package emacs. (Mon, 06 Mar 2017 02:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Keith David Bershatsky <esq <at> lawlist.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 06 Mar 2017 02:03:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: bug-gnu-emacs <at> gnu.org
Subject: perform-replace leaves mark-active when not transient-mark-mode
Date: Sun, 05 Mar 2017 18:02:23 -0800
When transient-mark-mode is turned off, perform-replace leaves mark-active set to `t`.

Step 1:  Launch emacs -q

Step 2:  Turn off transient-mark-mode.  (transient-mark-mode -1)

Step 3:  Evaluate mark-active and verify it is `nil`.

Step 4:  Run a simple perform-replace such as:  (replace-regexp ";" "@" nil 1 2)

Step 5:  Evaluate mark-active and see that it is now set `t`.

The desired behavior is to leave `mark-active` set to `nil` if it was previously set to `nil`.

I fixed this in my own setup with a very simple test at the outset of perform-replace to see whether mark-active was set to `t` at the outset and then turn it off at the end of the function if it was not previously active.

Thanks,

Keith




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25992; Package emacs. (Mon, 06 Mar 2017 16:28:01 GMT) Full text and rfc822 format available.

Message #8 received at 25992 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 25992 <at> debbugs.gnu.org
Subject: Re: bug#25992: perform-replace leaves mark-active when not
 transient-mark-mode
Date: Mon, 06 Mar 2017 18:26:53 +0200
> Date: Sun, 05 Mar 2017 18:02:23 -0800
> From: Keith David Bershatsky <esq <at> lawlist.com>
> 
> When transient-mark-mode is turned off, perform-replace leaves mark-active set to `t`.
> 
> Step 1:  Launch emacs -q
> 
> Step 2:  Turn off transient-mark-mode.  (transient-mark-mode -1)
> 
> Step 3:  Evaluate mark-active and verify it is `nil`.
> 
> Step 4:  Run a simple perform-replace such as:  (replace-regexp ";" "@" nil 1 2)
> 
> Step 5:  Evaluate mark-active and see that it is now set `t`.
> 
> The desired behavior is to leave `mark-active` set to `nil` if it was previously set to `nil`.

I'm not sure why you worry about mark-active when transient-mark-mode
is off: AFAIK that flag is only meaningful when transient-mark-mode is
on.  Can you describe your use case?

Anyway, the reason for activating the mark is that replace-regexp
calls push-mark, which always activates the mark when
transient-mark-mode is turned off.  Not sure why we do that, but the
code which does that has been doing it for the last 24 years, so I
don't think we should change that now, unless we have a _very_ good
reason.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25992; Package emacs. (Mon, 06 Mar 2017 17:08:02 GMT) Full text and rfc822 format available.

Message #11 received at 25992 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 25992 <at> debbugs.gnu.org
Subject: Re: bug#25992: perform-replace leaves mark-active when
 not	transient-mark-mode
Date: Mon, 06 Mar 2017 09:06:56 -0800
Thank you for taking a look at issue #25992.

In a custom test to determine whether the region is active, I had been testing mark-active prior to using (region-beginning) and/or (region-end) to avoid trowing an error "The mark is not set now, so there is no region".  When the following is true `(and mark-active (= (region-beginning) (region-end)))`, my custom function should return nil.

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DATE:  Mon, 06 Mar 2017 18:26:53 +0200
FROM:  Eli Zaretskii <eliz <at> gnu.org>
> 
>  transient-mark-mode
> 
> > Date: Sun, 05 Mar 2017 18:02:23 -0800
> > From: Keith David Bershatsky <esq <at> lawlist.com>
> > 
> > When transient-mark-mode is turned off, perform-replace leaves mark-active set to `t`.
> > 
> > Step 1:  Launch emacs -q
> > 
> > Step 2:  Turn off transient-mark-mode.  (transient-mark-mode -1)
> > 
> > Step 3:  Evaluate mark-active and verify it is `nil`.
> > 
> > Step 4:  Run a simple perform-replace such as:  (replace-regexp ";" "@" nil 1 2)
> > 
> > Step 5:  Evaluate mark-active and see that it is now set `t`.
> > 
> > The desired behavior is to leave `mark-active` set to `nil` if it was previously set to `nil`.
> 
> I'm not sure why you worry about mark-active when transient-mark-mode
> is off: AFAIK that flag is only meaningful when transient-mark-mode is
> on.  Can you describe your use case?
> 
> Anyway, the reason for activating the mark is that replace-regexp
> calls push-mark, which always activates the mark when
> transient-mark-mode is turned off.  Not sure why we do that, but the
> code which does that has been doing it for the last 24 years, so I
> don't think we should change that now, unless we have a _very_ good
> reason.
> 
> Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25992; Package emacs. (Mon, 06 Mar 2017 18:46:02 GMT) Full text and rfc822 format available.

Message #14 received at 25992 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 25992 <at> debbugs.gnu.org
Subject: Re: bug#25992: perform-replace leaves mark-active when
 not	transient-mark-mode
Date: Mon, 06 Mar 2017 20:45:32 +0200
> Date:  Mon, 06 Mar 2017 09:06:56 -0800
> From:  Keith David Bershatsky <esq <at> lawlist.com>
> Cc:  25992 <at> debbugs.gnu.org
> 
> In a custom test to determine whether the region is active, I had been testing mark-active prior to using (region-beginning) and/or (region-end) to avoid trowing an error "The mark is not set now, so there is no region".  When the following is true `(and mark-active (= (region-beginning) (region-end)))`, my custom function should return nil.

Why can't you just check whether the function 'mark' returns nil?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25992; Package emacs. (Tue, 07 Mar 2017 05:56:02 GMT) Full text and rfc822 format available.

Message #17 received at 25992 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 25992 <at> debbugs.gnu.org
Subject: Re: bug#25992: perform-replace leaves mark-active when
 not	transient-mark-mode
Date: Mon, 06 Mar 2017 21:55:47 -0800
Thank you very much for the suggestion to check 'mark' prior to calling either 'region-beginning' or 'region-end', as an alternative to testing the variable 'mark-active'.

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DATE:  Mon, 06 Mar 2017 20:45:32 +0200
FROM:  Eli Zaretskii <eliz <at> gnu.org>
> 
>  transient-mark-mode
> 
> > Date:  Mon, 06 Mar 2017 09:06:56 -0800
> > From:  Keith David Bershatsky <esq <at> lawlist.com>
> > Cc:  25992 <at> debbugs.gnu.org
> > 
> > In a custom test to determine whether the region is active, I had been testing mark-active prior to using (region-beginning) and/or (region-end) to avoid trowing an error "The mark is not set now, so there is no region".  When the following is true `(and mark-active (= (region-beginning) (region-end)))`, my custom function should return nil.
> 
> Why can't you just check whether the function 'mark' returns nil?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25992; Package emacs. (Tue, 07 Mar 2017 15:38:01 GMT) Full text and rfc822 format available.

Message #20 received at 25992 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 25992 <at> debbugs.gnu.org
Subject: Re: bug#25992: perform-replace leaves mark-active when
 not	transient-mark-mode
Date: Tue, 07 Mar 2017 17:37:17 +0200
> Date:  Mon, 06 Mar 2017 21:55:47 -0800
> From:  Keith David Bershatsky <esq <at> lawlist.com>
> Cc:  25992 <at> debbugs.gnu.org
> 
> Thank you very much for the suggestion to check 'mark' prior to calling either 'region-beginning' or 'region-end', as an alternative to testing the variable 'mark-active'.

So can this bug be closed now?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25992; Package emacs. (Tue, 07 Mar 2017 17:34:02 GMT) Full text and rfc822 format available.

Message #23 received at 25992 <at> debbugs.gnu.org (full text, mbox):

From: Keith David Bershatsky <esq <at> lawlist.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 25992 <at> debbugs.gnu.org
Subject: Re: bug#25992: perform-replace leaves mark-active when
 not	transient-mark-mode
Date: Tue, 07 Mar 2017 09:32:58 -0800
Yes, thank you, please close out bug#25992.

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DATE:  Tue, 07 Mar 2017 17:37:17 +0200
FROM:  Eli Zaretskii <eliz <at> gnu.org>
> 
>  transient-mark-mode
> 
> > Date:  Mon, 06 Mar 2017 21:55:47 -0800
> > From:  Keith David Bershatsky <esq <at> lawlist.com>
> > Cc:  25992 <at> debbugs.gnu.org
> > 
> > Thank you very much for the suggestion to check 'mark' prior to calling either 'region-beginning' or 'region-end', as an alternative to testing the variable 'mark-active'.
> 
> So can this bug be closed now?




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Tue, 07 Mar 2017 19:27:02 GMT) Full text and rfc822 format available.

Notification sent to Keith David Bershatsky <esq <at> lawlist.com>:
bug acknowledged by developer. (Tue, 07 Mar 2017 19:27:02 GMT) Full text and rfc822 format available.

Message #28 received at 25992-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Keith David Bershatsky <esq <at> lawlist.com>
Cc: 25992-done <at> debbugs.gnu.org
Subject: Re: bug#25992: perform-replace leaves mark-active when
 not	transient-mark-mode
Date: Tue, 07 Mar 2017 21:25:55 +0200
> Date:  Tue, 07 Mar 2017 09:32:58 -0800
> From:  Keith David Bershatsky <esq <at> lawlist.com>
> Cc:  25992 <at> debbugs.gnu.org
> 
> Yes, thank you, please close out bug#25992.

Done.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 05 Apr 2017 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 170 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.