Mercurial > emacs
changeset 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 | 57f551ebd40b |
children | 2bd381f7e297 |
files | lisp/format.el |
diffstat | 1 files changed, 19 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/format.el Tue Aug 05 03:44:40 1997 +0000 +++ b/lisp/format.el Tue Aug 05 04:44:55 1997 +0000 @@ -843,23 +843,26 @@ "Internal function annotate a single property change. PROP-ALIST is the relevant segment of a TRANSLATIONS list. OLD and NEW are the values." - (cond - ;; Numerical annotation - use difference - ((and (numberp old) (numberp new)) - (let* ((entry (progn - (while (and (car (car prop-alist)) - (not (numberp (car (car prop-alist))))) - (setq prop-alist (cdr prop-alist))) - (car prop-alist))) - (increment (car (car prop-alist))) - (n (ceiling (/ (float (- new old)) (float increment)))) - (anno (car (cdr (car prop-alist))))) - (if (> n 0) - (cons nil (make-list n anno)) - (cons (make-list (- n) anno) nil)))) + (let (num-ann) + ;; If old and new values are numbers, + ;; look for a number in PROP-ALIST. + (if (and (numberp old) (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 + (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 - (t (let ((close (and old (cdr (assoc old prop-alist)))) + ;; 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)