-;;;###autoload
-(defun highlight-changes-mode (&optional arg)
- "Toggle (or initially set) Highlight Changes mode.
-
-Without an argument:
- If Highlight Changes mode is not enabled, then enable it (in either active
- or passive state as determined by the variable
- `highlight-changes-initial-state'); otherwise, toggle between active
- and passive state.
-
-With an argument ARG:
- If ARG is positive, set state to active;
- If ARG is zero, set state to passive;
- If ARG is negative, disable Highlight Changes mode completely.
-
-Active state - means changes are shown in a distinctive face.
-Passive state - means changes are kept and new ones recorded but are
- not displayed in a different face.
-
-Functions:
-\\[highlight-changes-next-change] - move point to beginning of next change
-\\[highlight-changes-previous-change] - move to beginning of previous change
-\\[highlight-compare-with-file] - mark text as changed by comparing this
- buffer with the contents of a file
-\\[highlight-changes-remove-highlight] - remove the change face from the region
-\\[highlight-changes-rotate-faces] - rotate different \"ages\" of changes \
-through
- various faces
-
-Hook variables:
-`highlight-changes-enable-hook' - when enabling Highlight Changes mode
-`highlight-changes-toggle-hook' - when entering active or passive state
-`highlight-changes-disable-hook' - when turning off Highlight Changes mode"
- (interactive "P")
- (if (or (display-color-p)
- (and (fboundp 'x-display-grayscale-p) (x-display-grayscale-p)))
- (let ((was-on highlight-changes-mode)
- (new-highlight-changes-mode
- (cond
- ((null arg)
- ;; no arg => toggle (or set to active initially)
- (if highlight-changes-mode
- (if (eq highlight-changes-mode 'active) 'passive 'active)
- highlight-changes-initial-state))
- ;; an argument is given
- ((eq arg 'active)
- 'active)
- ((eq arg 'passive)
- 'passive)
- ((> (prefix-numeric-value arg) 0)
- 'active)
- ((< (prefix-numeric-value arg) 0)
- nil)
- (t
- 'passive))))
- (if new-highlight-changes-mode
- ;; mode is turned on -- but may be passive
- (progn
- (hilit-chg-set new-highlight-changes-mode)
- (or was-on
- ;; run highlight-changes-enable-hook once
- (run-hooks 'highlight-changes-enable-hook))
- (run-hooks 'highlight-changes-toggle-hook))
- ;; mode is turned off
- (run-hooks 'highlight-changes-disable-hook)
- (hilit-chg-clear)))
- (message "Highlight Changes mode requires color or grayscale display")))