aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1999-08-16 21:04:49 +0000
committerKarl Heuer1999-08-16 21:04:49 +0000
commit98aae5f6367eed3fc9621e21c53292ff06ec0291 (patch)
tree2c46ced8920b982168f5a960774d9d98cd81641c
parent2127b7c641d9c3faf42f44e43302846ece61f3b0 (diff)
downloademacs-98aae5f6367eed3fc9621e21c53292ff06ec0291.tar.gz
emacs-98aae5f6367eed3fc9621e21c53292ff06ec0291.zip
(assoc-ignore-case, assoc-ignore-representation): Moved here from simple.el.
-rw-r--r--lisp/subr.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 0d918e10dd5..f4f695e8108 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -111,6 +111,28 @@ If TEST is omitted or nil, `equal' is used."
111 (setq found t value (if (consp elt) (cdr elt) default)))) 111 (setq found t value (if (consp elt) (cdr elt) default))))
112 (setq tail (cdr tail))) 112 (setq tail (cdr tail)))
113 value)) 113 value))
114
115(defun assoc-ignore-case (key alist)
116 "Like `assoc', but ignores differences in case and text representation.
117KEY must be a string. Upper-case and lower-case letters are treated as equal.
118Unibyte strings are converted to multibyte for comparison."
119 (let (element)
120 (while (and alist (not element))
121 (if (eq t (compare-strings key 0 nil (car (car alist)) 0 nil t))
122 (setq element (car alist)))
123 (setq alist (cdr alist)))
124 element))
125
126(defun assoc-ignore-representation (key alist)
127 "Like `assoc', but ignores differences in text representation.
128KEY must be a string.
129Unibyte strings are converted to multibyte for comparison."
130 (let (element)
131 (while (and alist (not element))
132 (if (eq t (compare-strings key 0 nil (car (car alist)) 0 nil))
133 (setq element (car alist)))
134 (setq alist (cdr alist)))
135 element))
114 136
115;;;; Keymap support. 137;;;; Keymap support.
116 138