From: Lars Ingebrigtsen <larsi@gnus.org>
To: "Peter Münster" <pm@a16n.net>
Cc: 49999@debbugs.gnu.org
Subject: bug#49999: 27.2; save-mark-and-excursion does not save mark-active
Date: Wed, 11 Aug 2021 17:46:57 +0200 [thread overview]
Message-ID: <87y298oufi.fsf@gnus.org> (raw)
In-Reply-To: <87r1f0rx5s.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 11 Aug 2021 14:19:43 +0200")
Lars Ingebrigtsen <larsi@gnus.org> writes:
> I can reproduce this, but I'm not quite sure what's going on. I tweaked
> your function:
>
> (defun my-test-func ()
> "Test if save-mark-and-excursion is working."
> (interactive)
> (save-mark-and-excursion
> (goto-char (point-min))
> (add-face-text-property
> (point) (1+ (point)) (list :background "orange")))
> (message "%s" mark-active))
>
> This messages t -- but evaling mark-active afterwards shows that it's
> nil. So something is deactivating the mark after the command has run,
> apparently? Hm... this sounds vaguely familiar to me... Anybody know
> what could be going on here?
Oh, right -- it's transient mark mode that does this stuff? That is, if
you run a command that inserts something in the buffer, then it'll
switch the region off?
So `save-mark-and-excursion' works exactly as it should. But if you
don't want transient-mark-mode to switch itself off, you have to say
something like:
(defun my-test-func ()
"Test if save-mark-and-excursion is working."
(interactive)
(save-mark-and-excursion
(goto-char (point-min))
(with-silent-modifications
(add-face-text-property
(point) (1+ (point)) (list :background "orange")))))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2021-08-11 15:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-11 9:59 bug#49999: 27.2; save-mark-and-excursion does not save mark-active Peter Münster
2021-08-11 12:19 ` Lars Ingebrigtsen
2021-08-11 15:46 ` Lars Ingebrigtsen [this message]
2021-08-13 9:19 ` Peter Münster
2021-08-13 10:30 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y298oufi.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=49999@debbugs.gnu.org \
--cc=pm@a16n.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).