* bug#25992: perform-replace leaves mark-active when not transient-mark-mode
2017-03-06 2:02 bug#25992: perform-replace leaves mark-active when not transient-mark-mode Keith David Bershatsky
@ 2017-03-06 16:26 ` Eli Zaretskii
2017-03-06 17:06 ` Keith David Bershatsky
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2017-03-06 16:26 UTC (permalink / raw)
To: Keith David Bershatsky; +Cc: 25992
> Date: Sun, 05 Mar 2017 18:02:23 -0800
> From: Keith David Bershatsky <esq@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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#25992: perform-replace leaves mark-active when not transient-mark-mode
2017-03-06 2:02 bug#25992: perform-replace leaves mark-active when not transient-mark-mode Keith David Bershatsky
2017-03-06 16:26 ` Eli Zaretskii
@ 2017-03-06 17:06 ` Keith David Bershatsky
2017-03-06 18:45 ` Eli Zaretskii
2017-03-07 5:55 ` Keith David Bershatsky
2017-03-07 17:32 ` Keith David Bershatsky
3 siblings, 1 reply; 8+ messages in thread
From: Keith David Bershatsky @ 2017-03-06 17:06 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 25992
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@gnu.org>
>
> transient-mark-mode
>
> > Date: Sun, 05 Mar 2017 18:02:23 -0800
> > From: Keith David Bershatsky <esq@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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#25992: perform-replace leaves mark-active when not transient-mark-mode
2017-03-06 17:06 ` Keith David Bershatsky
@ 2017-03-06 18:45 ` Eli Zaretskii
0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2017-03-06 18:45 UTC (permalink / raw)
To: Keith David Bershatsky; +Cc: 25992
> Date: Mon, 06 Mar 2017 09:06:56 -0800
> From: Keith David Bershatsky <esq@lawlist.com>
> Cc: 25992@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?
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#25992: perform-replace leaves mark-active when not transient-mark-mode
2017-03-06 2:02 bug#25992: perform-replace leaves mark-active when not transient-mark-mode Keith David Bershatsky
2017-03-06 16:26 ` Eli Zaretskii
2017-03-06 17:06 ` Keith David Bershatsky
@ 2017-03-07 5:55 ` Keith David Bershatsky
2017-03-07 15:37 ` Eli Zaretskii
2017-03-07 17:32 ` Keith David Bershatsky
3 siblings, 1 reply; 8+ messages in thread
From: Keith David Bershatsky @ 2017-03-07 5:55 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 25992
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@gnu.org>
>
> transient-mark-mode
>
> > Date: Mon, 06 Mar 2017 09:06:56 -0800
> > From: Keith David Bershatsky <esq@lawlist.com>
> > Cc: 25992@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?
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#25992: perform-replace leaves mark-active when not transient-mark-mode
2017-03-07 5:55 ` Keith David Bershatsky
@ 2017-03-07 15:37 ` Eli Zaretskii
0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2017-03-07 15:37 UTC (permalink / raw)
To: Keith David Bershatsky; +Cc: 25992
> Date: Mon, 06 Mar 2017 21:55:47 -0800
> From: Keith David Bershatsky <esq@lawlist.com>
> Cc: 25992@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?
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#25992: perform-replace leaves mark-active when not transient-mark-mode
2017-03-06 2:02 bug#25992: perform-replace leaves mark-active when not transient-mark-mode Keith David Bershatsky
` (2 preceding siblings ...)
2017-03-07 5:55 ` Keith David Bershatsky
@ 2017-03-07 17:32 ` Keith David Bershatsky
2017-03-07 19:25 ` Eli Zaretskii
3 siblings, 1 reply; 8+ messages in thread
From: Keith David Bershatsky @ 2017-03-07 17:32 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 25992
Yes, thank you, please close out bug#25992.
Keith
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DATE: Tue, 07 Mar 2017 17:37:17 +0200
FROM: Eli Zaretskii <eliz@gnu.org>
>
> transient-mark-mode
>
> > Date: Mon, 06 Mar 2017 21:55:47 -0800
> > From: Keith David Bershatsky <esq@lawlist.com>
> > Cc: 25992@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?
^ permalink raw reply [flat|nested] 8+ messages in thread