diff options
| author | Sam Steingold | 2022-07-26 13:47:03 -0400 |
|---|---|---|
| committer | Sam Steingold | 2022-07-26 13:49:28 -0400 |
| commit | 70341cab3eb26e2f49bbc13d6bca247ab9403abc (patch) | |
| tree | fb26eac43aef57c9400769d101a8064ce3b9ec20 | |
| parent | 015cf7824ea511180329dabcb67c533661da3fff (diff) | |
| download | emacs-70341cab3eb26e2f49bbc13d6bca247ab9403abc.tar.gz emacs-70341cab3eb26e2f49bbc13d6bca247ab9403abc.zip | |
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'.
| -rw-r--r-- | doc/lispref/hash.texi | 10 | ||||
| -rw-r--r-- | doc/lispref/strings.texi | 5 | ||||
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/cedet/semantic/complete.el | 10 | ||||
| -rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-extra.el | 3 | ||||
| -rw-r--r-- | lisp/emacs-lisp/shadow.el | 7 | ||||
| -rw-r--r-- | lisp/emacs-lisp/shortdoc.el | 2 | ||||
| -rw-r--r-- | lisp/files.el | 28 | ||||
| -rw-r--r-- | lisp/gnus/gnus-art.el | 12 | ||||
| -rw-r--r-- | lisp/gnus/gnus-util.el | 9 | ||||
| -rw-r--r-- | lisp/international/mule-cmds.el | 5 | ||||
| -rw-r--r-- | lisp/man.el | 3 | ||||
| -rw-r--r-- | lisp/minibuffer.el | 15 | ||||
| -rw-r--r-- | lisp/net/browse-url.el | 3 | ||||
| -rw-r--r-- | lisp/org/ob-core.el | 9 | ||||
| -rw-r--r-- | lisp/org/org-compat.el | 14 | ||||
| -rw-r--r-- | lisp/org/org-lint.el | 6 | ||||
| -rw-r--r-- | lisp/org/ox.el | 12 | ||||
| -rw-r--r-- | lisp/progmodes/flymake-proc.el | 5 | ||||
| -rw-r--r-- | lisp/progmodes/idlwave.el | 2 | ||||
| -rw-r--r-- | lisp/subr.el | 8 | ||||
| -rw-r--r-- | lisp/textmodes/bibtex.el | 32 | ||||
| -rw-r--r-- | lisp/textmodes/sgml-mode.el | 13 | ||||
| -rw-r--r-- | lisp/vc/vc-dispatcher.el | 3 | ||||
| -rw-r--r-- | test/lisp/subr-tests.el | 7 |
26 files changed, 104 insertions, 124 deletions
diff --git a/doc/lispref/hash.texi b/doc/lispref/hash.texi index d3ae673d44d..25a56bd7151 100644 --- a/doc/lispref/hash.texi +++ b/doc/lispref/hash.texi | |||
| @@ -324,15 +324,13 @@ the same integer. | |||
| 324 | compared case-insensitively. | 324 | compared case-insensitively. |
| 325 | 325 | ||
| 326 | @example | 326 | @example |
| 327 | (defun case-fold-string= (a b) | 327 | (defun string-hash-ignore-case (a) |
| 328 | (eq t (compare-strings a nil nil b nil nil t))) | ||
| 329 | (defun case-fold-string-hash (a) | ||
| 330 | (sxhash-equal (upcase a))) | 328 | (sxhash-equal (upcase a))) |
| 331 | 329 | ||
| 332 | (define-hash-table-test 'case-fold | 330 | (define-hash-table-test 'ignore-case |
| 333 | 'case-fold-string= 'case-fold-string-hash) | 331 | 'string-equal-ignore-case 'string-hash-ignore-case) |
| 334 | 332 | ||
| 335 | (make-hash-table :test 'case-fold) | 333 | (make-hash-table :test 'ignore-case) |
| 336 | @end example | 334 | @end example |
| 337 | 335 | ||
| 338 | Here is how you could define a hash table test equivalent to the | 336 | Here is how you could define a hash table test equivalent to the |
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index cb9019daa9b..bf61bb7c479 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi | |||
| @@ -560,6 +560,11 @@ Representations}. | |||
| 560 | @code{string-equal} is another name for @code{string=}. | 560 | @code{string-equal} is another name for @code{string=}. |
| 561 | @end defun | 561 | @end defun |
| 562 | 562 | ||
| 563 | @defun string-equal-ignore-case string1 string2 | ||
| 564 | @code{string-equal-ignore-case} compares strings ignoring case | ||
| 565 | differences, like @code{char-equal} when @code{case-fold-search} is | ||
| 566 | @code{t}. | ||
| 567 | |||
| 563 | @cindex locale-dependent string equivalence | 568 | @cindex locale-dependent string equivalence |
| 564 | @defun string-collate-equalp string1 string2 &optional locale ignore-case | 569 | @defun string-collate-equalp string1 string2 &optional locale ignore-case |
| 565 | This function returns @code{t} if @var{string1} and @var{string2} are | 570 | This function returns @code{t} if @var{string1} and @var{string2} are |
| @@ -2502,6 +2502,9 @@ abbrevs. This has been generalized via the | |||
| 2502 | 'save-some-buffers-functions' variable, and packages can now register | 2502 | 'save-some-buffers-functions' variable, and packages can now register |
| 2503 | things to be saved. | 2503 | things to be saved. |
| 2504 | 2504 | ||
| 2505 | ** New function 'string-equal-ignore-case'. | ||
| 2506 | This compares strings ignoring case differences. | ||
| 2507 | |||
| 2505 | ** Themes | 2508 | ** Themes |
| 2506 | 2509 | ||
| 2507 | --- | 2510 | --- |
diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el index cd04cf86434..436ad08c5fc 100644 --- a/lisp/cedet/semantic/complete.el +++ b/lisp/cedet/semantic/complete.el | |||
| @@ -1011,20 +1011,14 @@ Output must be in semanticdb Find result format." | |||
| 1011 | (oref obj last-prefix))) | 1011 | (oref obj last-prefix))) |
| 1012 | (completionlist | 1012 | (completionlist |
| 1013 | (cond ((or same-prefix-p | 1013 | (cond ((or same-prefix-p |
| 1014 | (and last-prefix (eq (compare-strings | 1014 | (and last-prefix (string-prefix-p last-prefix prefix t))) |
| 1015 | last-prefix 0 nil | ||
| 1016 | prefix 0 (length last-prefix)) | ||
| 1017 | t))) | ||
| 1018 | ;; We have the same prefix, or last-prefix is a | 1015 | ;; We have the same prefix, or last-prefix is a |
| 1019 | ;; substring of the of new prefix, in which case we are | 1016 | ;; substring of the of new prefix, in which case we are |
| 1020 | ;; refining our symbol so just re-use cache. | 1017 | ;; refining our symbol so just re-use cache. |
| 1021 | (oref obj last-all-completions)) | 1018 | (oref obj last-all-completions)) |
| 1022 | ((and last-prefix | 1019 | ((and last-prefix |
| 1023 | (> (length prefix) 1) | 1020 | (> (length prefix) 1) |
| 1024 | (eq (compare-strings | 1021 | (string-prefix-p prefix last-prefix t)) |
| 1025 | prefix 0 nil | ||
| 1026 | last-prefix 0 (length prefix)) | ||
| 1027 | t)) | ||
| 1028 | ;; The new prefix is a substring of the old | 1022 | ;; The new prefix is a substring of the old |
| 1029 | ;; prefix, and it's longer than one character. | 1023 | ;; prefix, and it's longer than one character. |
| 1030 | ;; Perform a full search to pull in additional | 1024 | ;; Perform a full search to pull in additional |
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 5705b2a8fd7..3f4af44051c 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el | |||
| @@ -1451,7 +1451,7 @@ See Info node `(elisp) Integer Basics'." | |||
| 1451 | radians-to-degrees rassq rassoc read-from-string regexp-opt | 1451 | radians-to-degrees rassq rassoc read-from-string regexp-opt |
| 1452 | regexp-quote region-beginning region-end reverse round | 1452 | regexp-quote region-beginning region-end reverse round |
| 1453 | sin sqrt string string< string= string-equal string-lessp | 1453 | sin sqrt string string< string= string-equal string-lessp |
| 1454 | string> string-greaterp string-empty-p | 1454 | string> string-greaterp string-empty-p string-equal-ignore-case |
| 1455 | string-prefix-p string-suffix-p string-blank-p | 1455 | string-prefix-p string-suffix-p string-blank-p |
| 1456 | string-search string-to-char | 1456 | string-search string-to-char |
| 1457 | string-to-number string-to-syntax substring | 1457 | string-to-number string-to-syntax substring |
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 8e38df43c87..607810ee141 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el | |||
| @@ -71,8 +71,7 @@ numbers of different types (float vs. integer), and also compares | |||
| 71 | strings case-insensitively." | 71 | strings case-insensitively." |
| 72 | (cond ((eq x y) t) | 72 | (cond ((eq x y) t) |
| 73 | ((stringp x) | 73 | ((stringp x) |
| 74 | (and (stringp y) (= (length x) (length y)) | 74 | (and (stringp y) (string-equal-ignore-case x y))) |
| 75 | (eq (compare-strings x nil nil y nil nil t) t))) | ||
| 76 | ((numberp x) | 75 | ((numberp x) |
| 77 | (and (numberp y) (= x y))) | 76 | (and (numberp y) (= x y))) |
| 78 | ((consp x) | 77 | ((consp x) |
diff --git a/lisp/emacs-lisp/shadow.el b/lisp/emacs-lisp/shadow.el index 2343a9b589f..da32e4564f6 100644 --- a/lisp/emacs-lisp/shadow.el +++ b/lisp/emacs-lisp/shadow.el | |||
| @@ -128,11 +128,8 @@ See the documentation for `list-load-path-shadows' for further information." | |||
| 128 | 128 | ||
| 129 | (if (setq orig-dir | 129 | (if (setq orig-dir |
| 130 | (assoc file files | 130 | (assoc file files |
| 131 | (when dir-case-insensitive | 131 | (and dir-case-insensitive |
| 132 | (lambda (f1 f2) | 132 | #'string-equal-ignore-case))) |
| 133 | (eq (compare-strings f1 nil nil | ||
| 134 | f2 nil nil t) | ||
| 135 | t))))) | ||
| 136 | ;; This file was seen before, we have a shadowing. | 133 | ;; This file was seen before, we have a shadowing. |
| 137 | ;; Report it unless the files are identical. | 134 | ;; Report it unless the files are identical. |
| 138 | (let ((base1 (concat (cdr orig-dir) "/" (car orig-dir))) | 135 | (let ((base1 (concat (cdr orig-dir) "/" (car orig-dir))) |
diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index 05b3361cb3d..315afd4312b 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el | |||
| @@ -243,6 +243,8 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'), | |||
| 243 | "Predicates for Strings" | 243 | "Predicates for Strings" |
| 244 | (string-equal | 244 | (string-equal |
| 245 | :eval (string-equal "foo" "foo")) | 245 | :eval (string-equal "foo" "foo")) |
| 246 | (string-equal-ignore-case | ||
| 247 | :eval (string-equal-ignore-case "foo" "FOO")) | ||
| 246 | (eq | 248 | (eq |
| 247 | :eval (eq "foo" "foo")) | 249 | :eval (eq "foo" "foo")) |
| 248 | (eql | 250 | (eql |
diff --git a/lisp/files.el b/lisp/files.el index bc74dfa7381..37ed796a687 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -1428,7 +1428,7 @@ containing it, until no links are left at any level. | |||
| 1428 | ;; If these are equal, we have the (or a) root directory. | 1428 | ;; If these are equal, we have the (or a) root directory. |
| 1429 | (or (string= dir dirfile) | 1429 | (or (string= dir dirfile) |
| 1430 | (and (file-name-case-insensitive-p dir) | 1430 | (and (file-name-case-insensitive-p dir) |
| 1431 | (eq (compare-strings dir 0 nil dirfile 0 nil t) t)) | 1431 | (string-equal-ignore-case dir dirfile)) |
| 1432 | ;; If this is the same dir we last got the truename for, | 1432 | ;; If this is the same dir we last got the truename for, |
| 1433 | ;; save time--don't recalculate. | 1433 | ;; save time--don't recalculate. |
| 1434 | (if (assoc dir (car prev-dirs)) | 1434 | (if (assoc dir (car prev-dirs)) |
| @@ -5459,21 +5459,17 @@ on a DOS/Windows machine, it returns FILENAME in expanded form." | |||
| 5459 | ;; Test for different drive letters | 5459 | ;; Test for different drive letters |
| 5460 | (not (eq t (compare-strings filename 0 2 directory 0 2 fold-case))) | 5460 | (not (eq t (compare-strings filename 0 2 directory 0 2 fold-case))) |
| 5461 | ;; Test for UNCs on different servers | 5461 | ;; Test for UNCs on different servers |
| 5462 | (not (eq t (compare-strings | 5462 | (not (string-equal-ignore-case |
| 5463 | (progn | 5463 | (if (string-match "\\`//\\([^:/]+\\)/" filename) |
| 5464 | (if (string-match "\\`//\\([^:/]+\\)/" filename) | 5464 | (match-string 1 filename) |
| 5465 | (match-string 1 filename) | 5465 | ;; Windows file names cannot have ? in |
| 5466 | ;; Windows file names cannot have ? in | 5466 | ;; them, so use that to detect when |
| 5467 | ;; them, so use that to detect when | 5467 | ;; neither FILENAME nor DIRECTORY is a |
| 5468 | ;; neither FILENAME nor DIRECTORY is a | 5468 | ;; UNC. |
| 5469 | ;; UNC. | 5469 | "?") |
| 5470 | "?")) | 5470 | (if (string-match "\\`//\\([^:/]+\\)/" directory) |
| 5471 | 0 nil | 5471 | (match-string 1 directory) |
| 5472 | (progn | 5472 | "?"))))) |
| 5473 | (if (string-match "\\`//\\([^:/]+\\)/" directory) | ||
| 5474 | (match-string 1 directory) | ||
| 5475 | "?")) | ||
| 5476 | 0 nil t))))) | ||
| 5477 | ;; Test for different remote file system identification | 5473 | ;; Test for different remote file system identification |
| 5478 | (not (equal fremote dremote))) | 5474 | (not (equal fremote dremote))) |
| 5479 | filename | 5475 | filename |
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 4b68a54ce81..e28d84e06fe 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el | |||
| @@ -1939,8 +1939,8 @@ always hide." | |||
| 1939 | 'boring-headers))) | 1939 | 'boring-headers))) |
| 1940 | ;; Hide boring Newsgroups header. | 1940 | ;; Hide boring Newsgroups header. |
| 1941 | ((eq elem 'newsgroups) | 1941 | ((eq elem 'newsgroups) |
| 1942 | (when (gnus-string-equal | 1942 | (when (string-equal-ignore-case |
| 1943 | (gnus-fetch-field "newsgroups") | 1943 | (or (gnus-fetch-field "newsgroups") "") |
| 1944 | (gnus-group-real-name | 1944 | (gnus-group-real-name |
| 1945 | (if (boundp 'gnus-newsgroup-name) | 1945 | (if (boundp 'gnus-newsgroup-name) |
| 1946 | gnus-newsgroup-name | 1946 | gnus-newsgroup-name |
| @@ -1954,7 +1954,7 @@ always hide." | |||
| 1954 | gnus-newsgroup-name "")))) | 1954 | gnus-newsgroup-name "")))) |
| 1955 | (when (and to to-address | 1955 | (when (and to to-address |
| 1956 | (ignore-errors | 1956 | (ignore-errors |
| 1957 | (gnus-string-equal | 1957 | (string-equal-ignore-case |
| 1958 | ;; only one address in To | 1958 | ;; only one address in To |
| 1959 | (nth 1 (mail-extract-address-components to)) | 1959 | (nth 1 (mail-extract-address-components to)) |
| 1960 | to-address))) | 1960 | to-address))) |
| @@ -1967,7 +1967,7 @@ always hide." | |||
| 1967 | gnus-newsgroup-name "")))) | 1967 | gnus-newsgroup-name "")))) |
| 1968 | (when (and to to-list | 1968 | (when (and to to-list |
| 1969 | (ignore-errors | 1969 | (ignore-errors |
| 1970 | (gnus-string-equal | 1970 | (string-equal-ignore-case |
| 1971 | ;; only one address in To | 1971 | ;; only one address in To |
| 1972 | (nth 1 (mail-extract-address-components to)) | 1972 | (nth 1 (mail-extract-address-components to)) |
| 1973 | to-list))) | 1973 | to-list))) |
| @@ -1980,13 +1980,13 @@ always hide." | |||
| 1980 | gnus-newsgroup-name "")))) | 1980 | gnus-newsgroup-name "")))) |
| 1981 | (when (and cc to-list | 1981 | (when (and cc to-list |
| 1982 | (ignore-errors | 1982 | (ignore-errors |
| 1983 | (gnus-string-equal | 1983 | (string-equal-ignore-case |
| 1984 | ;; only one address in Cc | 1984 | ;; only one address in Cc |
| 1985 | (nth 1 (mail-extract-address-components cc)) | 1985 | (nth 1 (mail-extract-address-components cc)) |
| 1986 | to-list))) | 1986 | to-list))) |
| 1987 | (gnus-article-hide-header "cc")))) | 1987 | (gnus-article-hide-header "cc")))) |
| 1988 | ((eq elem 'followup-to) | 1988 | ((eq elem 'followup-to) |
| 1989 | (when (gnus-string-equal | 1989 | (when (string-equal-ignore-case |
| 1990 | (message-fetch-field "followup-to") | 1990 | (message-fetch-field "followup-to") |
| 1991 | (message-fetch-field "newsgroups")) | 1991 | (message-fetch-field "newsgroups")) |
| 1992 | (gnus-article-hide-header "followup-to"))) | 1992 | (gnus-article-hide-header "followup-to"))) |
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 218a4d242b2..31a275c7d05 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el | |||
| @@ -1073,15 +1073,6 @@ ARG is passed to the first function." | |||
| 1073 | s) | 1073 | s) |
| 1074 | (error string))) | 1074 | (error string))) |
| 1075 | 1075 | ||
| 1076 | ;; This might use `compare-strings' to reduce consing in the | ||
| 1077 | ;; case-insensitive case, but it has to cope with null args. | ||
| 1078 | ;; (`string-equal' uses symbol print names.) | ||
| 1079 | (defun gnus-string-equal (x y) | ||
| 1080 | "Like `string-equal', except it compares case-insensitively." | ||
| 1081 | (and (= (length x) (length y)) | ||
| 1082 | (or (string-equal x y) | ||
| 1083 | (string-equal (downcase x) (downcase y))))) | ||
| 1084 | |||
| 1085 | (defcustom gnus-use-byte-compile t | 1076 | (defcustom gnus-use-byte-compile t |
| 1086 | "If non-nil, byte-compile crucial run-time code." | 1077 | "If non-nil, byte-compile crucial run-time code." |
| 1087 | :type 'boolean | 1078 | :type 'boolean |
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index df1c06ec272..12896cc4b0e 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el | |||
| @@ -2199,8 +2199,7 @@ See `set-language-info-alist' for use in programs." | |||
| 2199 | first nil)) | 2199 | first nil)) |
| 2200 | (dolist (elt l) | 2200 | (dolist (elt l) |
| 2201 | (when (or (eq input-method elt) | 2201 | (when (or (eq input-method elt) |
| 2202 | (eq t (compare-strings language-name nil nil | 2202 | (string-equal-ignore-case language-name (nth 1 elt))) |
| 2203 | (nth 1 elt) nil nil t))) | ||
| 2204 | (when first | 2203 | (when first |
| 2205 | (insert "Input methods:\n") | 2204 | (insert "Input methods:\n") |
| 2206 | (setq first nil)) | 2205 | (setq first nil)) |
| @@ -2599,7 +2598,7 @@ Matching is done ignoring case and any hyphens and underscores in the | |||
| 2599 | names. E.g. `ISO_8859-1' and `iso88591' both match `iso-8859-1'." | 2598 | names. E.g. `ISO_8859-1' and `iso88591' both match `iso-8859-1'." |
| 2600 | (setq charset1 (replace-regexp-in-string "[-_]" "" charset1)) | 2599 | (setq charset1 (replace-regexp-in-string "[-_]" "" charset1)) |
| 2601 | (setq charset2 (replace-regexp-in-string "[-_]" "" charset2)) | 2600 | (setq charset2 (replace-regexp-in-string "[-_]" "" charset2)) |
| 2602 | (eq t (compare-strings charset1 nil nil charset2 nil nil t))) | 2601 | (string-equal-ignore-case charset1 charset2)) |
| 2603 | 2602 | ||
| 2604 | (defvar locale-charset-alist nil | 2603 | (defvar locale-charset-alist nil |
| 2605 | "Coding system alist keyed on locale-style charset name. | 2604 | "Coding system alist keyed on locale-style charset name. |
diff --git a/lisp/man.el b/lisp/man.el index 951e0ef9add..d66f63972ae 100644 --- a/lisp/man.el +++ b/lisp/man.el | |||
| @@ -1241,8 +1241,7 @@ See the variable `Man-notify-method' for the different notification behaviors." | |||
| 1241 | (defun Man-softhyphen-to-minus () | 1241 | (defun Man-softhyphen-to-minus () |
| 1242 | ;; \255 is SOFT HYPHEN in Latin-N. Versions of Debian man, at | 1242 | ;; \255 is SOFT HYPHEN in Latin-N. Versions of Debian man, at |
| 1243 | ;; least, emit it even when not in a Latin-N locale. | 1243 | ;; least, emit it even when not in a Latin-N locale. |
| 1244 | (unless (eq t (compare-strings "latin-" 0 nil | 1244 | (unless (string-prefix-p "latin-" current-language-environment t) |
| 1245 | current-language-environment 0 6 t)) | ||
| 1246 | (goto-char (point-min)) | 1245 | (goto-char (point-min)) |
| 1247 | (while (search-forward "" nil t) (replace-match "-")))) | 1246 | (while (search-forward "" nil t) (replace-match "-")))) |
| 1248 | 1247 | ||
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index bdf6d852a95..3daab8a1e8d 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -634,9 +634,6 @@ for use at QPOS." | |||
| 634 | (let ((qstr (funcall qfun completion))) | 634 | (let ((qstr (funcall qfun completion))) |
| 635 | (cons qstr (length qstr)))))) | 635 | (cons qstr (length qstr)))))) |
| 636 | 636 | ||
| 637 | (defun completion--string-equal-p (s1 s2) | ||
| 638 | (eq t (compare-strings s1 nil nil s2 nil nil 'ignore-case))) | ||
| 639 | |||
| 640 | (defun completion--twq-all (string ustring completions boundary | 637 | (defun completion--twq-all (string ustring completions boundary |
| 641 | _unquote requote) | 638 | _unquote requote) |
| 642 | (when completions | 639 | (when completions |
| @@ -650,7 +647,7 @@ for use at QPOS." | |||
| 650 | (qfullprefix (substring string 0 qfullpos)) | 647 | (qfullprefix (substring string 0 qfullpos)) |
| 651 | ;; FIXME: This assertion can be wrong, e.g. in Cygwin, where | 648 | ;; FIXME: This assertion can be wrong, e.g. in Cygwin, where |
| 652 | ;; (unquote "c:\bin") => "/usr/bin" but (unquote "c:\") => "/". | 649 | ;; (unquote "c:\bin") => "/usr/bin" but (unquote "c:\") => "/". |
| 653 | ;;(cl-assert (completion--string-equal-p | 650 | ;;(cl-assert (string-equal-ignore-case |
| 654 | ;; (funcall unquote qfullprefix) | 651 | ;; (funcall unquote qfullprefix) |
| 655 | ;; (concat (substring ustring 0 boundary) prefix)) | 652 | ;; (concat (substring ustring 0 boundary) prefix)) |
| 656 | ;; t)) | 653 | ;; t)) |
| @@ -688,7 +685,7 @@ for use at QPOS." | |||
| 688 | (let* ((rest (substring completion | 685 | (let* ((rest (substring completion |
| 689 | 0 (length prefix))) | 686 | 0 (length prefix))) |
| 690 | (qrest (funcall qfun rest))) | 687 | (qrest (funcall qfun rest))) |
| 691 | (if (completion--string-equal-p qprefix qrest) | 688 | (if (string-equal-ignore-case qprefix qrest) |
| 692 | (propertize qrest 'face | 689 | (propertize qrest 'face |
| 693 | 'completions-common-part) | 690 | 'completions-common-part) |
| 694 | qprefix)))) | 691 | qprefix)))) |
| @@ -696,7 +693,7 @@ for use at QPOS." | |||
| 696 | ;; FIXME: Similarly here, Cygwin's mapping trips this | 693 | ;; FIXME: Similarly here, Cygwin's mapping trips this |
| 697 | ;; assertion. | 694 | ;; assertion. |
| 698 | ;;(cl-assert | 695 | ;;(cl-assert |
| 699 | ;; (completion--string-equal-p | 696 | ;; (string-equal-ignore-case |
| 700 | ;; (funcall unquote | 697 | ;; (funcall unquote |
| 701 | ;; (concat (substring string 0 qboundary) | 698 | ;; (concat (substring string 0 qboundary) |
| 702 | ;; qcompletion)) | 699 | ;; qcompletion)) |
| @@ -1309,10 +1306,8 @@ when the buffer's text is already an exact match." | |||
| 1309 | ;; for appearance, the string is rewritten if the case changes. | 1306 | ;; for appearance, the string is rewritten if the case changes. |
| 1310 | (let* ((comp-pos (cdr comp)) | 1307 | (let* ((comp-pos (cdr comp)) |
| 1311 | (completion (car comp)) | 1308 | (completion (car comp)) |
| 1312 | (completed (not (eq t (compare-strings completion nil nil | 1309 | (completed (not (string-equal-ignore-case completion string))) |
| 1313 | string nil nil t)))) | 1310 | (unchanged (string-equal completion string))) |
| 1314 | (unchanged (eq t (compare-strings completion nil nil | ||
| 1315 | string nil nil nil)))) | ||
| 1316 | (if unchanged | 1311 | (if unchanged |
| 1317 | (goto-char end) | 1312 | (goto-char end) |
| 1318 | ;; Insert in minibuffer the chars we got. | 1313 | ;; Insert in minibuffer the chars we got. |
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index a55aec76bfc..6713208d268 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el | |||
| @@ -981,8 +981,7 @@ The optional NEW-WINDOW argument is not used." | |||
| 981 | ;; quotes in the MAILTO URLs, so we prefer | 981 | ;; quotes in the MAILTO URLs, so we prefer |
| 982 | ;; to leave the URL with its embedded %nn | 982 | ;; to leave the URL with its embedded %nn |
| 983 | ;; encoding intact. | 983 | ;; encoding intact. |
| 984 | (if (eq t (compare-strings url nil 7 | 984 | (if (string-prefix-p "file://" url) |
| 985 | "file://" nil nil)) | ||
| 986 | (url-unhex-string url) | 985 | (url-unhex-string url) |
| 987 | url))))) | 986 | url))))) |
| 988 | 987 | ||
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el index 04af84d2e44..3d159ed38a9 100644 --- a/lisp/org/ob-core.el +++ b/lisp/org/ob-core.el | |||
| @@ -136,8 +136,7 @@ used." | |||
| 136 | :type 'string | 136 | :type 'string |
| 137 | :safe (lambda (v) | 137 | :safe (lambda (v) |
| 138 | (and (stringp v) | 138 | (and (stringp v) |
| 139 | (eq (compare-strings "RESULTS" nil nil v nil nil t) | 139 | (string-equal-ignore-case "RESULTS" v)))) |
| 140 | t)))) | ||
| 141 | 140 | ||
| 142 | (defcustom org-babel-noweb-wrap-start "<<" | 141 | (defcustom org-babel-noweb-wrap-start "<<" |
| 143 | "String used to begin a noweb reference in a code block. | 142 | "String used to begin a noweb reference in a code block. |
| @@ -2435,7 +2434,7 @@ INFO may provide the values of these header arguments (in the | |||
| 2435 | ;; Escape contents from "export" wrap. Wrap | 2434 | ;; Escape contents from "export" wrap. Wrap |
| 2436 | ;; inline results within an export snippet with | 2435 | ;; inline results within an export snippet with |
| 2437 | ;; appropriate value. | 2436 | ;; appropriate value. |
| 2438 | ((eq t (compare-strings type nil nil "export" nil nil t)) | 2437 | ((string-equal-ignore-case type "export") |
| 2439 | (let ((backend (pcase split | 2438 | (let ((backend (pcase split |
| 2440 | (`(,_) "none") | 2439 | (`(,_) "none") |
| 2441 | (`(,_ ,b . ,_) b)))) | 2440 | (`(,_ ,b . ,_) b)))) |
| @@ -2446,14 +2445,14 @@ INFO may provide the values of these header arguments (in the | |||
| 2446 | backend) "@@)}}}"))) | 2445 | backend) "@@)}}}"))) |
| 2447 | ;; Escape contents from "example" wrap. Mark | 2446 | ;; Escape contents from "example" wrap. Mark |
| 2448 | ;; inline results as verbatim. | 2447 | ;; inline results as verbatim. |
| 2449 | ((eq t (compare-strings type nil nil "example" nil nil t)) | 2448 | ((string-equal-ignore-case type "example") |
| 2450 | (funcall wrap | 2449 | (funcall wrap |
| 2451 | opening-line closing-line | 2450 | opening-line closing-line |
| 2452 | nil nil | 2451 | nil nil |
| 2453 | "{{{results(=" "=)}}}")) | 2452 | "{{{results(=" "=)}}}")) |
| 2454 | ;; Escape contents from "src" wrap. Mark | 2453 | ;; Escape contents from "src" wrap. Mark |
| 2455 | ;; inline results as inline source code. | 2454 | ;; inline results as inline source code. |
| 2456 | ((eq t (compare-strings type nil nil "src" nil nil t)) | 2455 | ((string-equal-ignore-case type "src") |
| 2457 | (let ((inline-open | 2456 | (let ((inline-open |
| 2458 | (pcase split | 2457 | (pcase split |
| 2459 | (`(,_) | 2458 | (`(,_) |
diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index a65bf6f677a..085e32d6774 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el | |||
| @@ -934,6 +934,14 @@ Implements `define-error' for older emacsen." | |||
| 934 | (put name 'error-conditions | 934 | (put name 'error-conditions |
| 935 | (copy-sequence (cons name (get 'error 'error-conditions)))))) | 935 | (copy-sequence (cons name (get 'error 'error-conditions)))))) |
| 936 | 936 | ||
| 937 | (unless (fboundp 'string-equal-ignore-case) | ||
| 938 | ;; From Emacs subr.el. | ||
| 939 | (defun string-equal-ignore-case (string1 string2) | ||
| 940 | "Like `string-equal', but case-insensitive. | ||
| 941 | Upper-case and lower-case letters are treated as equal. | ||
| 942 | Unibyte strings are converted to multibyte for comparison." | ||
| 943 | (eq t (compare-strings string1 0 nil string2 0 nil t)))) | ||
| 944 | |||
| 937 | (unless (fboundp 'string-suffix-p) | 945 | (unless (fboundp 'string-suffix-p) |
| 938 | ;; From Emacs subr.el. | 946 | ;; From Emacs subr.el. |
| 939 | (defun string-suffix-p (suffix string &optional ignore-case) | 947 | (defun string-suffix-p (suffix string &optional ignore-case) |
| @@ -1125,10 +1133,8 @@ ELEMENT is the element at point." | |||
| 1125 | (and log | 1133 | (and log |
| 1126 | (let ((drawer (org-element-lineage element '(drawer)))) | 1134 | (let ((drawer (org-element-lineage element '(drawer)))) |
| 1127 | (and drawer | 1135 | (and drawer |
| 1128 | (eq (compare-strings | 1136 | (string-equal-ignore-case |
| 1129 | log nil nil | 1137 | log (org-element-property :drawer-name drawer)))))) |
| 1130 | (org-element-property :drawer-name drawer) nil nil t) | ||
| 1131 | t))))) | ||
| 1132 | nil) | 1138 | nil) |
| 1133 | (t | 1139 | (t |
| 1134 | (cl-case (org-element-type element) | 1140 | (cl-case (org-element-type element) |
diff --git a/lisp/org/org-lint.el b/lisp/org/org-lint.el index 83c2d08a907..6d8cf3f2374 100644 --- a/lisp/org/org-lint.el +++ b/lisp/org/org-lint.el | |||
| @@ -334,10 +334,8 @@ called with one argument, the key used for comparison." | |||
| 334 | ast | 334 | ast |
| 335 | 'node-property | 335 | 'node-property |
| 336 | (lambda (property) | 336 | (lambda (property) |
| 337 | (and (eq (compare-strings "CUSTOM_ID" nil nil | 337 | (and (string-equal-ignore-case |
| 338 | (org-element-property :key property) nil nil | 338 | "CUSTOM_ID" (org-element-property :key property)) |
| 339 | t) | ||
| 340 | t) | ||
| 341 | (org-element-property :value property))) | 339 | (org-element-property :value property))) |
| 342 | (lambda (property _) (org-element-property :begin property)) | 340 | (lambda (property _) (org-element-property :begin property)) |
| 343 | (lambda (key) (format "Duplicate CUSTOM_ID property \"%s\"" key)))) | 341 | (lambda (key) (format "Duplicate CUSTOM_ID property \"%s\"" key)))) |
diff --git a/lisp/org/ox.el b/lisp/org/ox.el index 55258bc79da..1bdf4dead89 100644 --- a/lisp/org/ox.el +++ b/lisp/org/ox.el | |||
| @@ -80,6 +80,7 @@ | |||
| 80 | (require 'org-element) | 80 | (require 'org-element) |
| 81 | (require 'org-macro) | 81 | (require 'org-macro) |
| 82 | (require 'tabulated-list) | 82 | (require 'tabulated-list) |
| 83 | (require 'subr-x) | ||
| 83 | 84 | ||
| 84 | (declare-function org-src-coderef-format "org-src" (&optional element)) | 85 | (declare-function org-src-coderef-format "org-src" (&optional element)) |
| 85 | (declare-function org-src-coderef-regexp "org-src" (fmt &optional label)) | 86 | (declare-function org-src-coderef-regexp "org-src" (fmt &optional label)) |
| @@ -4436,15 +4437,12 @@ INFO is a plist used as a communication channel. | |||
| 4436 | 4437 | ||
| 4437 | Return value can be a radio-target object or nil. Assume LINK | 4438 | Return value can be a radio-target object or nil. Assume LINK |
| 4438 | has type \"radio\"." | 4439 | has type \"radio\"." |
| 4439 | (let ((path (replace-regexp-in-string | 4440 | (let ((path (string-clean-whitespace (org-element-property :path link)))) |
| 4440 | "[ \r\t\n]+" " " (org-element-property :path link)))) | ||
| 4441 | (org-element-map (plist-get info :parse-tree) 'radio-target | 4441 | (org-element-map (plist-get info :parse-tree) 'radio-target |
| 4442 | (lambda (radio) | 4442 | (lambda (radio) |
| 4443 | (and (eq (compare-strings | 4443 | (and (string-equal-ignore-case |
| 4444 | (replace-regexp-in-string | 4444 | (string-clean-whitespace (org-element-property :value radio)) |
| 4445 | "[ \r\t\n]+" " " (org-element-property :value radio)) | 4445 | path) |
| 4446 | nil nil path nil nil t) | ||
| 4447 | t) | ||
| 4448 | radio)) | 4446 | radio)) |
| 4449 | info 'first-match))) | 4447 | info 'first-match))) |
| 4450 | 4448 | ||
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el index 4ab16831bc1..249ae9dff2f 100644 --- a/lisp/progmodes/flymake-proc.el +++ b/lisp/progmodes/flymake-proc.el | |||
| @@ -399,10 +399,7 @@ instead of reading master file from disk." | |||
| 399 | (not (string-match (format "\\.%s\\'" source-file-extension) | 399 | (not (string-match (format "\\.%s\\'" source-file-extension) |
| 400 | inc-name)) | 400 | inc-name)) |
| 401 | (setq inc-name (concat inc-name "." source-file-extension))) | 401 | (setq inc-name (concat inc-name "." source-file-extension))) |
| 402 | (when (eq t (compare-strings | 402 | (when (string-suffix-p source-file-nondir inc-name) |
| 403 | source-file-nondir nil nil | ||
| 404 | inc-name (- (length inc-name) | ||
| 405 | (length source-file-nondir)) nil)) | ||
| 406 | (flymake-log 3 "inc-name=%s" inc-name) | 403 | (flymake-log 3 "inc-name=%s" inc-name) |
| 407 | (when (flymake-proc--check-include source-file-name inc-name | 404 | (when (flymake-proc--check-include source-file-name inc-name |
| 408 | include-dirs) | 405 | include-dirs) |
diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index a2061fde762..b3dc3cac763 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el | |||
| @@ -7528,7 +7528,7 @@ associated TAG, if any." | |||
| 7528 | (setq cl (pop sclasses)) | 7528 | (setq cl (pop sclasses)) |
| 7529 | (let ((tags (idlwave-class-tags cl))) | 7529 | (let ((tags (idlwave-class-tags cl))) |
| 7530 | (while tags | 7530 | (while tags |
| 7531 | (if (eq t (compare-strings tag 0 nil (car tags) 0 nil t)) | 7531 | (if (string-equal-ignore-case tag (car tags)) |
| 7532 | (throw 'exit cl)) | 7532 | (throw 'exit cl)) |
| 7533 | (setq tags (cdr tags)))))))) | 7533 | (setq tags (cdr tags)))))))) |
| 7534 | 7534 | ||
diff --git a/lisp/subr.el b/lisp/subr.el index a0ad967533d..c82b33bba53 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -868,7 +868,7 @@ Non-strings in LIST are ignored." | |||
| 868 | (declare (side-effect-free t)) | 868 | (declare (side-effect-free t)) |
| 869 | (while (and list | 869 | (while (and list |
| 870 | (not (and (stringp (car list)) | 870 | (not (and (stringp (car list)) |
| 871 | (eq t (compare-strings elt 0 nil (car list) 0 nil t))))) | 871 | (string-equal-ignore-case elt (car list))))) |
| 872 | (setq list (cdr list))) | 872 | (setq list (cdr list))) |
| 873 | list) | 873 | list) |
| 874 | 874 | ||
| @@ -5302,6 +5302,12 @@ and replace a sub-expression, e.g. | |||
| 5302 | (setq matches (cons (substring string start l) matches)) ; leftover | 5302 | (setq matches (cons (substring string start l) matches)) ; leftover |
| 5303 | (apply #'concat (nreverse matches))))) | 5303 | (apply #'concat (nreverse matches))))) |
| 5304 | 5304 | ||
| 5305 | (defun string-equal-ignore-case (string1 string2) | ||
| 5306 | "Like `string-equal', but case-insensitive. | ||
| 5307 | Upper-case and lower-case letters are treated as equal. | ||
| 5308 | Unibyte strings are converted to multibyte for comparison." | ||
| 5309 | (eq t (compare-strings string1 0 nil string2 0 nil t))) | ||
| 5310 | |||
| 5305 | (defun string-prefix-p (prefix string &optional ignore-case) | 5311 | (defun string-prefix-p (prefix string &optional ignore-case) |
| 5306 | "Return non-nil if PREFIX is a prefix of STRING. | 5312 | "Return non-nil if PREFIX is a prefix of STRING. |
| 5307 | If IGNORE-CASE is non-nil, the comparison is done without paying attention | 5313 | If IGNORE-CASE is non-nil, the comparison is done without paying attention |
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index 333cfa51695..64cb0dc0fe6 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el | |||
| @@ -2213,10 +2213,6 @@ Point must be at beginning of preamble. Do not move point." | |||
| 2213 | 2213 | ||
| 2214 | ;; Helper Functions | 2214 | ;; Helper Functions |
| 2215 | 2215 | ||
| 2216 | (defsubst bibtex-string= (str1 str2) | ||
| 2217 | "Return t if STR1 and STR2 are equal, ignoring case." | ||
| 2218 | (eq t (compare-strings str1 0 nil str2 0 nil t))) | ||
| 2219 | |||
| 2220 | (defun bibtex-delete-whitespace () | 2216 | (defun bibtex-delete-whitespace () |
| 2221 | "Delete all whitespace starting at point." | 2217 | "Delete all whitespace starting at point." |
| 2222 | (if (looking-at "[ \t\n]+") | 2218 | (if (looking-at "[ \t\n]+") |
| @@ -2657,7 +2653,7 @@ Formats current entry according to variable `bibtex-entry-format'." | |||
| 2657 | 2653 | ||
| 2658 | ;; update page dashes | 2654 | ;; update page dashes |
| 2659 | (if (and (memq 'page-dashes format) | 2655 | (if (and (memq 'page-dashes format) |
| 2660 | (bibtex-string= field-name "pages") | 2656 | (string-equal-ignore-case field-name "pages") |
| 2661 | (progn (goto-char beg-text) | 2657 | (progn (goto-char beg-text) |
| 2662 | (looking-at | 2658 | (looking-at |
| 2663 | "\\([\"{][0-9]+\\)[ \t\n]*--?[ \t\n]*\\([0-9]+[\"}]\\)"))) | 2659 | "\\([\"{][0-9]+\\)[ \t\n]*--?[ \t\n]*\\([0-9]+[\"}]\\)"))) |
| @@ -2710,7 +2706,7 @@ Formats current entry according to variable `bibtex-entry-format'." | |||
| 2710 | ;; use book title of crossref'd entry | 2706 | ;; use book title of crossref'd entry |
| 2711 | (if (and (memq 'inherit-booktitle format) | 2707 | (if (and (memq 'inherit-booktitle format) |
| 2712 | empty-field | 2708 | empty-field |
| 2713 | (bibtex-string= field-name "booktitle") | 2709 | (string-equal-ignore-case field-name "booktitle") |
| 2714 | crossref-key) | 2710 | crossref-key) |
| 2715 | (let ((title (save-excursion | 2711 | (let ((title (save-excursion |
| 2716 | (save-restriction | 2712 | (save-restriction |
| @@ -3503,7 +3499,7 @@ If NO-BUTTON is non-nil do not generate buttons." | |||
| 3503 | (let ((lst bibtex-generate-url-list) url) | 3499 | (let ((lst bibtex-generate-url-list) url) |
| 3504 | (while (and (not found) (setq url (car (pop lst)))) | 3500 | (while (and (not found) (setq url (car (pop lst)))) |
| 3505 | (goto-char start) | 3501 | (goto-char start) |
| 3506 | (setq found (and (bibtex-string= name (car url)) | 3502 | (setq found (and (string-equal-ignore-case name (car url)) |
| 3507 | (re-search-forward (cdr url) end t)))))) | 3503 | (re-search-forward (cdr url) end t)))))) |
| 3508 | (unless found (goto-char end))) | 3504 | (unless found (goto-char end))) |
| 3509 | (if (and found (not no-button)) | 3505 | (if (and found (not no-button)) |
| @@ -3954,7 +3950,7 @@ entry (for example, the year parts of the keys)." | |||
| 3954 | (goto-char (1- (match-beginning 0))) | 3950 | (goto-char (1- (match-beginning 0))) |
| 3955 | (bibtex-beginning-of-entry) | 3951 | (bibtex-beginning-of-entry) |
| 3956 | (if (and (looking-at bibtex-entry-head) | 3952 | (if (and (looking-at bibtex-entry-head) |
| 3957 | (bibtex-string= type (bibtex-type-in-head)) | 3953 | (string-equal-ignore-case type (bibtex-type-in-head)) |
| 3958 | ;; In case we found ourselves :-( | 3954 | ;; In case we found ourselves :-( |
| 3959 | (not (equal key (setq tmp (bibtex-key-in-head))))) | 3955 | (not (equal key (setq tmp (bibtex-key-in-head))))) |
| 3960 | (setq other-key tmp | 3956 | (setq other-key tmp |
| @@ -3963,7 +3959,7 @@ entry (for example, the year parts of the keys)." | |||
| 3963 | (bibtex-end-of-entry) | 3959 | (bibtex-end-of-entry) |
| 3964 | (bibtex-skip-to-valid-entry) | 3960 | (bibtex-skip-to-valid-entry) |
| 3965 | (if (and (looking-at bibtex-entry-head) | 3961 | (if (and (looking-at bibtex-entry-head) |
| 3966 | (bibtex-string= type (bibtex-type-in-head)) | 3962 | (string-equal-ignore-case type (bibtex-type-in-head)) |
| 3967 | ;; In case we found ourselves :-( | 3963 | ;; In case we found ourselves :-( |
| 3968 | (not (equal key (setq tmp (bibtex-key-in-head)))) | 3964 | (not (equal key (setq tmp (bibtex-key-in-head)))) |
| 3969 | (or (not other-key) | 3965 | (or (not other-key) |
| @@ -4004,9 +4000,9 @@ interactive calls." | |||
| 4004 | (interactive (list nil t)) | 4000 | (interactive (list nil t)) |
| 4005 | (unless field (setq field (car (bibtex-find-text-internal nil nil comma)))) | 4001 | (unless field (setq field (car (bibtex-find-text-internal nil nil comma)))) |
| 4006 | (if (string-search "@" field) | 4002 | (if (string-search "@" field) |
| 4007 | (cond ((bibtex-string= field "@string") | 4003 | (cond ((string-equal-ignore-case field "@string") |
| 4008 | (message "String definition")) | 4004 | (message "String definition")) |
| 4009 | ((bibtex-string= field "@preamble") | 4005 | ((string-equal-ignore-case field "@preamble") |
| 4010 | (message "Preamble definition")) | 4006 | (message "Preamble definition")) |
| 4011 | (t (message "Entry key"))) | 4007 | (t (message "Entry key"))) |
| 4012 | (let* ((case-fold-search t) | 4008 | (let* ((case-fold-search t) |
| @@ -4588,7 +4584,7 @@ Return t if test was successful, nil otherwise." | |||
| 4588 | bounds field idx) | 4584 | bounds field idx) |
| 4589 | (while (setq bounds (bibtex-parse-field)) | 4585 | (while (setq bounds (bibtex-parse-field)) |
| 4590 | (let ((field-name (bibtex-name-in-field bounds))) | 4586 | (let ((field-name (bibtex-name-in-field bounds))) |
| 4591 | (if (and (bibtex-string= field-name "month") | 4587 | (if (and (string-equal-ignore-case field-name "month") |
| 4592 | ;; Check only abbreviated month fields. | 4588 | ;; Check only abbreviated month fields. |
| 4593 | (let ((month (bibtex-text-in-field-bounds bounds))) | 4589 | (let ((month (bibtex-text-in-field-bounds bounds))) |
| 4594 | (not (or (string-match "\\`[\"{].+[\"}]\\'" month) | 4590 | (not (or (string-match "\\`[\"{].+[\"}]\\'" month) |
| @@ -4669,7 +4665,7 @@ Return t if test was successful, nil otherwise." | |||
| 4669 | (while (re-search-forward bibtex-entry-head nil t) | 4665 | (while (re-search-forward bibtex-entry-head nil t) |
| 4670 | (setq entry-type (bibtex-type-in-head) | 4666 | (setq entry-type (bibtex-type-in-head) |
| 4671 | key (bibtex-key-in-head)) | 4667 | key (bibtex-key-in-head)) |
| 4672 | (if (or (and strings (bibtex-string= entry-type "string")) | 4668 | (if (or (and strings (string-equal-ignore-case entry-type "string")) |
| 4673 | (assoc-string entry-type bibtex-entry-alist t)) | 4669 | (assoc-string entry-type bibtex-entry-alist t)) |
| 4674 | (if (member key key-list) | 4670 | (if (member key key-list) |
| 4675 | (push (format-message | 4671 | (push (format-message |
| @@ -5046,10 +5042,10 @@ At end of the cleaning process, the functions in | |||
| 5046 | (user-error "Not inside a BibTeX entry"))) | 5042 | (user-error "Not inside a BibTeX entry"))) |
| 5047 | (entry-type (bibtex-type-in-head)) | 5043 | (entry-type (bibtex-type-in-head)) |
| 5048 | (key (bibtex-key-in-head))) | 5044 | (key (bibtex-key-in-head))) |
| 5049 | (cond ((bibtex-string= entry-type "preamble") | 5045 | (cond ((string-equal-ignore-case entry-type "preamble") |
| 5050 | ;; (bibtex-format-preamble) | 5046 | ;; (bibtex-format-preamble) |
| 5051 | (user-error "No clean up of @Preamble entries")) | 5047 | (user-error "No clean up of @Preamble entries")) |
| 5052 | ((bibtex-string= entry-type "string") | 5048 | ((string-equal-ignore-case entry-type "string") |
| 5053 | (setq entry-type 'string)) | 5049 | (setq entry-type 'string)) |
| 5054 | ;; (bibtex-format-string) | 5050 | ;; (bibtex-format-string) |
| 5055 | (t (bibtex-format-entry))) | 5051 | (t (bibtex-format-entry))) |
| @@ -5326,10 +5322,10 @@ entries from minibuffer." | |||
| 5326 | (>= pnt (bibtex-start-of-text-in-field bounds)) | 5322 | (>= pnt (bibtex-start-of-text-in-field bounds)) |
| 5327 | (<= pnt (bibtex-end-of-text-in-field bounds))) | 5323 | (<= pnt (bibtex-end-of-text-in-field bounds))) |
| 5328 | (setq name (bibtex-name-in-field bounds t) | 5324 | (setq name (bibtex-name-in-field bounds t) |
| 5329 | compl (cond ((bibtex-string= name "crossref") | 5325 | compl (cond ((string-equal-ignore-case name "crossref") |
| 5330 | ;; point is in crossref field | 5326 | ;; point is in crossref field |
| 5331 | 'crossref-key) | 5327 | 'crossref-key) |
| 5332 | ((bibtex-string= name "month") | 5328 | ((string-equal-ignore-case name "month") |
| 5333 | ;; point is in month field | 5329 | ;; point is in month field |
| 5334 | bibtex-predefined-month-strings) | 5330 | bibtex-predefined-month-strings) |
| 5335 | ;; point is in other field | 5331 | ;; point is in other field |
| @@ -5488,7 +5484,7 @@ Return the URL or nil if none can be generated." | |||
| 5488 | (while (and (not url) (setq scheme (pop lst))) | 5484 | (while (and (not url) (setq scheme (pop lst))) |
| 5489 | ;; Verify the match of `bibtex-font-lock-url' by | 5485 | ;; Verify the match of `bibtex-font-lock-url' by |
| 5490 | ;; comparing with TEXT. | 5486 | ;; comparing with TEXT. |
| 5491 | (when (and (bibtex-string= (caar scheme) name) | 5487 | (when (and (string-equal-ignore-case (caar scheme) name) |
| 5492 | (string-match (cdar scheme) text)) | 5488 | (string-match (cdar scheme) text)) |
| 5493 | (setq url t scheme (cdr scheme))))))) | 5489 | (setq url t scheme (cdr scheme))))))) |
| 5494 | 5490 | ||
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 8f9b603ef5f..ba0a94b4a1f 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el | |||
| @@ -1536,8 +1536,7 @@ not the case, the first tag returned is the one inside which we are." | |||
| 1536 | ;; [ Well, actually it depends, but we don't have the info about | 1536 | ;; [ Well, actually it depends, but we don't have the info about |
| 1537 | ;; when it doesn't and when it does. --Stef ] | 1537 | ;; when it doesn't and when it does. --Stef ] |
| 1538 | (setq ignore nil))) | 1538 | (setq ignore nil))) |
| 1539 | ((eq t (compare-strings (sgml-tag-name tag-info) nil nil | 1539 | ((string-equal-ignore-case (sgml-tag-name tag-info) (car stack)) |
| 1540 | (car stack) nil nil t)) | ||
| 1541 | (setq stack (cdr stack))) | 1540 | (setq stack (cdr stack))) |
| 1542 | (t | 1541 | (t |
| 1543 | ;; The open and close tags don't match. | 1542 | ;; The open and close tags don't match. |
| @@ -1549,9 +1548,8 @@ not the case, the first tag returned is the one inside which we are." | |||
| 1549 | ;; but it's a bad assumption when tags *are* closed but | 1548 | ;; but it's a bad assumption when tags *are* closed but |
| 1550 | ;; not properly nested. | 1549 | ;; not properly nested. |
| 1551 | (while (and (cdr tmp) | 1550 | (while (and (cdr tmp) |
| 1552 | (not (eq t (compare-strings | 1551 | (not (string-equal-ignore-case |
| 1553 | (sgml-tag-name tag-info) nil nil | 1552 | (sgml-tag-name tag-info) (cadr tmp)))) |
| 1554 | (cadr tmp) nil nil t)))) | ||
| 1555 | (setq tmp (cdr tmp))) | 1553 | (setq tmp (cdr tmp))) |
| 1556 | (if (cdr tmp) (setcdr tmp (cddr tmp))))) | 1554 | (if (cdr tmp) (setcdr tmp (cddr tmp))))) |
| 1557 | (message "Unmatched tags <%s> and </%s>" | 1555 | (message "Unmatched tags <%s> and </%s>" |
| @@ -1701,9 +1699,8 @@ LCON is the lexical context, if any." | |||
| 1701 | (there (point))) | 1699 | (there (point))) |
| 1702 | ;; Ignore previous unclosed start-tag in context. | 1700 | ;; Ignore previous unclosed start-tag in context. |
| 1703 | (while (and context unclosed | 1701 | (while (and context unclosed |
| 1704 | (eq t (compare-strings | 1702 | (string-equal-ignore-case |
| 1705 | (sgml-tag-name (car context)) nil nil | 1703 | (sgml-tag-name (car context)) unclosed)) |
| 1706 | unclosed nil nil t))) | ||
| 1707 | (setq context (cdr context))) | 1704 | (setq context (cdr context))) |
| 1708 | ;; Indent to reflect nesting. | 1705 | ;; Indent to reflect nesting. |
| 1709 | (cond | 1706 | (cond |
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el index f50d45217c7..e2a490092b5 100644 --- a/lisp/vc/vc-dispatcher.el +++ b/lisp/vc/vc-dispatcher.el | |||
| @@ -761,8 +761,7 @@ the buffer contents as a comment." | |||
| 761 | ;; (while (and (not member) fileset) | 761 | ;; (while (and (not member) fileset) |
| 762 | ;; (let ((elem (pop fileset))) | 762 | ;; (let ((elem (pop fileset))) |
| 763 | ;; (if (if (file-directory-p elem) | 763 | ;; (if (if (file-directory-p elem) |
| 764 | ;; (eq t (compare-strings buffer-file-name nil (length elem) | 764 | ;; (string-prefix-p elem buffer-file-name) |
| 765 | ;; elem nil nil)) | ||
| 766 | ;; (eq (current-buffer) (get-file-buffer elem))) | 765 | ;; (eq (current-buffer) (get-file-buffer elem))) |
| 767 | ;; (setq member t)))) | 766 | ;; (setq member t)))) |
| 768 | ;; member)) | 767 | ;; member)) |
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 84f3e41148d..d45f409e85b 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el | |||
| @@ -368,6 +368,13 @@ | |||
| 368 | 2))) | 368 | 2))) |
| 369 | 369 | ||
| 370 | (ert-deftest string-comparison-test () | 370 | (ert-deftest string-comparison-test () |
| 371 | (should (string-equal-ignore-case "abc" "abc")) | ||
| 372 | (should (string-equal-ignore-case "abc" "ABC")) | ||
| 373 | (should (string-equal-ignore-case "abc" "abC")) | ||
| 374 | (should-not (string-equal-ignore-case "abc" "abCD")) | ||
| 375 | (should (string-equal-ignore-case "S" "s")) | ||
| 376 | ;; not yet: (should (string-equal-ignore-case "SS" "ß")) | ||
| 377 | |||
| 371 | (should (string-lessp "abc" "acb")) | 378 | (should (string-lessp "abc" "acb")) |
| 372 | (should (string-lessp "aBc" "abc")) | 379 | (should (string-lessp "aBc" "abc")) |
| 373 | (should (string-lessp "abc" "abcd")) | 380 | (should (string-lessp "abc" "abcd")) |