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, 09 May 2007 20:05:44 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

>>!       (let ((after-change-functions nil))
>
>
> That's bad for karma.  Use "(let ((inhibit-modification-hooks t))"
> instead, thank you,

Indeed.  Meanwhile I think that we should avoid altering the modified
state but retain undo information for face rotations.  This may show up
as a minor annoyance during undos but can't harm otherwise.  Eventually,
we should also add an `after-revert-hook' to remove hilit-chg's overlays
(unless `revert-buffer' gets re-implemented as TObeDOne).
*** hilit-chg.el        Tue Jan 23 06:40:02 2007
--- hilit-chg.el        Wed May  9 19:33:32 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,813 ----
    (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)
!     ;; Avoid marking the buffer as modified.  Note: We do not suppress 
modifying
!     ;; `buffer-undo-list' here.  Hence, undoing a face rotation may show up 
as a
!     ;; buffer modification.
!     (let ((modified (buffer-modified-p))
!         (inhibit-modification-hooks t))
!       (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 (set-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]