all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#70384: [PATCH] 30.0.50; save-mark-and-excursion breaks with tmm disabled
@ 2024-04-14 15:52 Paul Nelson
  2024-04-18 11:04 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Nelson @ 2024-04-14 15:52 UTC (permalink / raw)
  To: 70384

[-- Attachment #1: Type: text/plain, Size: 278 bytes --]

Hello,

Steps to reproduce:

- Disable transient-mark-mode.
- Set the mark somewhere (C-SPC), move the point somewhere else.
- M-: (save-mark-and-excursion (activate-mark))

This activates the region, but should not.

Attaching a patch with the simple fix.

Thanks, best,

Paul

[-- Attachment #2: 0001-Fix-save-mark-and-excursion-with-tmm-disabled.patch --]
[-- Type: application/octet-stream, Size: 830 bytes --]

From 06b6f0a70eb7f59fe9a2a0d82697f509290993f0 Mon Sep 17 00:00:00 2001
From: Paul Nelson <ultrono@gmail.com>
Date: Sun, 14 Apr 2024 17:49:45 +0200
Subject: [PATCH] Fix save-mark-and-excursion with tmm disabled

* lisp/simple.el (save-mark-and-excursion--save):
Use (region-active-p) instead of mark-active.
---
 lisp/simple.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index 0645f18cc78..249fadae6a9 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -6981,7 +6981,7 @@ save-mark-and-excursion--save
   (cons
    (let ((mark (mark-marker)))
      (and (marker-position mark) (copy-marker mark)))
-   mark-active))
+   (region-active-p)))
 
 (defun save-mark-and-excursion--restore (saved-mark-info)
   (let ((saved-mark (car saved-mark-info))
-- 
2.39.3 (Apple Git-145)


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#70384: [PATCH] 30.0.50; save-mark-and-excursion breaks with tmm disabled
  2024-04-14 15:52 bug#70384: [PATCH] 30.0.50; save-mark-and-excursion breaks with tmm disabled Paul Nelson
@ 2024-04-18 11:04 ` Eli Zaretskii
  2024-04-18 13:26   ` Paul Nelson
  2024-04-18 13:55   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 5+ messages in thread
From: Eli Zaretskii @ 2024-04-18 11:04 UTC (permalink / raw)
  To: Paul Nelson, Stefan Monnier; +Cc: 70384

> From: Paul Nelson <ultrono@gmail.com>
> Date: Sun, 14 Apr 2024 17:52:42 +0200
> 
> Steps to reproduce:
> 
> - Disable transient-mark-mode.
> - Set the mark somewhere (C-SPC), move the point somewhere else.
> - M-: (save-mark-and-excursion (activate-mark))
> 
> This activates the region, but should not.

I'm not sure I agree with your expectations.  activate-mark activates
the mark unconditionally when transient-mark-mode is disabled, unless
you invoke it with a non-nil argument.  And indeed

   (save-mark-and-excursion (activate-mark t))

behaves like you expect.

Stefan, am I missing something?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#70384: [PATCH] 30.0.50; save-mark-and-excursion breaks with tmm disabled
  2024-04-18 11:04 ` Eli Zaretskii
@ 2024-04-18 13:26   ` Paul Nelson
  2024-04-18 13:55   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 5+ messages in thread
From: Paul Nelson @ 2024-04-18 13:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Monnier, 70384

My mistake, I think.  Thanks for looking into this.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#70384: [PATCH] 30.0.50; save-mark-and-excursion breaks with tmm disabled
  2024-04-18 11:04 ` Eli Zaretskii
  2024-04-18 13:26   ` Paul Nelson
@ 2024-04-18 13:55   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-18 14:20     ` Eli Zaretskii
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-04-18 13:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 70384, Paul Nelson

> I'm not sure I agree with your expectations.  activate-mark activates
> the mark unconditionally when transient-mark-mode is disabled, unless
> you invoke it with a non-nil argument.  And indeed
>
>    (save-mark-and-excursion (activate-mark t))
>
> behaves like you expect.
>
> Stefan, am I missing something?

It's all very messy with dark corners where the right answer is unclear,
yes.  That's one of the reasons why I extracted that mark-handling
functionality out of `save-excursion` in the first place. 🙂

IOW my opinion is: if you use `save-mark-and-excursion`, you get what
you deserve.


        Stefan






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#70384: [PATCH] 30.0.50; save-mark-and-excursion breaks with tmm disabled
  2024-04-18 13:55   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-04-18 14:20     ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2024-04-18 14:20 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 70384, ultrono

tags 70384 notabug wontfix
close 70384
thanks

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Paul Nelson <ultrono@gmail.com>,  70384@debbugs.gnu.org
> Date: Thu, 18 Apr 2024 09:55:56 -0400
> 
> > I'm not sure I agree with your expectations.  activate-mark activates
> > the mark unconditionally when transient-mark-mode is disabled, unless
> > you invoke it with a non-nil argument.  And indeed
> >
> >    (save-mark-and-excursion (activate-mark t))
> >
> > behaves like you expect.
> >
> > Stefan, am I missing something?
> 
> It's all very messy with dark corners where the right answer is unclear,
> yes.  That's one of the reasons why I extracted that mark-handling
> functionality out of `save-excursion` in the first place. 🙂
> 
> IOW my opinion is: if you use `save-mark-and-excursion`, you get what
> you deserve.

OK, thanks.  So I'm closing this non-bug as wontfix.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-18 14:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-14 15:52 bug#70384: [PATCH] 30.0.50; save-mark-and-excursion breaks with tmm disabled Paul Nelson
2024-04-18 11:04 ` Eli Zaretskii
2024-04-18 13:26   ` Paul Nelson
2024-04-18 13:55   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-18 14:20     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.