aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2007-06-04 23:39:06 +0000
committerChong Yidong2007-06-04 23:39:06 +0000
commit05d6ece7a354f2e2ddaee032713c96144f9a29fe (patch)
tree2f3d3ef1908496e0b10cfea2a2f4f193024cf17c
parent7cfe53dc955a5de88e417819eb4f6588ce22a667 (diff)
downloademacs-05d6ece7a354f2e2ddaee032713c96144f9a29fe.tar.gz
emacs-05d6ece7a354f2e2ddaee032713c96144f9a29fe.zip
(highlight-changes-rotate-faces): Don't set modified flag of buffer.
Use `inhibit-modification-hooks'.
-rw-r--r--lisp/hilit-chg.el42
1 files changed, 31 insertions, 11 deletions
diff --git a/lisp/hilit-chg.el b/lisp/hilit-chg.el
index c867bcfaf08..19cecb1c8be 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:
790 (interactive) 790 (interactive)
791 ;; If not in active mode do nothing but don't complain because this 791 ;; If not in active mode do nothing but don't complain because this
792 ;; may be bound to a hook. 792 ;; may be bound to a hook.
793 (if (eq highlight-changes-mode 'active) 793 (when (eq highlight-changes-mode 'active)
794 (let ((after-change-functions nil)) 794 (let ((modified (buffer-modified-p))
795 ;; ensure hilit-chg-list is made and up to date 795 (inhibit-modification-hooks t))
796 (hilit-chg-make-list) 796 ;; The `modified' related code tries to combine two goals: (1) Record the
797 ;; remove our existing overlays 797 ;; rotation in `buffer-undo-list' and (2) avoid setting the modified flag
798 (hilit-chg-hide-changes) 798 ;; of the current buffer due to the rotation. We do this by inserting (in
799 ;; for each change text property, increment it 799 ;; `buffer-undo-list') entries restoring buffer-modified-p to nil before
800 (hilit-chg-map-changes 'hilit-chg-bump-change) 800 ;; and after the entry for the rotation.
801 ;; and display them all if active 801 (unless modified
802 (if (eq highlight-changes-mode 'active) 802 ;; Install the "before" entry.
803 (hilit-chg-display-changes)))) 803 (setq buffer-undo-list
804 (cons '(apply restore-buffer-modified-p nil)
805 buffer-undo-list)))
806 (unwind-protect
807 (progn
808 ;; ensure hilit-chg-list is made and up to date
809 (hilit-chg-make-list)
810 ;; remove our existing overlays
811 (hilit-chg-hide-changes)
812 ;; for each change text property, increment it
813 (hilit-chg-map-changes 'hilit-chg-bump-change)
814 ;; and display them all if active
815 (if (eq highlight-changes-mode 'active)
816 (hilit-chg-display-changes)))
817 (unless modified
818 ;; Install the "after" entry.
819 (setq buffer-undo-list
820 (cons '(apply restore-buffer-modified-p nil)
821 buffer-undo-list))
822
823 (restore-buffer-modified-p nil)))))
804 ;; This always returns nil so it is safe to use in write-file-functions 824 ;; This always returns nil so it is safe to use in write-file-functions
805 nil) 825 nil)
806 826