GNU bug report logs -
#39376
[PATCH] Throw error when calling reverse-region on a single line
Previous Next
Reported by: Philip K <philip <at> warpmail.net>
Date: Fri, 31 Jan 2020 21:27:01 UTC
Severity: normal
Tags: patch
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39376 in the body.
You can then email your comments to 39376 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39376
; Package
emacs
.
(Fri, 31 Jan 2020 21:27:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Philip K <philip <at> warpmail.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 31 Jan 2020 21:27:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The current implementation of reverse region will delete everything
following the current line, if the region marks only a part of a
line. This is because the algorithm implemented below accidentally
deletes all following lines, and fails before being able to reinsert
them.
This patch sends an error (could be changed to an user-error) in that
case, as it makes no sense for a single line to be reversed.
---
lisp/sort.el | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lisp/sort.el b/lisp/sort.el
index 6ea1c44060..8848c5bf24 100644
--- a/lisp/sort.el
+++ b/lisp/sort.el
@@ -543,6 +543,8 @@ reverse-region
(if (> beg end)
(let (mid) (setq mid end end beg beg mid)))
(save-excursion
+ (when (< (line-beginning-position) beg end (line-end-position))
+ (error "Cannot reverse a single line"))
;; put beg at the start of a line and end and the end of one --
;; the largest possible region which fits this criteria
(goto-char beg)
--
2.20.1
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Sat, 15 Feb 2020 08:52:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Philip K <philip <at> warpmail.net>
:
bug acknowledged by developer.
(Sat, 15 Feb 2020 08:52:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 39376-done <at> debbugs.gnu.org (full text, mbox):
> From: Philip K <philip <at> warpmail.net>
> Date: Fri, 31 Jan 2020 22:26:24 +0100
>
> The current implementation of reverse region will delete everything
> following the current line, if the region marks only a part of a
> line. This is because the algorithm implemented below accidentally
> deletes all following lines, and fails before being able to reinsert
> them.
>
> This patch sends an error (could be changed to an user-error) in that
> case, as it makes no sense for a single line to be reversed.
Thanks. I installed a slightly different change, because the command
would still delete the following lines if only BEG or END (bit not
both) was not at a line beginning/end.
I also fixed the doc string and the comments there.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 14 Mar 2020 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 91 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.