From f0a6c717e27cda12ba60d5afcd01a09d2e8cba67 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Mon, 21 Feb 2000 13:00:25 +0000 Subject: [PATCH] (format-annotate-single-property-change): Handle properties.with dotted-list values. (format-proper-list-p): New function. --- lisp/ChangeLog | 9 +++++++++ lisp/format.el | 47 +++++++++++++++++++++++++++++------------------ 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f644d8f1569..312d8351ab6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2000-02-21 Gerd Moellmann + + * format.el (format-annotate-single-property-change): Handle + properties.with dotted-list values. + (format-proper-list-p): New function. + + * enriched.el (enriched-face-ans): Handle '(foreground-color + . COLOR) and (background-color . COLOR). + 2000-02-20 Dave Love * textmodes/flyspell.el (flyspell-mouse-map): Change definition diff --git a/lisp/format.el b/lisp/format.el index 77b46860c1f..4a0ee582809 100644 --- a/lisp/format.el +++ b/lisp/format.el @@ -483,6 +483,14 @@ returns nil." b (cdr b))) a) +(defun format-proper-list-p (list) + "Return t if LIST is a proper list. +A proper list is a list ending with a nil cdr, not with an atom " + (when (listp list) + (while (consp list) + (setq list (cdr list))) + (null list))) + (defun format-reorder (items order) "Arrange ITEMS to following partial ORDER. Elements of ITEMS equal to elements of ORDER will be rearranged to follow the @@ -925,25 +933,28 @@ Annotations to open and to close are returned as a dotted pair." (if (not prop-alist) nil ;; If either old or new is a list, have to treat both that way. - (if (and (or (consp old) (consp new)) + (if (and (or (listp old) (listp new)) (not (get prop 'format-list-atomic-p))) - (let* ((old (if (listp old) old (list old))) - (new (if (listp new) new (list new))) - (tail (format-common-tail old new)) - close open) - (while old - (setq close - (append (car (format-annotate-atomic-property-change - prop-alist (car old) nil)) - close) - old (cdr old))) - (while new - (setq open - (append (cdr (format-annotate-atomic-property-change - prop-alist nil (car new))) - open) - new (cdr new))) - (format-make-relatively-unique close open)) + (if (or (not (format-proper-list-p old)) + (not (format-proper-list-p new))) + (format-annotate-atomic-property-change prop-alist old new) + (let* ((old (if (listp old) old (list old))) + (new (if (listp new) new (list new))) + (tail (format-common-tail old new)) + close open) + (while old + (setq close + (append (car (format-annotate-atomic-property-change + prop-alist (car old) nil)) + close) + old (cdr old))) + (while new + (setq open + (append (cdr (format-annotate-atomic-property-change + prop-alist nil (car new))) + open) + new (cdr new))) + (format-make-relatively-unique close open))) (format-annotate-atomic-property-change prop-alist old new))))) (defun format-annotate-atomic-property-change (prop-alist old new) -- 2.39.5