From 533a9a089717345fdfe5ff49b9798b54124cdd56 Mon Sep 17 00:00:00 2001 From: morioka Date: Thu, 7 May 1998 05:52:51 +0000 Subject: [PATCH] (ctree-add-calist-with-default): Fix. --- calist.el | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/calist.el b/calist.el index 0d47213..504476a 100644 --- a/calist.el +++ b/calist.el @@ -219,7 +219,7 @@ even if other rules are matched for ALIST." (type (car cell)) (value (cdr cell))) (cons type - (list '(t) + (list (list t) (cons value (calist-to-ctree (cdr calist))))) )) (t @@ -238,12 +238,19 @@ even if other rules are matched for ALIST." (delete ret (copy-alist calist))) )))) (setq values (cdr values))) - (setcdr ctree (list* '(t) - (cons (cdr ret) - (calist-to-ctree - (delete ret (copy-alist calist)))) - (cdr ctree))) - ) + (if (assq t (cdr ctree)) + (setcdr ctree + (cons (cons (cdr ret) + (calist-to-ctree + (delete ret (copy-alist calist)))) + (cdr ctree))) + (setcdr ctree + (list* (list t) + (cons (cdr ret) + (calist-to-ctree + (delete ret (copy-alist calist)))) + (cdr ctree))) + )) (catch 'tag (while values (let ((cell (car values))) @@ -251,10 +258,16 @@ even if other rules are matched for ALIST." (ctree-add-calist-with-default (cdr cell) calist)) ) (setq values (cdr values))) - (let ((elt (cons t (calist-to-ctree calist)))) - (or (member elt (cdr ctree)) - (setcdr ctree (cons elt (cdr ctree))) - ))) + (let ((cell (assq t (cdr ctree)))) + (if cell + (setcdr cell + (ctree-add-calist-with-default (cdr cell) + calist)) + (let ((elt (cons t (calist-to-ctree calist)))) + (or (member elt (cdr ctree)) + (setcdr ctree (cons elt (cdr ctree))) + )) + ))) ) ctree)))) -- 1.7.10.4