Subject: Re: bug#41934: reverse-region no longer works

From: Eli Zaretskii <[email-masked]>
Date: Thu, 18 Jun 2020 20:42:28 +0300

> From: Richard Copley <[email-masked]>
> Date: Thu, 18 Jun 2020 17:41:19 +0100
> 
> Insert text in a buffer:
> 
> abc
> def
> ghi
> 
> Position the mark before the 'a' and point before the 'g'.
> Do 'M-x reverse-region'.
> 
> An error is signalled, 'There are no full lines in the region'.

Thanks.  Does the patch below look good?

diff --git a/lisp/sort.el b/lisp/sort.el
index de0e1b9..6640c8f 100644
--- a/lisp/sort.el
+++ b/lisp/sort.el
@@ -554,8 +554,8 @@ reverse-region
   (if (> beg end)
       (let (mid) (setq mid end end beg beg mid)))
   (save-excursion
-    (when (or (< (line-beginning-position) beg)
-              (< end (line-end-position)))
+    (when (< (- end beg)
+             (- (line-end-position) (line-beginning-position)))
       (user-error "There are no full lines in the region"))
     ;; Put beg at the start of a line and end and the end of one --
     ;; the largest possible region which fits this criteria.