Mercurial > emacs
comparison lisp/hilit-chg.el @ 80947:d84f700262da
(highlight-changes-rotate-faces): Don't set
modified flag of buffer. Use `inhibit-modification-hooks'.
author | Martin Rudalics <rudalics@gmx.at> |
---|---|
date | Thu, 17 May 2007 08:41:14 +0000 |
parents | e3694f1cb928 |
children | 9355f9b7bbff 31beec9ee600 |
comparison
equal
deleted
inserted
replaced
80946:59000b9c61d5 | 80947:d84f700262da |
---|---|
788 | 788 |
789 \(add-hook 'write-file-functions 'highlight-changes-rotate-faces nil t)" | 789 \(add-hook 'write-file-functions 'highlight-changes-rotate-faces nil t)" |
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 |
807 ;; ======================================================================== | 827 ;; ======================================================================== |
808 ;; Comparing buffers/files | 828 ;; Comparing buffers/files |