diff options
| author | Gerd Moellmann | 2000-04-03 19:29:56 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-04-03 19:29:56 +0000 |
| commit | cbbc32051374d25a92a0a33014d51118ff6d10fc (patch) | |
| tree | aa66dcdb654bf3bedb8353503d88215f53a7fef5 | |
| parent | 3b99a4f88203ba1d595c88675e55525f05f8ae6d (diff) | |
| download | emacs-cbbc32051374d25a92a0a33014d51118ff6d10fc.tar.gz emacs-cbbc32051374d25a92a0a33014d51118ff6d10fc.zip | |
(member-ignore-case): New function.
| -rw-r--r-- | lisp/subr.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index ee6eadaa59f..ddcc36079ed 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -174,6 +174,18 @@ Unibyte strings are converted to multibyte for comparison." | |||
| 174 | (setq element (car alist))) | 174 | (setq element (car alist))) |
| 175 | (setq alist (cdr alist))) | 175 | (setq alist (cdr alist))) |
| 176 | element)) | 176 | element)) |
| 177 | |||
| 178 | (defun member-ignore-case (elt list) | ||
| 179 | "Like `member', but ignores differences in case and text representation. | ||
| 180 | ELT must be a string. Upper-case and lower-case letters are treated as equal. | ||
| 181 | Unibyte strings are converted to multibyte for comparison." | ||
| 182 | (let (element) | ||
| 183 | (while (and list (not element)) | ||
| 184 | (if (eq t (compare-strings elt 0 nil (car list) 0 nil t)) | ||
| 185 | (setq element (car list))) | ||
| 186 | (setq list (cdr list))) | ||
| 187 | element)) | ||
| 188 | |||
| 177 | 189 | ||
| 178 | ;;;; Keymap support. | 190 | ;;;; Keymap support. |
| 179 | 191 | ||