Subject: Re: bug#62892: proposal to extend mark-sexp to go forward and backward on command

From: Eli Zaretskii <[email-masked]>
Date: Wed, 31 May 2023 15:01:39 +0300

> From: Zachary Kanfer <[email-masked]>
> Date: Tue, 30 May 2023 23:23:13 -0400
> Cc: [email-masked], [email-masked], [email-masked], 
> 	[email-masked], [email-masked], [email-masked]
> 
> This is interesting. Let me see if I'm understanding properly. In this, I'll talk only about sexps, but I
> believe this argument should apply to all the forms we've talked about (word, sexp, paragraph, defun,
> page). These commands should:
> 
> 1. Always move forward/back by ARG sexps (defaulting to 1), setting the region on all sexps it moves
> across.
> 
> I'm in agreement with #1, for sure. That is the basis for what I wanted initially.
> 
> 2. Ignore whether transient-mark-mode is enabled.
> 3. Don't change behavior if the region is active or not.
> 
> #2 and #3 I believe can be considered together. There are a few things that could do this, but I think
> what you're saying is that this function should *only* move mark.That is, point should stay the same no
> matter what is called here. Additionally, it should activate mark. Is that what you meant?

No, it should only move point, not the mark.  The mark should stay
where point was before invoking the command.

Whether it should activate the mark is open to discussion.  One
possibility is that the command will work like shift-select commands.
Another possibility is that it should activate the mark only if
transient-mark-mode is turned ON, like other commands that push the
mark.

> My understanding was that #'use-region-p (which checks transient-mark-mode, and whether the region
> is active) is a standard way for determining whether to act on the region or not, and should generally
> be looked at before acting on the region. Is that not accurate?

This is correct, but only for commands that do something with the text
in the region: limit search/replace to it, or spell-check the text in
it, etc.  mark-sexp doesn't do anything like that, it actually
_modifies_ the region.  So the fact that it changes its effect
depending on whether the region is active is IMO pretty confusing and
unexpected.