From: Lars Ingebrigtsen Date: Tue, 3 May 2022 19:23:40 +0000 (+0200) Subject: Make sorting not change buffer modification status always X-Git-Tag: emacs-29.0.90~1931^2~93 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5206596ea7b26e2e9705e4c94184f6d22687c385;p=emacs.git 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). --- diff --git a/lisp/sort.el b/lisp/sort.el index 90eee01caf4..d04f075abd1 100644 --- a/lisp/sort.el +++ b/lisp/sort.el @@ -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)