diff options
| author | Karl Heuer | 1999-08-16 21:04:49 +0000 |
|---|---|---|
| committer | Karl Heuer | 1999-08-16 21:04:49 +0000 |
| commit | 98aae5f6367eed3fc9621e21c53292ff06ec0291 (patch) | |
| tree | 2c46ced8920b982168f5a960774d9d98cd81641c | |
| parent | 2127b7c641d9c3faf42f44e43302846ece61f3b0 (diff) | |
| download | emacs-98aae5f6367eed3fc9621e21c53292ff06ec0291.tar.gz emacs-98aae5f6367eed3fc9621e21c53292ff06ec0291.zip | |
(assoc-ignore-case, assoc-ignore-representation): Moved here from simple.el.
| -rw-r--r-- | lisp/subr.el | 22 |
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. | ||
| 117 | KEY must be a string. Upper-case and lower-case letters are treated as equal. | ||
| 118 | Unibyte 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. | ||
| 128 | KEY must be a string. | ||
| 129 | Unibyte 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 | ||