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: Fri, 22 Jul 2016 13:19:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

On Fri, 22 Jul 2016 12:31:33 +0300 Eli Zaretskii <eliz@gnu.org> wrote:

>> > I'm fine with pushing to master if no one objects to this particular
>> > solution.
>> 
>> Why not emacs-25, given that the behavior is a regression from 24.5 (and
>> of course assuming the fix doesn't break anything else)?
>
> Because a workaround exists, 

You mean just repeating a motion command instead of using a numeric
prefix?

>                              and because we cannot assume it doesn't
> break anything else without prolonging the pretest.

Thanks for your healthy scepticism here; I checked again and indeed the
patch changes the behavior in rectangle-mark-mode when attempting to
move past bol or eol.  The patch tries to rectify this and according to
my tests, it works with a numeric prefix argument but behaves the same
as the current version when attempting to move past bol or eol.

If you think this corrected patch should still not go into emacs-25,
perhaps there should be a note in PROBLEMS, since motion commands in
general accept a numeric prefix and someone who successfully used
rectangle-mark-mode that way in 24.5 will naturally assume it works in
25.1 and be surprised when Emacs hangs.

Steve Berman

diff --git a/lisp/rect.el b/lisp/rect.el
index fb85b18..bb01b98 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -653,6 +653,12 @@ rectangle--*-char
                   (end-of-buffer (+ col (1+ n)))
                   (beginning-of-buffer (- curcol 1))))
                (diff (abs (- nextcol col))))
+         ;; Move to the correct column when selecting a rectangular
+         ;; region by passing a numeric prefix argument to a motion
+         ;; command, but stop at bol in any case.
+         (if (wholenump nextcol)
+             (move-to-column nextcol)
+           (goto-char bol))
           (cond
            ((and (< nextcol curcol) (< curcol col))
             (let ((curdiff (- col curcol)))





reply via email to

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