bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23999: 25.0.95; Emacs hangs in rectangle-mark-mode with numeric pref


From: Stephen Berman
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

On Fri, 15 Jul 2016 19:25:52 -0300 nljlistbox2@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]