summaryrefslogtreecommitdiff
path: root/lisp/textmodes/bibtex.el
diff options
context:
space:
mode:
authorSam Steingold <sds@gnu.org>2022-07-26 13:47:03 -0400
committerSam Steingold <sds@gnu.org>2022-07-26 13:49:28 -0400
commit70341cab3eb26e2f49bbc13d6bca247ab9403abc (patch)
treefb26eac43aef57c9400769d101a8064ce3b9ec20 /lisp/textmodes/bibtex.el
parent015cf7824ea511180329dabcb67c533661da3fff (diff)
downloademacs-70341cab3eb26e2f49bbc13d6bca247ab9403abc.tar.gz
emacs-70341cab3eb26e2f49bbc13d6bca247ab9403abc.tar.bz2
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'.
Diffstat (limited to 'lisp/textmodes/bibtex.el')
-rw-r--r--lisp/textmodes/bibtex.el32
1 files changed, 14 insertions, 18 deletions
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."
;; Helper Functions
-(defsubst bibtex-string= (str1 str2)
- "Return t if STR1 and STR2 are equal, ignoring case."
- (eq t (compare-strings str1 0 nil str2 0 nil t)))
-
(defun bibtex-delete-whitespace ()
"Delete all whitespace starting at point."
(if (looking-at "[ \t\n]+")
@@ -2657,7 +2653,7 @@ Formats current entry according to variable `bibtex-entry-format'."
;; update page dashes
(if (and (memq 'page-dashes format)
- (bibtex-string= field-name "pages")
+ (string-equal-ignore-case field-name "pages")
(progn (goto-char beg-text)
(looking-at
"\\([\"{][0-9]+\\)[ \t\n]*--?[ \t\n]*\\([0-9]+[\"}]\\)")))
@@ -2710,7 +2706,7 @@ Formats current entry according to variable `bibtex-entry-format'."
;; use book title of crossref'd entry
(if (and (memq 'inherit-booktitle format)
empty-field
- (bibtex-string= field-name "booktitle")
+ (string-equal-ignore-case field-name "booktitle")
crossref-key)
(let ((title (save-excursion
(save-restriction
@@ -3503,7 +3499,7 @@ If NO-BUTTON is non-nil do not generate buttons."
(let ((lst bibtex-generate-url-list) url)
(while (and (not found) (setq url (car (pop lst))))
(goto-char start)
- (setq found (and (bibtex-string= name (car url))
+ (setq found (and (string-equal-ignore-case name (car url))
(re-search-forward (cdr url) end t))))))
(unless found (goto-char end)))
(if (and found (not no-button))
@@ -3954,7 +3950,7 @@ entry (for example, the year parts of the keys)."
(goto-char (1- (match-beginning 0)))
(bibtex-beginning-of-entry)
(if (and (looking-at bibtex-entry-head)
- (bibtex-string= type (bibtex-type-in-head))
+ (string-equal-ignore-case type (bibtex-type-in-head))
;; In case we found ourselves :-(
(not (equal key (setq tmp (bibtex-key-in-head)))))
(setq other-key tmp
@@ -3963,7 +3959,7 @@ entry (for example, the year parts of the keys)."
(bibtex-end-of-entry)
(bibtex-skip-to-valid-entry)
(if (and (looking-at bibtex-entry-head)
- (bibtex-string= type (bibtex-type-in-head))
+ (string-equal-ignore-case type (bibtex-type-in-head))
;; In case we found ourselves :-(
(not (equal key (setq tmp (bibtex-key-in-head))))
(or (not other-key)
@@ -4004,9 +4000,9 @@ interactive calls."
(interactive (list nil t))
(unless field (setq field (car (bibtex-find-text-internal nil nil comma))))
(if (string-search "@" field)
- (cond ((bibtex-string= field "@string")
+ (cond ((string-equal-ignore-case field "@string")
(message "String definition"))
- ((bibtex-string= field "@preamble")
+ ((string-equal-ignore-case field "@preamble")
(message "Preamble definition"))
(t (message "Entry key")))
(let* ((case-fold-search t)
@@ -4588,7 +4584,7 @@ Return t if test was successful, nil otherwise."
bounds field idx)
(while (setq bounds (bibtex-parse-field))
(let ((field-name (bibtex-name-in-field bounds)))
- (if (and (bibtex-string= field-name "month")
+ (if (and (string-equal-ignore-case field-name "month")
;; Check only abbreviated month fields.
(let ((month (bibtex-text-in-field-bounds bounds)))
(not (or (string-match "\\`[\"{].+[\"}]\\'" month)
@@ -4669,7 +4665,7 @@ Return t if test was successful, nil otherwise."
(while (re-search-forward bibtex-entry-head nil t)
(setq entry-type (bibtex-type-in-head)
key (bibtex-key-in-head))
- (if (or (and strings (bibtex-string= entry-type "string"))
+ (if (or (and strings (string-equal-ignore-case entry-type "string"))
(assoc-string entry-type bibtex-entry-alist t))
(if (member key key-list)
(push (format-message
@@ -5046,10 +5042,10 @@ At end of the cleaning process, the functions in
(user-error "Not inside a BibTeX entry")))
(entry-type (bibtex-type-in-head))
(key (bibtex-key-in-head)))
- (cond ((bibtex-string= entry-type "preamble")
+ (cond ((string-equal-ignore-case entry-type "preamble")
;; (bibtex-format-preamble)
(user-error "No clean up of @Preamble entries"))
- ((bibtex-string= entry-type "string")
+ ((string-equal-ignore-case entry-type "string")
(setq entry-type 'string))
;; (bibtex-format-string)
(t (bibtex-format-entry)))
@@ -5326,10 +5322,10 @@ entries from minibuffer."
(>= pnt (bibtex-start-of-text-in-field bounds))
(<= pnt (bibtex-end-of-text-in-field bounds)))
(setq name (bibtex-name-in-field bounds t)
- compl (cond ((bibtex-string= name "crossref")
+ compl (cond ((string-equal-ignore-case name "crossref")
;; point is in crossref field
'crossref-key)
- ((bibtex-string= name "month")
+ ((string-equal-ignore-case name "month")
;; point is in month field
bibtex-predefined-month-strings)
;; point is in other field
@@ -5488,7 +5484,7 @@ Return the URL or nil if none can be generated."
(while (and (not url) (setq scheme (pop lst)))
;; Verify the match of `bibtex-font-lock-url' by
;; comparing with TEXT.
- (when (and (bibtex-string= (caar scheme) name)
+ (when (and (string-equal-ignore-case (caar scheme) name)
(string-match (cdar scheme) text))
(setq url t scheme (cdr scheme)))))))