Make sorting not change buffer modification status always

* lisp/sort.el (sort-subr): Don't mark buffer modified if the
sorting didn't change anything (bug#4587).
This commit is contained in:
Lars Ingebrigtsen 2022-05-03 21:23:40 +02:00
parent 59353ec7b5
commit 5206596ea7

View file

@ -29,6 +29,8 @@
;;; Code:
(eval-when-compile (require 'subr-x))
(defgroup sort nil
"Commands to sort text in an Emacs buffer."
:group 'data)
@ -111,7 +113,8 @@ as start and end positions), and with `string<' otherwise."
(lambda (a b) (string< (car a) (car b)))))))
(if reverse (setq sort-lists (nreverse sort-lists)))
(if messages (message "Reordering buffer..."))
(sort-reorder-buffer sort-lists old)))
(with-buffer-unmodified-if-unchanged
(sort-reorder-buffer sort-lists old))))
(if messages (message "Reordering buffer... Done"))))
nil)