From: Richard M. Stallman Date: Tue, 5 Aug 1997 04:44:55 +0000 (+0000) Subject: (format-annotate-atomic-property-change): X-Git-Tag: emacs-20.1~791 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e5a60108a283047c142817d440667ef9eba6e295;p=emacs.git (format-annotate-atomic-property-change): Look thru all elements of PROP-ALIST for a number, if OLD and NEW are numbers. --- diff --git a/lisp/format.el b/lisp/format.el index ad109a41c95..cfb6e4ca514 100644 --- a/lisp/format.el +++ b/lisp/format.el @@ -843,23 +843,26 @@ Annotations to open and to close are returned as a dotted pair." "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)))) - - ;; Standard annotation - (t (let ((close (and old (cdr (assoc old prop-alist)))) + (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 + (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)