GNU bug report logs - #77973
30.1; `which-key' breaks `string-rectangle' after popup shown

Previous Next

Package: emacs;

Reported by: Alcor <alcor <at> tilde.club>

Date: Mon, 21 Apr 2025 20:01:02 UTC

Severity: normal

Found in version 30.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alcor <alcor <at> tilde.club>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 77973 <at> debbugs.gnu.org
Subject: bug#77973: 30.1; `which-key' breaks `string-rectangle' after popup shown
Date: Tue, 22 Apr 2025 21:46:57 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> I've now returned the Subject to its original.

Thanks Eli, I'm still not very familiar with the bug tracking system -
will keep that in mind.

That aside, I would like to note that the commit:

  3a8222e700304e4dff84fcdfa8ff2a4e48646c82
  Faster region-beginning and region-end for rectangle selections

Solves the issue. The actual underlying problem was the fact that the

  ; rectangle--region-beginning
  ...
  (apply #'min (mapcar #'car (region-bounds)))

  ; rectangle--region-end
  ...
  (apply #'max (mapcar #'cdr (region-bounds)))

forms in the 30.x implementations of rectangle--region-{beginning,end}
may result in a mutual recursion, as `region-bounds' calls
`region-extract-function', which calls `region-{beginning,end}' (both
advised by `rectangle--region-{beginning,end}' during a rectangular
selection).

I'm not sure why `which-key-mode' triggers this, but it seems it's
related to the `rectangle-mark-mode' state, as replacing the above forms
in `region-{beginning,end}' with:

  ; rectangle--region-beginning
  ...
  (let (rectangle-mark-mode) (apply #'min (mapcar #'car (region-bounds))))

  ; rectangle--region-end
  ...
  (let (rectangle-mark-mode) (apply #'max (mapcar #'cdr (region-bounds))))

As done in many other places in rect.el fixes the issue on 30.x -
however, I've also tried backporting
3a8222e700304e4dff84fcdfa8ff2a4e48646c82 onto 30.1 and it worked without
any issues, on top of it being faster as well.

Would it be possible to cherry-pick 3a8222e onto the emacs-30 branch so
a fix is available on 30.2? IMO, this bug is annoyingly easy to trigger
on 30.1 when using `which-key-mode' (see video in previous message), and
it's not trivial to unbreak rectangle-mark-mode after running into it,
so having it in the next bugfix release would improve things
significantly.

Cheers,
-A.




This bug report was last modified 21 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.