X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/ac5475dacb20d240db27d56199910d8a6fcc90e8..a8e1414c0d66903884059361ecc8ec70da37cf35:/lisp/sort.el diff --git a/lisp/sort.el b/lisp/sort.el index 9b8cec6ac6..8bc71388ad 100644 --- a/lisp/sort.el +++ b/lisp/sort.el @@ -1,6 +1,6 @@ ;;; sort.el --- commands to sort text in an Emacs buffer -;; Copyright (C) 1986-1987, 1994-1995, 2001-2015 Free Software +;; Copyright (C) 1986-1987, 1994-1995, 2001-2016 Free Software ;; Foundation, Inc. ;; Author: Howie Kaye @@ -316,7 +316,7 @@ FIELD, BEG and END. BEG and END specify region to sort." ;; (point) ;; (save-excursion ;; (re-search-forward -;; "[+-]?[0-9]*\.?[0-9]*\\([eE][+-]?[0-9]+\\)?") +;; "[+-]?[0-9]*\\.?[0-9]*\\([eE][+-]?[0-9]+\\)?") ;; (point)))))) ;; nil)) @@ -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))