emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/hilit-chg.el,v [EMACS_22_BASE]


From: Chong Yidong
Subject: [Emacs-diffs] Changes to emacs/lisp/hilit-chg.el,v [EMACS_22_BASE]
Date: Mon, 04 Jun 2007 23:39:06 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Branch:         EMACS_22_BASE
Changes by:     Chong Yidong <cyd>      07/06/04 23:39:06

Index: hilit-chg.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/hilit-chg.el,v
retrieving revision 1.41
retrieving revision 1.41.2.1
diff -u -b -r1.41 -r1.41.2.1
--- hilit-chg.el        21 Jan 2007 03:53:11 -0000      1.41
+++ hilit-chg.el        4 Jun 2007 23:39:06 -0000       1.41.2.1
@@ -790,8 +790,21 @@
   (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))
+  (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
@@ -800,7 +813,14 @@
        (hilit-chg-map-changes 'hilit-chg-bump-change)
        ;; and display them all if active
        (if (eq highlight-changes-mode 'active)
-           (hilit-chg-display-changes))))
+               (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)
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]