Subject: Re: bug#42663: 28.0.50; rectangle-mark-mode does not behave as documented when transient-mark-mode is off

From: Sean Whitton <[email-masked]>
Date: Fri, 24 Dec 2021 14:41:51 -0700

control: tag -1 + patch - moreinfo

Hello,

On Sun 02 Aug 2020 at 05:12PM +03, Eli Zaretskii wrote:

> I'm not sure the current behavior you described is a bug.  You seem to
> be so confident it is that you haven't even provide an explanation why
> you think so, and a naïve reading of the doc string doesn't make that
> obvious (e.g., "if needed" could cover item 1).  In general, when
> transient-mark-mode is off, Emacs behaves differently than when it's
> on, and that's by design.
>
> So could you please provide a more detailed explanation why you think
> these are bugs?

Apologies, it was not my intention to suggest that I'm sure the
behaviour should change.  I reported a bug because I found what seemed
like inconsistencies between the documentation and the behaviour of the
command.  From my point of view, improving the documentation without
changing the behaviour of the command would resolve the issue.

Thus, I'm attaching a documentation patch.  Hope it can be installed.

-- 
Sean Whitton
>From cf87b92aef2013b1d5a72a980f1f958f00222775 Mon Sep 17 00:00:00 2001
From: Sean Whitton <[email-masked]>
Date: Fri, 24 Dec 2021 14:31:35 -0700
Subject: [PATCH] Improve rectangle-mark-mode documentation regarding mark
 activation

* doc/emacs/killing.texi:
* lisp/rect.el (rectangle-mark-mode): State that rectangle-mark-mode
does not activate the mark when Transient Mark mode is off.  State
that the mode persists until the next time the region becomes
inactive; if rectangle-mark-mode does not activate the mark, then the
mode persists until the region is both activated and subsequently
deactivated.  Qualify discussion of rectangle-exchange-point-and-mark
to say that it cycles the four corners only when the region is active.
---
 doc/emacs/killing.texi | 20 ++++++++++----------
 lisp/rect.el           |  3 ++-
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi
index 375ac970d7..f6458e8c8b 100644
--- a/doc/emacs/killing.texi
+++ b/doc/emacs/killing.texi
@@ -923,11 +923,11 @@ Rectangles
 @findex rectangle-mark-mode
   The command @kbd{C-x @key{SPC}} (@code{rectangle-mark-mode}) toggles
 whether the region-rectangle or the standard region is highlighted
-(first activating the region if necessary).  When this mode is enabled,
-commands that resize the region (@kbd{C-f}, @kbd{C-n} etc.)@: do
-so in a rectangular fashion, and killing and yanking operate on the
-rectangle.  @xref{Killing}.  The mode persists only as long as the
-region is active.
+(first activating the region if necessary, unless Transient Mark mode
+is off).  When this mode is enabled, commands that resize the region
+(@kbd{C-f}, @kbd{C-n} etc.)@: do so in a rectangular fashion, and
+killing and yanking operate on the rectangle.  @xref{Killing}.  The
+mode persists until the next time the region becomes inactive.
 
 Unlike the standard region, the region-rectangle can have its corners
 extended past the end of buffer, or inside stretches of white space
@@ -937,11 +937,11 @@ Rectangles
 @findex rectangle-exchange-point-and-mark
 @findex exchange-point-and-mark@r{, in rectangle-mark-mode}
 @kindex C-x C-x@r{, in rectangle-mark-mode}
-When the region is in rectangle-mark-mode, @kbd{C-x C-x} runs the
-command @code{rectangle-exchange-point-and-mark}, which cycles between
-the four corners of the region-rectangle.  This comes in handy if you
-want to modify the dimensions of the region-rectangle before invoking
-an operation on the marked text.
+When the region is active and in rectangle-mark-mode, @kbd{C-x C-x}
+runs the command @code{rectangle-exchange-point-and-mark}, which
+cycles between the four corners of the region-rectangle.  This comes
+in handy if you want to modify the dimensions of the region-rectangle
+before invoking an operation on the marked text.
 
 @node CUA Bindings
 @section CUA Bindings
diff --git a/lisp/rect.el b/lisp/rect.el
index d288adfbaf..80f992e182 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -651,7 +651,8 @@ rectangle-mark-mode-map
 (define-minor-mode rectangle-mark-mode
   "Toggle the region as rectangular.
 
-Activates the region if needed.  Only lasts until the region is deactivated."
+Activates the region if it's inactive and Transient Mark mode is
+on.  Only lasts until the region is next deactivated."
   :lighter nil
   (rectangle--reset-crutches)
   (when rectangle-mark-mode
-- 
2.30.2