summaryrefslogtreecommitdiff
path: root/lisp/sort.el
diff options
context:
space:
mode:
authorStephen Berman <stephen.berman@gmx.net>2016-07-14 09:55:28 +0200
committerStephen Berman <stephen.berman@gmx.net>2016-07-14 09:55:28 +0200
commita8e1414c0d66903884059361ecc8ec70da37cf35 (patch)
tree3059a9fad37c8db10427eac9aff69c461a58bd05 /lisp/sort.el
parentff0ec6fd4d4779322aefa58df7329e47eb74bf72 (diff)
downloademacs-a8e1414c0d66903884059361ecc8ec70da37cf35.tar.gz
Fix delete-duplicate-lines
* lisp/sort.el (delete-duplicate-lines): Delete duplicate first line when operating backward (bug#23863).
Diffstat (limited to 'lisp/sort.el')
-rw-r--r--lisp/sort.el5
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/sort.el b/lisp/sort.el
index 4d7311f1e51..8bc71388ad5 100644
--- a/lisp/sort.el
+++ b/lisp/sort.el
@@ -596,7 +596,7 @@ is non-nil, it also prints a message describing the number of deletions."
(equal current-prefix-arg '(64))
t)))
(let ((lines (unless adjacent (make-hash-table :test 'equal)))
- line prev-line
+ line prev-line first-line
(count 0)
(beg (copy-marker beg))
(end (copy-marker end)))
@@ -604,8 +604,9 @@ is non-nil, it also prints a message describing the number of deletions."
(goto-char (if reverse end beg))
(if (and reverse (bolp)) (forward-char -1))
(while (if reverse
- (and (> (point) beg) (not (bobp)))
+ (not first-line)
(and (< (point) end) (not (eobp))))
+ (setq first-line (and reverse (or (<= (point) beg) (bobp))))
(setq line (buffer-substring-no-properties
(line-beginning-position) (line-end-position)))
(if (and keep-blanks (string= "" line))