From 5206596ea7b26e2e9705e4c94184f6d22687c385 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 3 May 2022 21:23:40 +0200 Subject: [PATCH] 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). --- lisp/sort.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) -- 2.39.2