comparison lisp/format.el @ 19155:20fda18753c2

(format-annotate-atomic-property-change): Look thru all elements of PROP-ALIST for a number, if OLD and NEW are numbers.
author Richard M. Stallman <rms@gnu.org>
date Tue, 05 Aug 1997 04:44:55 +0000
parents df8ab82c73f3
children 759e45894579
comparison
equal deleted inserted replaced
19154:57f551ebd40b 19155:20fda18753c2
841 841
842 (defun format-annotate-atomic-property-change (prop-alist old new) 842 (defun format-annotate-atomic-property-change (prop-alist old new)
843 "Internal function annotate a single property change. 843 "Internal function annotate a single property change.
844 PROP-ALIST is the relevant segment of a TRANSLATIONS list. 844 PROP-ALIST is the relevant segment of a TRANSLATIONS list.
845 OLD and NEW are the values." 845 OLD and NEW are the values."
846 (cond 846 (let (num-ann)
847 ;; Numerical annotation - use difference 847 ;; If old and new values are numbers,
848 ((and (numberp old) (numberp new)) 848 ;; look for a number in PROP-ALIST.
849 (let* ((entry (progn 849 (if (and (numberp old) (numberp new))
850 (while (and (car (car prop-alist)) 850 (progn
851 (not (numberp (car (car prop-alist))))) 851 (setq num-ann prop-alist)
852 (setq prop-alist (cdr prop-alist))) 852 (while (and num-ann (not (numberp (car (car num-ann)))))
853 (car prop-alist))) 853 (setq num-ann (cdr num-ann)))))
854 (increment (car (car prop-alist))) 854 (if num-ann
855 (n (ceiling (/ (float (- new old)) (float increment)))) 855 ;; Numerical annotation - use difference
856 (anno (car (cdr (car prop-alist))))) 856 (let* ((entry (car num-ann))
857 (if (> n 0) 857 (increment (car entry))
858 (cons nil (make-list n anno)) 858 (n (ceiling (/ (float (- new old)) (float increment))))
859 (cons (make-list (- n) anno) nil)))) 859 (anno (car (cdr entry))))
860 860 (if (> n 0)
861 ;; Standard annotation 861 (cons nil (make-list n anno))
862 (t (let ((close (and old (cdr (assoc old prop-alist)))) 862 (cons (make-list (- n) anno) nil)))
863
864 ;; Standard annotation
865 (let ((close (and old (cdr (assoc old prop-alist))))
863 (open (and new (cdr (assoc new prop-alist))))) 866 (open (and new (cdr (assoc new prop-alist)))))
864 (if (or close open) 867 (if (or close open)
865 (format-make-relatively-unique close open) 868 (format-make-relatively-unique close open)
866 ;; Call "Default" function, if any 869 ;; Call "Default" function, if any
867 (let ((default (assq nil prop-alist))) 870 (let ((default (assq nil prop-alist)))