From: Karl Heuer Date: Mon, 16 Aug 1999 21:04:49 +0000 (+0000) Subject: (assoc-ignore-case, assoc-ignore-representation): Moved here from simple.el. X-Git-Tag: emacs-pretest-21.0.90~7146 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=98aae5f6367eed3fc9621e21c53292ff06ec0291;p=emacs.git (assoc-ignore-case, assoc-ignore-representation): Moved here from simple.el. --- 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." (setq found t value (if (consp elt) (cdr elt) default)))) (setq tail (cdr tail))) value)) + +(defun assoc-ignore-case (key alist) + "Like `assoc', but ignores differences in case and text representation. +KEY must be a string. Upper-case and lower-case letters are treated as equal. +Unibyte strings are converted to multibyte for comparison." + (let (element) + (while (and alist (not element)) + (if (eq t (compare-strings key 0 nil (car (car alist)) 0 nil t)) + (setq element (car alist))) + (setq alist (cdr alist))) + element)) + +(defun assoc-ignore-representation (key alist) + "Like `assoc', but ignores differences in text representation. +KEY must be a string. +Unibyte strings are converted to multibyte for comparison." + (let (element) + (while (and alist (not element)) + (if (eq t (compare-strings key 0 nil (car (car alist)) 0 nil)) + (setq element (car alist))) + (setq alist (cdr alist))) + element)) ;;;; Keymap support.