# HG changeset patch # User Karl Heuer # Date 934837489 0 # Node ID 737e82c21934da8600c7ebf483b9c4807ced8a28 # Parent 16dc368b49dd395b27209018357569bea2925483 (assoc-ignore-case, assoc-ignore-representation): Moved here from simple.el. diff -r 16dc368b49dd -r 737e82c21934 lisp/subr.el --- a/lisp/subr.el Mon Aug 16 21:04:19 1999 +0000 +++ b/lisp/subr.el Mon Aug 16 21:04:49 1999 +0000 @@ -111,6 +111,28 @@ (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.