Mercurial > emacs
comparison lisp/hilit-chg.el @ 63207:fecefbfcd215
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-377
Remove "-face" suffix from highlight-changes faces
2005-06-10 Miles Bader <miles@gnu.org>
* lisp/hilit-chg.el (highlight-changes, highlight-changes-delete):
Remove "-face" suffix from face names.
(highlight-changes-face, highlight-changes-delete-face):
New backward-compatibility aliases for renamed faces.
(hilit-chg-cust-fix-changes-face-list, hilit-chg-make-ov)
(hilit-chg-make-list): Use renamed highlight-changes faces.
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 10 Jun 2005 08:48:45 +0000 |
parents | 31aa9a390538 |
children | f4b47991b594 |
comparison
equal
deleted
inserted
replaced
63206:2624ddc5a43f | 63207:fecefbfcd215 |
---|---|
35 ;; want the information but very distracting otherwise. So, you can keep | 35 ;; want the information but very distracting otherwise. So, you can keep |
36 ;; Highlight Changes mode in passive state while you make your changes, toggle | 36 ;; Highlight Changes mode in passive state while you make your changes, toggle |
37 ;; it on to active mode to see them, then toggle it back off to avoid | 37 ;; it on to active mode to see them, then toggle it back off to avoid |
38 ;; distraction. | 38 ;; distraction. |
39 ;; | 39 ;; |
40 ;; When active, changes are displayed in `highlight-changes-face'. When | 40 ;; When active, changes are displayed in the `highlight-changes' face. |
41 ;; text is deleted, the following character is displayed in | 41 ;; When text is deleted, the following character is displayed in the |
42 ;; `highlight-changes-delete-face' face. | 42 ;; `highlight-changes-delete' face. |
43 ;; | 43 ;; |
44 ;; | 44 ;; |
45 ;; You can "age" different sets of changes by using | 45 ;; You can "age" different sets of changes by using |
46 ;; `highlight-changes-rotate-faces'. This rotates through a series | 46 ;; `highlight-changes-rotate-faces'. This rotates through a series |
47 ;; of different faces, so you can distinguish "new" changes from "older" | 47 ;; of different faces, so you can distinguish "new" changes from "older" |
48 ;; changes. You can customize these "rotated" faces in two ways. You can | 48 ;; changes. You can customize these "rotated" faces in two ways. You can |
49 ;; either explicitly define each face by customizing | 49 ;; either explicitly define each face by customizing |
50 ;; `highlight-changes-face-list'. If, however, the faces differ from | 50 ;; `highlight-changes-face-list'. If, however, the faces differ from |
51 ;; `highlight-changes-face' only in the foreground color, you can simply set | 51 ;; the `highlight-changes' face only in the foreground color, you can simply set |
52 ;; `highlight-changes-colours'. If `highlight-changes-face-list' is nil when | 52 ;; `highlight-changes-colours'. If `highlight-changes-face-list' is nil when |
53 ;; the faces are required they will be constructed from | 53 ;; the faces are required they will be constructed from |
54 ;; `highlight-changes-colours'. | 54 ;; `highlight-changes-colours'. |
55 ;; | 55 ;; |
56 ;; | 56 ;; |
210 ;; and underlined if a change is because of a deletion. | 210 ;; and underlined if a change is because of a deletion. |
211 ;; Note: underlining is helpful in that it shows up changes in white space. | 211 ;; Note: underlining is helpful in that it shows up changes in white space. |
212 ;; However, having it set for non-delete changes can be annoying because all | 212 ;; However, having it set for non-delete changes can be annoying because all |
213 ;; indentation on inserts gets underlined (which can look pretty ugly!). | 213 ;; indentation on inserts gets underlined (which can look pretty ugly!). |
214 | 214 |
215 (defface highlight-changes-face | 215 (defface highlight-changes |
216 '((((min-colors 88) (class color)) (:foreground "red1" )) | 216 '((((min-colors 88) (class color)) (:foreground "red1" )) |
217 (((class color)) (:foreground "red" )) | 217 (((class color)) (:foreground "red" )) |
218 (t (:inverse-video t))) | 218 (t (:inverse-video t))) |
219 "Face used for highlighting changes." | 219 "Face used for highlighting changes." |
220 :group 'highlight-changes) | 220 :group 'highlight-changes) |
221 ;; backward-compatibility alias | |
222 (put 'highlight-changes-face 'face-alias 'highlight-changes) | |
221 | 223 |
222 ;; This looks pretty ugly, actually. Maybe the underline should be removed. | 224 ;; This looks pretty ugly, actually. Maybe the underline should be removed. |
223 (defface highlight-changes-delete-face | 225 (defface highlight-changes-delete |
224 '((((min-colors 88) (class color)) (:foreground "red1" :underline t)) | 226 '((((min-colors 88) (class color)) (:foreground "red1" :underline t)) |
225 (((class color)) (:foreground "red" :underline t)) | 227 (((class color)) (:foreground "red" :underline t)) |
226 (t (:inverse-video t))) | 228 (t (:inverse-video t))) |
227 "Face used for highlighting deletions." | 229 "Face used for highlighting deletions." |
228 :group 'highlight-changes) | 230 :group 'highlight-changes) |
231 ;; backward-compatibility alias | |
232 (put 'highlight-changes-delete-face 'face-alias 'highlight-changes-delete) | |
229 | 233 |
230 | 234 |
231 | 235 |
232 ;; A (not very good) default list of colours to rotate through. | 236 ;; A (not very good) default list of colours to rotate through. |
233 ;; | 237 ;; |
345 new-name old-name | 349 new-name old-name |
346 (new-list nil) | 350 (new-list nil) |
347 ) | 351 ) |
348 (while p | 352 (while p |
349 (setq old-name (car p)) | 353 (setq old-name (car p)) |
350 (setq new-name (intern (format "highlight-changes-face-%d" n))) | 354 (setq new-name (intern (format "highlight-changes-%d" n))) |
351 (if (eq old-name new-name) | 355 (if (eq old-name new-name) |
352 nil | 356 nil |
353 ;; A new face has been inserted: we don't want to modify the | 357 ;; A new face has been inserted: we don't want to modify the |
354 ;; default face so copy it. Better, though, (I think) is to | 358 ;; default face so copy it. Better, though, (I think) is to |
355 ;; make a new face have the same attributes as | 359 ;; make a new face have the same attributes as |
356 ;; highlight-changes-face . | 360 ;; the `highlight-changes' face. |
357 (if (eq old-name 'default) | 361 (if (eq old-name 'default) |
358 (copy-face 'highlight-changes-face new-name) | 362 (copy-face 'highlight-changes new-name) |
359 (copy-face old-name new-name) | 363 (copy-face old-name new-name) |
360 )) | 364 )) |
361 (setq new-list (append (list new-name) new-list)) | 365 (setq new-list (append (list new-name) new-list)) |
362 (setq n (1- n)) | 366 (setq n (1- n)) |
363 (setq p (cdr p))) | 367 (setq p (cdr p))) |
377 (defcustom highlight-changes-face-list nil | 381 (defcustom highlight-changes-face-list nil |
378 "*A list of faces used when rotating changes. | 382 "*A list of faces used when rotating changes. |
379 Normally the variable is initialized to nil and the list is created from | 383 Normally the variable is initialized to nil and the list is created from |
380 `highlight-changes-colours' when needed. However, you can set this variable | 384 `highlight-changes-colours' when needed. However, you can set this variable |
381 to any list of faces. You will have to do this if you want faces which | 385 to any list of faces. You will have to do this if you want faces which |
382 don't just differ from `highlight-changes-face' by the foreground colour. | 386 don't just differ from the `highlight-changes' face by the foreground colour. |
383 Otherwise, this list will be constructed when needed from | 387 Otherwise, this list will be constructed when needed from |
384 `highlight-changes-colours'." | 388 `highlight-changes-colours'." |
385 :type '(choice | 389 :type '(choice |
386 (repeat | 390 (repeat |
387 :notify hilit-chg-cust-fix-changes-face-list | 391 :notify hilit-chg-cust-fix-changes-face-list |
443 ;; for the region make change overlays corresponding to | 447 ;; for the region make change overlays corresponding to |
444 ;; the text property 'hilit-chg | 448 ;; the text property 'hilit-chg |
445 (let ((ov (make-overlay start end)) | 449 (let ((ov (make-overlay start end)) |
446 face) | 450 face) |
447 (if (eq prop 'hilit-chg-delete) | 451 (if (eq prop 'hilit-chg-delete) |
448 (setq face 'highlight-changes-delete-face) | 452 (setq face 'highlight-changes-delete) |
449 (setq face (nth 1 (member prop hilit-chg-list)))) | 453 (setq face (nth 1 (member prop hilit-chg-list)))) |
450 (if face | 454 (if face |
451 (progn | 455 (progn |
452 ;; We must mark the face, that is the purpose of the overlay | 456 ;; We must mark the face, that is the purpose of the overlay |
453 (overlay-put ov 'face face) | 457 (overlay-put ov 'face face) |
729 force) ; already exists unless FORCE non-nil. | 733 force) ; already exists unless FORCE non-nil. |
730 (let ((p highlight-changes-colours) | 734 (let ((p highlight-changes-colours) |
731 (n 1) name) | 735 (n 1) name) |
732 (setq highlight-changes-face-list nil) | 736 (setq highlight-changes-face-list nil) |
733 (while p | 737 (while p |
734 (setq name (intern (format "highlight-changes-face-%d" n))) | 738 (setq name (intern (format "highlight-changes-%d" n))) |
735 (copy-face 'highlight-changes-face name) | 739 (copy-face 'highlight-changes name) |
736 (set-face-foreground name (car p)) | 740 (set-face-foreground name (car p)) |
737 (setq highlight-changes-face-list | 741 (setq highlight-changes-face-list |
738 (append highlight-changes-face-list (list name))) | 742 (append highlight-changes-face-list (list name))) |
739 (setq p (cdr p)) | 743 (setq p (cdr p)) |
740 (setq n (1+ n))))) | 744 (setq n (1+ n))))) |
741 (setq hilit-chg-list (list 'hilit-chg 'highlight-changes-face)) | 745 (setq hilit-chg-list (list 'hilit-chg 'highlight-changes)) |
742 (let ((p highlight-changes-face-list) | 746 (let ((p highlight-changes-face-list) |
743 (n 1) | 747 (n 1) |
744 last-category last-face) | 748 last-category last-face) |
745 (while p | 749 (while p |
746 (setq last-category (intern (format "change-%d" n))) | 750 (setq last-category (intern (format "change-%d" n))) |
747 ;; (setq last-face (intern (format "highlight-changes-face-%d" n))) | 751 ;; (setq last-face (intern (format "highlight-changes-%d" n))) |
748 (setq last-face (car p)) | 752 (setq last-face (car p)) |
749 (setq hilit-chg-list | 753 (setq hilit-chg-list |
750 (append hilit-chg-list | 754 (append hilit-chg-list |
751 (list last-category last-face))) | 755 (list last-category last-face))) |
752 (setq p (cdr p)) | 756 (setq p (cdr p)) |