string-equal-ignore-case: new function
* lisp/cedet/semantic/complete.el (semantic-collector-calculate-completions): Use `string-prefix-p' instead of explicit `compare-strings'. * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Add `string-equal-ignore-case'. * lisp/emacs-lisp/cl-extra.el (cl-equalp): Use `string-equal-ignore-case'. * lisp/emacs-lisp/shadow.el (load-path-shadows-find): Likewise. * lisp/emacs-lisp/shortdoc.el (string): Add `string-equal-ignore-case'. * lisp/files.el (file-truename): Use `string-equal-ignore-case'. (file-relative-name): Likewise. * lisp/gnus/gnus-art.el (article-hide-boring-headers): Use `string-equal-ignore-case' instead of `gnus-string-equal'. * lisp/gnus/gnus-util.el (gnus-string-equal): Remove, use `string-equal-ignore-case' instead. * lisp/international/mule-cmds.el (describe-language-environment): Use `string-equal-ignore-case'. (locale-charset-match-p): Likewise. * lisp/man.el (Man-softhyphen-to-minus): Use `string-prefix-p'. * lisp/minibuffer.el (completion--string-equal-p): Remove, use `string-equal-ignore-case' instead. (completion--twq-all): Use `string-equal-ignore-case'. (completion--do-completion): Likewise. * lisp/net/browse-url.el (browse-url-default-windows-browser): Use `string-prefix-p' instead of explicit `compare-strings'. * lisp/org/ob-core.el (org-babel-results-keyword): Use `string-equal-ignore-case' instead of explicit `compare-strings'. (org-babel-insert-result): Likewise. * lisp/org/org-compat.el (string-equal-ignore-case): Define unless defined already. (org-mode-flyspell-verify): Use `string-equal-ignore-case'. * lisp/org/org-lint.el (org-lint-duplicate-custom-id): Likewise. * lisp/org/ox.el (org-export-resolve-radio-link): Use `string-equal-ignore-case' and `string-clean-whitespace'. * lisp/progmodes/flymake-proc.el (flymake-proc--check-patch-master-file-buffer): Use `string-prefix-p' instead of explicit `compare-strings'. * lisp/progmodes/idlwave.el (idlwave-class-or-superclass-with-tag): Use `string-equal-ignore-case' instead of explicit `compare-strings'. * lisp/subr.el (member-ignore-case): Use `string-equal-ignore-case'. (string-equal-ignore-case): Compare strings ignoring case. * lisp/textmodes/bibtex.el (bibtex-string=): Remove. (bibtex-format-entry, bibtex-font-lock-url, bibtex-autofill-entry) (bibtex-print-help-message, bibtex-validate, bibtex-validate-globally) (bibtex-clean-entry, bibtex-completion-at-point-function, (bibtex-url): Use `string-equal-ignore-case' instead of `bibtex-string='. * lisp/textmodes/sgml-mode.el (sgml-get-context): Use `string-equal-ignore-case' instead of explicit `compare-strings'. (sgml-calculate-indent): Likewise * test/lisp/subr-tests.el (string-comparison-test): Add tests for `string-equal-ignore-case'.
This commit is contained in:
parent
015cf7824e
commit
70341cab3e
26 changed files with 104 additions and 124 deletions
|
@ -1451,7 +1451,7 @@ See Info node `(elisp) Integer Basics'."
|
|||
radians-to-degrees rassq rassoc read-from-string regexp-opt
|
||||
regexp-quote region-beginning region-end reverse round
|
||||
sin sqrt string string< string= string-equal string-lessp
|
||||
string> string-greaterp string-empty-p
|
||||
string> string-greaterp string-empty-p string-equal-ignore-case
|
||||
string-prefix-p string-suffix-p string-blank-p
|
||||
string-search string-to-char
|
||||
string-to-number string-to-syntax substring
|
||||
|
|
|
@ -71,8 +71,7 @@ numbers of different types (float vs. integer), and also compares
|
|||
strings case-insensitively."
|
||||
(cond ((eq x y) t)
|
||||
((stringp x)
|
||||
(and (stringp y) (= (length x) (length y))
|
||||
(eq (compare-strings x nil nil y nil nil t) t)))
|
||||
(and (stringp y) (string-equal-ignore-case x y)))
|
||||
((numberp x)
|
||||
(and (numberp y) (= x y)))
|
||||
((consp x)
|
||||
|
|
|
@ -128,11 +128,8 @@ See the documentation for `list-load-path-shadows' for further information."
|
|||
|
||||
(if (setq orig-dir
|
||||
(assoc file files
|
||||
(when dir-case-insensitive
|
||||
(lambda (f1 f2)
|
||||
(eq (compare-strings f1 nil nil
|
||||
f2 nil nil t)
|
||||
t)))))
|
||||
(and dir-case-insensitive
|
||||
#'string-equal-ignore-case)))
|
||||
;; This file was seen before, we have a shadowing.
|
||||
;; Report it unless the files are identical.
|
||||
(let ((base1 (concat (cdr orig-dir) "/" (car orig-dir)))
|
||||
|
|
|
@ -243,6 +243,8 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
|
|||
"Predicates for Strings"
|
||||
(string-equal
|
||||
:eval (string-equal "foo" "foo"))
|
||||
(string-equal-ignore-case
|
||||
:eval (string-equal-ignore-case "foo" "FOO"))
|
||||
(eq
|
||||
:eval (eq "foo" "foo"))
|
||||
(eql
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue