Function: format-annotate-single-property-change

format-annotate-single-property-change is a byte-compiled function defined in format.el.gz.

Signature

(format-annotate-single-property-change PROP OLD NEW TRANSLATIONS)

Documentation

Return annotations for property PROP changing from OLD to NEW.

These are searched for in the translations alist TRANSLATIONS
 (see format-annotate-region for the format).
If NEW does not appear in the list, but there is a default function, then call that function. Return a cons of the form (CLOSE . OPEN) where CLOSE is a list of annotations to close and OPEN is a list of annotations to open.

The annotations in CLOSE and OPEN need not be strings. They can be whatever the FORMAT-FN in format-annotate-region can handle. If that is enriched-make-annotation, they can be either strings, or lists of the form (PARAMETER VALUE).

Source Code

;; Defined in /usr/src/emacs/lisp/format.el.gz
(defun format-annotate-single-property-change (prop old new translations)
  "Return annotations for property PROP changing from OLD to NEW.
These are searched for in the translations alist TRANSLATIONS
 (see `format-annotate-region' for the format).
If NEW does not appear in the list, but there is a default function,
then call that function.
Return a cons of the form (CLOSE . OPEN)
where CLOSE is a list of annotations to close
and OPEN is a list of annotations to open.

The annotations in CLOSE and OPEN need not be strings.
They can be whatever the FORMAT-FN in `format-annotate-region'
can handle.  If that is `enriched-make-annotation', they can be
either strings, or lists of the form (PARAMETER VALUE)."

  (let ((prop-alist (cdr (assoc prop translations))))
    (if (not prop-alist)
	nil
      ;; If either old or new is a list, have to treat both that way.
      (if (and (or (listp old) (listp new))
	       (not (get prop 'format-list-atomic-p)))
          (if (not (and (proper-list-p old)
                        (proper-list-p new)))
	      (format-annotate-atomic-property-change prop-alist old new)
	    (let (close open)
	      (while old
		(setq close
		      (append (car (format-annotate-atomic-property-change
				    prop-alist (car old) nil))
			      close)
		      old (cdr old)))
              ;; If the font is on the format (:background "red"),
              ;; then we have a single face.  We're assuming a list of
              ;; faces, so transform.
              (when (and (listp new)
                         (keywordp (car new)))
                (setq new (list new)))
	      (while new
		(setq open
		      (append (cdr (format-annotate-atomic-property-change
				    prop-alist nil (car new)))
			      open)
		      new (cdr new)))
	      (format-make-relatively-unique close open)))
	(format-annotate-atomic-property-change prop-alist old new)))))