[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org aa789b89d7: Do not mark buffer as modified with org
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org aa789b89d7: Do not mark buffer as modified with org-preserve-local-variables |
Date: |
Tue, 14 Jun 2022 11:02:07 -0400 (EDT) |
branch: externals/org
commit aa789b89d7bfa1220ec72e0d9fd996584bdd69f4
Author: Ignacio Casso <ignaciocasso@hotmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
Do not mark buffer as modified with org-preserve-local-variables
* lisp/org-macs.el (org-preserve-local-variables): Do not mark buffer
as modified or alter `buffer-undo-list' when body does not actually
modify the buffer.
This commit fixes a bug with `org-copy-subtree', which marked the
buffer as modified and added an entry to the undo list when the visited
file had local variables.
---
lisp/org-macs.el | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 19e5f42e92..c34ff3ab7a 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -166,13 +166,19 @@
(and (re-search-backward "^[ \t]*# +Local Variables:"
(max (- (point) 3000) 1)
t)
- (delete-and-extract-region (point) (point-max)))))))
+ (let ((buffer-undo-list t))
+ (delete-and-extract-region (point) (point-max)))))))
+ (tick-counter-before (buffer-modified-tick)))
(unwind-protect (progn ,@body)
(when local-variables
(org-with-wide-buffer
(goto-char (point-max))
(unless (bolp) (insert "\n"))
- (insert local-variables))))))
+ (let ((modified (< tick-counter-before (buffer-modified-tick)))
+ (buffer-undo-list t))
+ (insert local-variables)
+ (unless modified
+ (restore-buffer-modified-p nil))))))))
(defmacro org-no-popups (&rest body)
"Suppress popup windows and evaluate BODY."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/org aa789b89d7: Do not mark buffer as modified with org-preserve-local-variables,
ELPA Syncer <=