aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics <[email protected]>2007-05-17 08:42:29 +0000
committerMartin Rudalics <[email protected]>2007-05-17 08:42:29 +0000
commit10e3e762bf0c91e3dbbbbc18a72c7e4a57ea118b (patch)
tree4837f0b2670e10328c72ee40b8f6d2013ed2fdb0
parente92552706ed7987d6f75efa000e793f5ec0d7991 (diff)
(highlight-changes-rotate-faces): Don't set
modified flag of buffer. Use `inhibit-modification-hooks'.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/hilit-chg.el42
2 files changed, 36 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 679659bbe3..bca021e7ad 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2007-05-17 Martin Rudalics <[email protected]>
+
+ * hilit-chg.el (highlight-changes-rotate-faces): Don't set
+ modified flag of buffer. Use `inhibit-modification-hooks'.
+
2007-05-16 Richard Stallman <[email protected]>
* buff-menu.el (Buffer-menu-sort-column): Doc fix.
diff --git a/lisp/hilit-chg.el b/lisp/hilit-chg.el
index c867bcfaf0..19cecb1c8b 100644
--- a/lisp/hilit-chg.el
+++ b/lisp/hilit-chg.el
@@ -790,17 +790,37 @@ this, eval the following in the buffer to be saved:
(interactive)
;; If not in active mode do nothing but don't complain because this
;; may be bound to a hook.
- (if (eq highlight-changes-mode 'active)
- (let ((after-change-functions nil))
- ;; ensure hilit-chg-list is made and up to date
- (hilit-chg-make-list)
- ;; remove our existing overlays
- (hilit-chg-hide-changes)
- ;; for each change text property, increment it
- (hilit-chg-map-changes 'hilit-chg-bump-change)
- ;; and display them all if active
- (if (eq highlight-changes-mode 'active)
- (hilit-chg-display-changes))))
+ (when (eq highlight-changes-mode 'active)
+ (let ((modified (buffer-modified-p))
+ (inhibit-modification-hooks t))
+ ;; The `modified' related code tries to combine two goals: (1) Record the
+ ;; rotation in `buffer-undo-list' and (2) avoid setting the modified flag
+ ;; of the current buffer due to the rotation. We do this by inserting (in
+ ;; `buffer-undo-list') entries restoring buffer-modified-p to nil before
+ ;; and after the entry for the rotation.
+ (unless modified
+ ;; Install the "before" entry.
+ (setq buffer-undo-list
+ (cons '(apply restore-buffer-modified-p nil)
+ buffer-undo-list)))
+ (unwind-protect
+ (progn
+ ;; ensure hilit-chg-list is made and up to date
+ (hilit-chg-make-list)
+ ;; remove our existing overlays
+ (hilit-chg-hide-changes)
+ ;; for each change text property, increment it
+ (hilit-chg-map-changes 'hilit-chg-bump-change)
+ ;; and display them all if active
+ (if (eq highlight-changes-mode 'active)
+ (hilit-chg-display-changes)))
+ (unless modified
+ ;; Install the "after" entry.
+ (setq buffer-undo-list
+ (cons '(apply restore-buffer-modified-p nil)
+ buffer-undo-list))
+
+ (restore-buffer-modified-p nil)))))
;; This always returns nil so it is safe to use in write-file-functions
nil)