Function: format-annotate-atomic-property-change
format-annotate-atomic-property-change is a byte-compiled function
defined in format.el.gz.
Signature
(format-annotate-atomic-property-change PROP-ALIST OLD NEW)
Documentation
Internal function to annotate a single property change.
PROP-ALIST is the relevant element of a TRANSLATIONS list. OLD and NEW are the values.
Source Code
;; Defined in /usr/src/emacs/lisp/format.el.gz
(defun format-annotate-atomic-property-change (prop-alist old new)
"Internal function to annotate a single property change.
PROP-ALIST is the relevant element of a TRANSLATIONS list.
OLD and NEW are the values."
(let (num-ann)
;; If old and new values are numbers,
;; look for a number in PROP-ALIST.
(if (and (or (null old) (numberp old))
(or (null new) (numberp new)))
(progn
(setq num-ann prop-alist)
(while (and num-ann (not (numberp (car (car num-ann)))))
(setq num-ann (cdr num-ann)))))
(if num-ann
;; Numerical annotation - use difference
(progn
;; If property is numeric, nil means 0
(cond ((and (numberp old) (null new))
(setq new 0))
((and (numberp new) (null old))
(setq old 0)))
(let* ((entry (car num-ann))
(increment (car entry))
(n (ceiling (/ (float (- new old)) (float increment))))
(anno (car (cdr entry))))
(if (> n 0)
(cons nil (make-list n anno))
(cons (make-list (- n) anno) nil))))
;; Standard annotation
(let ((close (and old (cdr (assoc old prop-alist))))
(open (and new (cdr (assoc new prop-alist)))))
(if (or close open)
(format-make-relatively-unique close open)
;; Call "Default" function, if any
(let ((default (assq nil prop-alist)))
(if default
(funcall (car (cdr default)) old new))))))))