comparison lisp/format.el @ 19235:759e45894579

(format-annotate-single-property-change, format-annotate-atomic-property-change): move code that interprets nil as 0 inside test that property is numeric.
author Richard M. Stallman <rms@gnu.org>
date Sat, 09 Aug 1997 02:38:14 +0000
parents 20fda18753c2
children dc92be3441cd
comparison
equal deleted inserted replaced
19234:55924d8a5b9e 19235:759e45894579
811 Annotations to open and to close are returned as a dotted pair." 811 Annotations to open and to close are returned as a dotted pair."
812 (let ((prop-alist (cdr (assoc prop trans))) 812 (let ((prop-alist (cdr (assoc prop trans)))
813 default) 813 default)
814 (if (not prop-alist) 814 (if (not prop-alist)
815 nil 815 nil
816 ;; If property is numeric, nil means 0
817 (cond ((and (numberp old) (null new))
818 (setq new 0))
819 ((and (numberp new) (null old))
820 (setq old 0)))
821 ;; If either old or new is a list, have to treat both that way. 816 ;; If either old or new is a list, have to treat both that way.
822 (if (or (consp old) (consp new)) 817 (if (or (consp old) (consp new))
823 (let* ((old (if (listp old) old (list old))) 818 (let* ((old (if (listp old) old (list old)))
824 (new (if (listp new) new (list new))) 819 (new (if (listp new) new (list new)))
825 (tail (format-common-tail old new)) 820 (tail (format-common-tail old new))
844 PROP-ALIST is the relevant segment of a TRANSLATIONS list. 839 PROP-ALIST is the relevant segment of a TRANSLATIONS list.
845 OLD and NEW are the values." 840 OLD and NEW are the values."
846 (let (num-ann) 841 (let (num-ann)
847 ;; If old and new values are numbers, 842 ;; If old and new values are numbers,
848 ;; look for a number in PROP-ALIST. 843 ;; look for a number in PROP-ALIST.
849 (if (and (numberp old) (numberp new)) 844 (if (and (or (null old) (numberp old))
845 (or (null new) (numberp new)))
850 (progn 846 (progn
851 (setq num-ann prop-alist) 847 (setq num-ann prop-alist)
852 (while (and num-ann (not (numberp (car (car num-ann))))) 848 (while (and num-ann (not (numberp (car (car num-ann)))))
853 (setq num-ann (cdr num-ann))))) 849 (setq num-ann (cdr num-ann)))))
854 (if num-ann 850 (if num-ann
855 ;; Numerical annotation - use difference 851 ;; Numerical annotation - use difference
852
853 ;; If property is numeric, nil means 0
854 (cond ((and (numberp old) (null new))
855 (setq new 0))
856 ((and (numberp new) (null old))
857 (setq old 0)))
858
856 (let* ((entry (car num-ann)) 859 (let* ((entry (car num-ann))
857 (increment (car entry)) 860 (increment (car entry))
858 (n (ceiling (/ (float (- new old)) (float increment)))) 861 (n (ceiling (/ (float (- new old)) (float increment))))
859 (anno (car (cdr entry)))) 862 (anno (car (cdr entry))))
860 (if (> n 0) 863 (if (> n 0)