From: Richard M. Stallman Date: Wed, 29 Apr 1998 20:33:11 +0000 (+0000) Subject: (assoc-ignore-representation): New function. X-Git-Tag: emacs-20.3~1230 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9f0f00d759e6752448520344f85ff0440e4b2351;p=emacs.git (assoc-ignore-representation): New function. (assoc-ignore-case): Use compare-strings. --- diff --git a/lisp/simple.el b/lisp/simple.el index 1f547861886..2b9e0266020 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3425,11 +3425,23 @@ The properties used on SYMBOL are `composefunc', `sendfunc', (put symbol 'hookvar (or hookvar 'mail-send-hook))) (defun assoc-ignore-case (key alist) - "Like `assoc', but assumes KEY is a string and ignores case when comparing." - (setq key (downcase key)) + "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 (equal key (downcase (car (car alist)))) + (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))