Function: hilit-chg-cust-fix-changes-face-list

hilit-chg-cust-fix-changes-face-list is a byte-compiled function defined in hilit-chg.el.gz.

Signature

(hilit-chg-cust-fix-changes-face-list W WC &optional EVENT)

Source Code

;; Defined in /usr/src/emacs/lisp/hilit-chg.el.gz
(defun hilit-chg-cust-fix-changes-face-list (w _wc &optional event)
  ;; When customization function `highlight-changes-face-list' inserts a new
  ;; face it uses the default face.  We don't want the user to modify this
  ;; face, so we rename the faces in the list on an insert.  The rename is
  ;; actually done by copying the faces so user-defined faces still remain
  ;; in the same order.
  ;; The notifying the parent is needed because without it changes to the
  ;; faces are saved but not to the actual list itself.
  (let ((old-list (widget-value w)))
    (if (member 'default old-list)
        (let ((p (reverse old-list))
	     (n (length old-list))
	     new-name old-name
             (new-list nil))
	  (while p
	    (setq old-name (car p))
	    (setq new-name (intern (format "highlight-changes-%d" n)))
	    (if (eq old-name new-name)
		nil
	      ;; A new face has been inserted: we don't want to modify the
	      ;; default face so copy it.  Better, though, (I think) is to
	      ;; make a new face have the same attributes as
	      ;; the `highlight-changes' face.
	      (if (eq old-name 'default)
		  (copy-face 'highlight-changes new-name)
		(copy-face old-name new-name)
		))
	    (setq new-list (append (list new-name) new-list))
	    (setq n (1- n))
	    (setq p (cdr p)))
	  (if (equal new-list (widget-value w))
	      nil ;; (message "notify: no change!")
	    (widget-value-set w new-list)
            (widget-setup)))
      ;; (message "notify: no default here!")
      ))
  (let ((parent (widget-get w :parent)))
    (when parent
      (widget-apply parent :notify w event))))