emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: highlight-changes-rotate-faces sets buffer modified


From: martin rudalics
Subject: Re: address@hidden: highlight-changes-rotate-faces sets buffer modified flag]
Date: Wed, 16 May 2007 07:59:17 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

First let's see what is best in this specific case.
Afterward we could see if any part of it is worth generalizing.

The attached patch should handle the specific case.
*** hilit-chg.el        Tue May 15 20:20:12 2007
--- hilit-chg.el        Tue May 15 20:22:12 2007
***************
*** 790,806 ****
    (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))))
    ;; This always returns nil so it is safe to use in write-file-functions
    nil)

--- 790,826 ----
    (interactive)
    ;; If not in active mode do nothing but don't complain because this
    ;; may be bound to a hook.
!   (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)


reply via email to

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