Function: highlight-changes-rotate-faces

highlight-changes-rotate-faces is an autoloaded, interactive and byte-compiled function defined in hilit-chg.el.gz.

Signature

(highlight-changes-rotate-faces)

Documentation

"Age" changes if in Highlight Changes mode and the changes are visible.

Current changes are displayed in the face described by the first element of highlight-changes-face-list, one level older changes are shown in face described by the second element, and so on. Very old changes remain shown in the last face in the list.

You can automatically rotate colors when the buffer is saved by adding this function to write-file-functions as a buffer-local value. To do this, eval the following in the buffer to be saved:

  (add-hook 'write-file-functions 'highlight-changes-rotate-faces nil t)

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/hilit-chg.el.gz
;;;###autoload
(defun highlight-changes-rotate-faces ()
  "\"Age\" changes if in Highlight Changes mode and the changes are visible.

Current changes are displayed in the face described by the first element
of `highlight-changes-face-list', one level older changes are shown in
face described by the second element, and so on.  Very old changes remain
shown in the last face in the list.

You can automatically rotate colors when the buffer is saved by adding
this function to `write-file-functions' as a buffer-local value.  To do
this, eval the following in the buffer to be saved:

  (add-hook \\='write-file-functions \\='highlight-changes-rotate-faces nil t)"
  (interactive)
  (when (and highlight-changes-mode highlight-changes-visible-mode)
    (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.
      ;; FIXME: this is no good: we need to test the `modified' state at the
      ;; time of the undo, not at the time of the "do", otherwise the undo
      ;; may erroneously clear the modified flag.  --Stef
      ;; (unless modified
      ;;   ;; Install the "before" entry.
      ;;   (push '(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
	    (hilit-chg-display-changes))
	(unless modified
	  ;; Install the "after" entry.  FIXME: See above.
	  ;; (push '(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)