From: morioka Date: Wed, 25 Mar 1998 15:35:35 +0000 (+0000) Subject: (ctree-match-calist): Prefer normal choice than default choice. X-Git-Tag: apel-7_6-char-next-index~6 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d466998e3efd2b3ae40584ac852210a4b2c306d;p=elisp%2Fapel.git (ctree-match-calist): Prefer normal choice than default choice. --- diff --git a/calist.el b/calist.el index 3c27b9f..154e105 100644 --- a/calist.el +++ b/calist.el @@ -60,18 +60,29 @@ (if (null rule-tree) alist (let ((type (car rule-tree)) - (choices (cdr rule-tree))) + (choices (cdr rule-tree)) + default) (catch 'tag (while choices (let* ((choice (car choices)) - (ret-alist (calist-field-match alist type (car choice)))) - (if ret-alist - (throw 'tag - (if (cdr choice) - (ctree-match-calist (cdr choice) ret-alist) - ret-alist)))) - (setq choices (cdr choices)))) - ))) + (choice-value (car choice))) + (if (eq choice-value t) + (setq default choice) + (let ((ret-alist (calist-field-match alist type (car choice)))) + (if ret-alist + (throw 'tag + (if (cdr choice) + (ctree-match-calist (cdr choice) ret-alist) + ret-alist)) + )))) + (setq choices (cdr choices))) + (if default + (let ((ret-alist (calist-field-match alist type t))) + (if ret-alist + (if (cdr default) + (ctree-match-calist (cdr default) ret-alist) + ret-alist)))) + )))) (defun calist-to-ctree (calist) "Convert condition-alist CALIST to condition-tree."