GNU bug report logs - #23999
25.0.95; Emacs hangs in rectangle-mark-mode with numeric prefix argument to `C-f'

Previous Next

Package: emacs;

Reported by: nljlistbox2 <at> gmail.com (N. Jackson)

Date: Fri, 15 Jul 2016 22:27:01 UTC

Severity: normal

Found in version 25.0.95

Done: charles <at> aurox.ch (Charles A. Roelli)

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stephen Berman <stephen.berman <at> gmx.net>
To: nljlistbox2 <at> gmail.com (N. Jackson)
Cc: 23999 <at> debbugs.gnu.org
Subject: bug#23999: 25.0.95; Emacs hangs in rectangle-mark-mode with numeric prefix argument to `C-f'
Date: Sat, 16 Jul 2016 12:24:41 +0200
On Fri, 15 Jul 2016 19:25:52 -0300 nljlistbox2 <at> gmail.com (N. Jackson) wrote:

> emacs -Q
> C-<home>	; Go to top left corner of scratch buffer.
> C-x <SPC>	; Start a rectangular selection.
> C-3 C-f		; Extend the selection to the right by 3 characters.
>
> Expected result:  Emacs creates a rectangular selection one character
> high and three characters wide.
>
> Actual result:  Emacs hangs. (C-g quits.)
>
> With debug-on-quit on, I then get:
>
>     Debugger entered--Lisp error: (quit)
>       rectangle--*-char(forward-char 3 backward-char)
>       rectangle-forward-char(3)
>       funcall-interactively(rectangle-forward-char 3)
>       call-interactively(rectangle-forward-char nil nil)
>       command-execute(rectangle-forward-char)
>
> On the other hand, the following recipe works as expected:
>
> emacs -Q
> C-<home>	; Go to top left corner of scratch buffer.
> C-x <SPC>	; Start a rectangular selection.
> C-f C-f C-f	; Extend the selection to the right by 3 characters.
>
> Note 1:  The exact position in the scratch buffer seems to be unimportant.
>
> Note 2:  `C-n' with a numeric prefix argument seems to work fine to extend
> the rectangular region downwards.
>
> Note 3: I see this with the Emacs 25.0.95 pre-test tarball [and with the
> 25.0.90 pre-test for that matter]. The problem is still present in the
> Emacs 25 branch as of earlier this afternoon. I do not see the problem
> with Emacs 24.5.

This is due to using save-excursion in rectangle--*-char.  Replacing
that with progn makes it work with a numeric prefix argument AFAICT, and
I have not seen any resulting problems, but maybe Stefan Monnier, who
made the changes in commit 7e74ad0 that caused this regression, had a
particular case in mind that the save-excursion was intended to deal
with.  If not, I think this change should go into emacs-25 (since it is
a regression from 24.5).

diff --git a/lisp/rect.el b/lisp/rect.el
index 43621d9..9dd5db4 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -644,7 +644,7 @@ rectangle--*-char
                (curcol (current-column))
                (nextcol
                 (condition-case nil
-                    (save-excursion
+                    (progn
                       (funcall cmd 1)
                       (cond
                        ((> bol (point)) (- curcol 1))

Steve Berman




This bug report was last modified 7 years and 155 days ago.

Previous Next


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