;ELC ;;; Compiled by pot@pot.cnuce.cnr.it on Tue Mar 18 15:46:26 2003 ;;; from file /home/pot/gnu/emacs-pretest.new/lisp/hilit-chg.el ;;; in Emacs version 21.3 ;;; with bytecomp version 2.85.4.1 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. (if (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`hilit-chg.el' was compiled for Emacs 19.29 or later")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\302\303\304\305\306\307\310\311&\210\312\313\314\315\310\303%\210\312\316\317\320\310\303%\207" [require wid-edit custom-declare-group highlight-changes nil "Highlight Changes mode." :version "20.4" :group faces custom-declare-face highlight-changes-face ((((class color)) (:foreground "red")) (t (:inverse-video t))) "Face used for highlighting changes." highlight-changes-delete-face ((((class color)) (:foreground "red" :underline t)) (t (:inverse-video t))) "Face used for highlighting deletions."] 8) #@410 *Colours used by `highlight-changes-rotate-faces'. The newest rotated change will be displayed in the first element of this list, the next older will be in the second element etc. This list is used if `highlight-changes-face-list' is nil, otherwise that variable overrides this list. If you only care about foreground colours then use this, if you want fancier faces then set `highlight-changes-face-list'. (custom-declare-variable 'highlight-changes-colours '(if (eq (frame-parameter nil 'background-mode) 'light) '("magenta" "blue" "darkgreen" "chocolate" "sienna4" "NavyBlue") '("yellow" "magenta" "blue" "maroon" "firebrick" "green4" "DarkOrchid")) '(#$ . -1154) :type '(repeat color) :group 'highlight-changes) #@207 *What state (active or passive) `highlight-changes' should start in. This is used when `highlight-changes' is called with no argument. This variable must be set to one of the symbols `active' or `passive'. (custom-declare-variable 'highlight-changes-initial-state ''active '(#$ . -1879) :type '(choice (const :tag "Active" active) (const :tag "Passive" passive)) :group 'highlight-changes) #@186 *What state `global-highlight-changes' should start in. This is used if `global-highlight-changes' is called with no argument. This variable must be set to either `active' or `passive' (custom-declare-variable 'highlight-changes-global-initial-state ''passive '(#$ . -2276) :type '(choice (const :tag "Active" active) (const :tag "Passive" passive)) :group 'highlight-changes) #@162 *The string used when Highlight Changes mode is in the active state. This should be set to nil if no indication is desired, or to a string with a leading space. (custom-declare-variable 'highlight-changes-active-string 'nil '(#$ . -2660) :type '(choice string (const :tag "None" nil)) :group 'highlight-changes) #@163 *The string used when Highlight Changes mode is in the passive state. This should be set to nil if no indication is desired, or to a string with a leading space. (custom-declare-variable 'highlight-changes-passive-string '" Chg" '(#$ . -2979) :type '(choice string (const :tag "None" nil)) :group 'highlight-changes) #@640 *Determine whether a buffer is suitable for global Highlight Changes mode. A function means that function is called: if it returns non-nil, the buffer is suitable. A list is a list of modes for which it is suitable, or a list whose first element is `not' followed by modes which are not suitable. t means the buffer is suitable if its name does not begin with ` ' nor `*' and the buffer has a filename. A value of nil means no buffers are suitable for `global-highlight-changes' (effectively disabling the mode). Examples: (c-mode c++-mode) means that Highlight Changes mode is turned on for buffers in C and C++ modes only. (custom-declare-variable 'highlight-changes-global-modes 't '(#$ . -3303) :type '(choice (const :tag "all non-special buffers visiting files" t) (set :menu-tag "specific modes" :tag "modes" :value (not) (const :tag "All except these" not) (repeat :tag "Modes" :inline t (symbol :tag "mode"))) (function :menu-tag "determined by function" :value buffer-file-name) (const :tag "none" nil)) :group 'highlight-changes) (byte-code "\301B\302\301!\204\f\303\303\207" [current-load-list global-highlight-changes boundp nil] 2) #@398 *If non-nil, toggling global Highlight Changes mode affects existing buffers. Normally, `global-highlight-changes' affects only new buffers (to be created). However, if `highlight-changes-global-changes-existing-buffers' is non-nil, then turning on `global-highlight-changes' will turn on Highlight Changes mode in suitable buffers, and turning the mode off will remove it from existing buffers. (custom-declare-variable 'highlight-changes-global-changes-existing-buffers 'nil '(#$ . -4473) :type 'boolean :group 'highlight-changes) (defalias 'hilit-chg-cust-fix-changes-face-list #[(w wc &optional event) "\306!\307 \235\203c\310 ! G\311\211\211\211\203R@\312\313\314 \"! \f=\204@ \307=\203;\315\316\f\"\210\202@\315 \f\"\210\317\fC\n\" SA\211\204\n\306!\232\204b\320\n\"\210\321 \210-)\322\323\"\211\205v\324\325$)\207" [w old-list new-list old-name new-name n widget-value default reverse nil intern format "highlight-changes-face-%d" copy-face highlight-changes-face append widget-value-set widget-setup widget-get :parent widget-apply :notify p parent event] 6]) #@429 *A list of faces used when rotating changes. Normally the variable is initialized to nil and the list is created from `highlight-changes-colours' when needed. However, you can set this variable to any list of faces. You will have to do this if you want faces which don't just differ from `highlight-changes-face' by the foreground colour. Otherwise, this list will be constructed when needed from `highlight-changes-colours'. (custom-declare-variable 'highlight-changes-face-list 'nil '(#$ . -5586) :type '(choice (repeat :notify hilit-chg-cust-fix-changes-face-list face) (const :tag "Derive from highlight-changes-colours" nil)) :group 'highlight-changes) (byte-code "\301B\305\301!\204\f\306\302B\305\302!\204\306\303B\305\303!\204$\307\301\f\236\204.\310\fB\311\301!\210\311\303!\210\312B\313\314\315\"\210\313\316\315\"\210\313\317\315\"\210\313\320\315\"\210\313\321\315\"\210\313\322\315\"\207" [current-load-list highlight-changes-mode hilit-chg-list hilit-chg-string minor-mode-alist boundp nil " ??" (highlight-changes-mode hilit-chg-string) make-variable-buffer-local ediff-number-of-differences autoload ediff-setup "ediff" ediff-with-current-buffer ediff-really-quit ediff-make-fine-diffs ediff-get-fine-diff-vector ediff-get-difference] 3) #@68 Call function FUNC for each region used by Highlight Changes mode. (defalias 'hilit-chg-map-changes #[(func &optional start-position end-position) "\206e \206\nd\306\211\211\205< \fW\205<\307 \310\"\311 \f\310 $ \2035\n \n\2063\f#\210\n\211\204\306,\207" [start-position end-position end prop limit start nil get-text-property hilit-chg text-property-not-all func] 6 (#$ . 6865)]) #@214 Display face information for Highlight Changes mode. An overlay containing a change face is added from the information in the text property of type `hilit-chg'. This is the opposite of `hilit-chg-hide-changes'. (defalias 'hilit-chg-display-changes #[(&optional beg end) "\302\303 #\207" [beg end hilit-chg-map-changes hilit-chg-make-ov] 4 (#$ . 7272)]) (defalias 'hilit-chg-make-ov #[(prop start end) "\306 \"\307\f\204\310\311!\210\f\312=\203\313\202 \f \235A@\n\2038\314 \302\n#\210\314 \315\316#\210\314 \317\316#\202<\310\320\f\"*\207" [start end face ov prop hilit-chg-list make-overlay nil error "hilit-chg-make-ov: prop is nil" hilit-chg-delete highlight-changes-delete-face overlay-put evaporate t hilit-chg "hilit-chg-make-ov: no face for prop: %s"] 4]) #@221 Remove face information for Highlight Changes mode. The overlay containing the face is removed, but the text property containing the change information is retained. This is the opposite of `hilit-chg-display-changes'. (defalias 'hilit-chg-hide-changes #[(&optional beg end) "\206e \206\nd\306\211\307 \f\"\211\205.\310 @\311\"\203&\312 @!\210 A\211\204\306,\207" [beg end ov p limit start nil overlays-in overlay-get hilit-chg delete-overlay] 5 (#$ . 8057)]) #@157 Fix change overlays in region between BEG and END. Ensure the overlays agree with the changes as determined from the text properties of type `hilit-chg' . (defalias 'hilit-chg-fixup #[(beg end) "\306\211\211\211\211\211\307\"\211\203u @\310\f!\311\f! W\203Y\312\f #\210\nV\203n\313\f!\314\n\" \203n\315\f @ A@#\210 AA\211\204E\202n\nV\203j\312\f\n#\210\202n\316\f!\210 A\211\204\317\".\207" [q props ov-end ov-start ov p nil overlays-in overlay-start overlay-end move-overlay overlay-properties make-overlay overlay-put delete-overlay hilit-chg-display-changes beg end] 7 (#$ . 8539)]) #@137 Remove the change face from the region between BEG and END. This allows you to manually remove highlighting from uninteresting changes. (defalias 'highlight-changes-remove-highlight #[(beg end) "\303\304 \n\305#\210\306 \n\")\207" [after-change-functions beg end nil remove-text-properties (hilit-chg nil) hilit-chg-fixup] 4 (#$ . 9178) "r"]) #@140 Record changes and optionally display them in a distinctive face. `hilit-chg-set' adds this function to the `after-change-functions' hook. (defalias 'hilit-chg-set-face-on-change #[(beg end leng-before &optional no-proerty-change) "\306 \307\216\310\211\311\312 \203!\313=\205\210\314\"\202\210U\203=\315V\203= \\d^\316\202g\317\311\"\316=\203g\320\211T\321#\210\322\211T\311\211$\210\313=\203g\314T\"\210\204u\322\311\n$\210\313=\204\201\205\210\323\n#.\207" [save-match-data-internal old type end-incr beg-decr undo-in-progress match-data ((set-match-data save-match-data-internal)) 1 hilit-chg nil active hilit-chg-fixup 0 hilit-chg-delete get-text-property remove-text-properties (hilit-chg nil) put-text-property hilit-chg-make-ov highlight-changes-mode beg end leng-before no-proerty-change] 5 (#$ . 9529)]) #@49 Turn on Highlight Changes mode for this buffer. (defalias 'hilit-chg-set #[(value) "\306\307\310\311#\210\312 \210 \313=\203\n\f\204&\314 \210\202& \f\204&\315 \210\316 \210\317\307!\210\320\307\310\321\311$\207" [value highlight-changes-mode highlight-changes-active-string hilit-chg-string buffer-read-only highlight-changes-passive-string remove-hook after-change-functions hilit-chg-set-face-on-change t hilit-chg-make-list active hilit-chg-display-changes hilit-chg-hide-changes force-mode-line-update make-local-hook add-hook nil] 5 (#$ . 10409)]) #@91 Remove Highlight Changes mode for this buffer. This removes all saved change information. (defalias 'hilit-chg-clear #[nil "\203\n\303\304\305 \"\207\306\301\307\310#\210\311\312 \210\313\314!\210)\311\315 \210\306\316\317\"\207" [buffer-read-only after-change-functions highlight-changes-mode message "Cannot remove highlighting from read-only mode buffer %s" buffer-name remove-hook hilit-chg-set-face-on-change t nil hilit-chg-hide-changes hilit-chg-map-changes (lambda (prop start stop) (remove-text-properties start stop '(hilit-chg nil))) force-mode-line-update post-command-hook hilit-chg-post-command-hook] 4 (#$ . 10978)]) #@1315 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. (defalias 'highlight-changes-mode #[(&optional arg) "\305 \204\306\307!\203x\307 \203x \204+\203'\310=\203#\311\202X\310\202X\n\202X \310=\2035\310\202X \311=\203?\311\202X\312 !\313V\203K\310\202X\312 !\313W\203W\314\202X\311 \203p\315 !\210\f\204j\316\317!\210\316\320!\202v\316\321!\210\322 *\207\323\324!\207" [highlight-changes-mode arg highlight-changes-initial-state new-highlight-changes-mode was-on display-color-p fboundp x-display-grayscale-p active passive prefix-numeric-value 0 nil hilit-chg-set run-hooks highlight-changes-enable-hook highlight-changes-toggle-hook highlight-changes-disable-hook hilit-chg-clear message "Highlight Changes mode requires color or grayscale display"] 3 (#$ . 11622) "P"]) #@73 Move to the beginning of the next change, if in Highlight Changes mode. (defalias 'highlight-changes-next-change #[nil "\203-`\303\304`\305\"\211\203\306`\305\"\n\203\306\n\305\"\n\203(\nb\202+\307\310!*\207\307\311!\207" [highlight-changes-mode prop start nil get-text-property hilit-chg next-single-property-change message "no next change" "This buffer is not in Highlight Changes mode."] 4 (#$ . 13686) nil]) #@77 Move to the beginning of the previous change, if in Highlight Changes mode. (defalias 'highlight-changes-previous-change #[nil "\203F`\303o\204\304`S\305\" \203\306`\305\"\n\203$\306\n\305\"\n\2038\306\n\305\"\2067\304e\305\"\2057e\n\203A\nb\202D\307\310!*\207\307\311!\207" [highlight-changes-mode prop start nil get-text-property hilit-chg previous-single-property-change message "no previous change" "This buffer is not in Highlight Changes mode."] 3 (#$ . 14117) nil]) #@63 Construct `hilit-chg-list' and `highlight-changes-face-list'. (defalias 'hilit-chg-make-list #[(&optional force) "\203 \2036\n\306\307\307 \2035\310\311\312\f\"!\313\314 \"\210\315 @\"\210\316 C\" A\fT\202+\317\314D\306\307\211 \203i\310\311\320\f\"! @\316D\" A\fT\202E\316D\"\211,\207" [highlight-changes-face-list force highlight-changes-colours name n p 1 nil intern format "highlight-changes-face-%d" copy-face highlight-changes-face set-face-foreground append hilit-chg "change-%d" hilit-chg-list last-face last-category] 4 (#$ . 14614)]) #@59 Increment (age) the Highlight Changes mode text property. (defalias 'hilit-chg-bump-change #[(prop start end) "\305 \306=\203\307\n8\202\307 \n\2358 \203\"\310 \f\311$\202(\312\313 \f $)\207" [new-prop prop hilit-chg-list start end nil hilit-chg-delete 2 put-text-property hilit-chg message "%d-%d unknown property %s not changed"] 5 (#$ . 15214)]) #@533 Rotate the faces used by Highlight Changes mode. 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 colours when the buffer is saved by adding the following to `local-write-file-hooks', by evaling it in the buffer to be saved): (add-hook 'local-write-file-hooks 'highlight-changes-rotate-faces) (defalias 'highlight-changes-rotate-faces #[nil "\302=\203\303\304 \210\305 \210\306\307!\210\302=\203\310 \210)\303\207" [highlight-changes-mode after-change-functions active nil hilit-chg-make-list hilit-chg-hide-changes hilit-chg-map-changes hilit-chg-bump-change hilit-chg-display-changes] 2 (#$ . 15580) nil]) #@635 Compare this buffer with a file, and highlight differences. The current buffer must be an unmodified buffer visiting a file, and must not be read-only. If the buffer has a backup filename, it is used as the default when this function is called interactively. If the current buffer is visiting the file being compared against, it also will have its differences highlighted. Otherwise, the file is read in temporarily but the buffer is deleted. If the buffer is read-only, differences will be highlighted but no property changes are made, so \[highlight-changes-next-change] and \[highlight-changes-previous-change] will not work. (defalias 'highlight-compare-with-file #[(file-b) "p `\306 \307 !\211\206\310 !rq\210 )\311\311\311\311\311 \311!\311\"\311#\311$\311%\311&\312!\203[\313\314\315\f\"!\203W\316!\210\202[\317\320!\210\203|\312!\203|\313\314\315 \"!\203x\316!\210\202|\317\321!\210\322\323!\210\203\217rq\210\322\323!\210)\324\213\210@\211A@\211 \325 \210\203\n@@!@A@\" @@$ @A@%\"!Z#%$Z&q\210\326!\"&\n$\210\327\311!\210 b\210\203\375rq\210\326$%#$\210)A A \202\246\203\327\311!\202\330!.\207" [buf-a buffer-read-only buf-a-read-only orig-pos file-a file-b buffer-file-name get-file-buffer find-file-noselect nil buffer-modified-p y-or-n-p format "OK to save %s? " save-buffer error "Buffer must be saved before comparing with a file" "Cannot compare with a file in an unsaved buffer" highlight-changes-mode active ((byte-code "\305 \n $\305\207" [buf-a file-a buf-b file-b xy hilit-chg-get-diff-info] 5)) hilit-chg-make-list hilit-chg-set-face-on-change set-buffer-modified-p kill-buffer existing-buf buf-b buf-b-read-only xy xx yy p q a-start a-end len-a b-start b-end len-b] 6 (#$ . 16441) (list (read-file-name "File to compare with? " "" nil 'yes (let ((f (make-backup-file-name (or (buffer-file-name (current-buffer)) (error "no file for this buffer"))))) (if (file-exists-p f) f ""))))]) (defalias 'hilit-chg-get-diff-info #[(buf-a file-a buf-b file-b) "\306\211\211\307 \f  \306\211\310\311\312BC&\210\313\n\314\306!\"\210 +D\207" [y x e buf-a file-a buf-b nil ediff-setup hilit-chg-get-diff-list-hk ediff-job-name something ediff-with-current-buffer ediff-really-quit file-b] 10]) (defalias 'hilit-chg-get-diff-list-hk #[nil "p\306\307\211\211\211\211\211\307\307W\205\250\310!\210\311\312\"\211\2037\313\f\307\"\202B\314\312\"\211\306\234C\n \203b\315 @!\316 @!D A\313C\"\202D\311\317\"\211\203t\313 \307\"\202\314\317\"\211\306\234C  \203\237\315 @!\316 @!D A\313C\"\202\201T\211\202.\207" [e b a vb va p 0 nil ediff-make-fine-diffs ediff-get-fine-diff-vector A append ediff-get-difference overlay-start overlay-end B extent n x y ediff-number-of-differences] 8]) (defalias 'hilit-chg-major-mode-hook #[nil "\300\301\302\"\207" [add-hook post-command-hook hilit-chg-post-command-hook] 3]) (defalias 'hilit-chg-post-command-hook #[nil "\302\303\304 \"?\205\305\306\307\"\210\206\310 !\207" [highlight-changes-mode highlight-changes-global-initial-state string-match "^[ *]" buffer-name remove-hook post-command-hook hilit-chg-post-command-hook hilit-chg-turn-on-maybe] 3]) (defalias 'hilit-chg-check-global #[nil "\301!\207" [highlight-changes-global-initial-state hilit-chg-turn-on-maybe] 2]) #@816 Turn on or off global Highlight Changes mode. When called interactively: - if no prefix, toggle global Highlight Changes mode on or off - if called with a positive prefix (or just C-u) turn it on in active mode - if called with a zero prefix turn it on in passive mode - if called with a negative prefix turn it off When called from a program: - if ARG is nil or omitted, turn it off - if ARG is `active', turn it on in active mode - if ARG is `passive', turn it on in passive mode - otherwise just turn it on When global Highlight Changes mode is enabled, Highlight Changes mode is turned on for future "suitable" buffers (and for "suitable" existing buffers if variable `highlight-changes-global-changes-existing-buffers' is non-nil). "Suitability" is determined by variable `highlight-changes-global-modes'. (defalias 'global-highlight-changes #[(&optional arg) "\2030\304=\203\304\202\305=\203\305\306\307\310 \"\210\311\312\211\"\210\311\313\314\"\210 \205O\315 !\207\307\316!\210\317\312\211\"\210\317\313\314\"\210\317\320\321\"\210\317\313\314\"\210 \205O\315\322!\207" [arg highlight-changes-global-initial-state global-highlight-changes highlight-changes-global-changes-existing-buffers active passive t message "turning ON Global Highlight Changes mode in %s state" add-hook hilit-chg-major-mode-hook find-file-hooks hilit-chg-check-global hilit-chg-update-all-buffers "turning OFF global Highlight Changes mode" remove-hook post-command-hook hilit-chg-post-command-hook nil] 3 (#$ . 19863) (list (cond ((null current-prefix-arg) (setq global-highlight-changes (not global-highlight-changes))) ((> (prefix-numeric-value current-prefix-arg) 0) (setq global-highlight-changes t) 'active) ((= (prefix-numeric-value current-prefix-arg) 0) (setq global-highlight-changes t) 'passive) (t (setq global-highlight-changes nil) nil)))]) #@510 Turn on Highlight Changes mode if it is appropriate for this buffer. A buffer is appropriate for Highlight Changes mode if all these are true: - the buffer is not a special buffer (one whose name begins with `*' or ` ') - the buffer's mode is suitable as per variable `highlight-changes-global-modes' - Highlight Changes mode is not already on for this buffer. This function is called from `hilit-chg-update-all-buffers' or from `global-highlight-changes' when turning on global Highlight Changes mode. (defalias 'hilit-chg-turn-on-maybe #[(value) "\206D \204\n\304\207\305 !\203 \202: <\203/ \242\306=\203)\n A>?\202:\n >\202:\307\310\311 \"?\205D\312 \205D\313 !\210\314\315!\207" [highlight-changes-mode highlight-changes-global-modes major-mode value nil functionp not string-match "^[ *]" buffer-name buffer-file-name hilit-chg-set run-hooks highlight-changes-enable-hook] 3 (#$ . 21727)]) (defalias 'hilit-chg-turn-off-maybe #[nil "\205\n\301\302!\210\303 \207" [highlight-changes-mode run-hooks highlight-changes-disable-hook hilit-chg-clear] 2]) (defalias 'hilit-chg-update-all-buffers #[(value) "\300\301\302 \"\207" [mapcar #[(buffer) "rq\210 \203\302 !\202\303 )\207" [buffer value hilit-chg-turn-on-maybe hilit-chg-turn-off-maybe] 2] buffer-list] 3]) (provide 'hilit-chg)