[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 90ec9bb83e 2/2: restore and obsolete `gnus-string-equal' and `bib
From: |
Sam Steingold |
Subject: |
master 90ec9bb83e 2/2: restore and obsolete `gnus-string-equal' and `bibtex-string=' |
Date: |
Tue, 26 Jul 2022 14:08:55 -0400 (EDT) |
branch: master
commit 90ec9bb83e213712e2170e7f2ed69f11d925919b
Author: Sam Steingold <sds@gnu.org>
Commit: Sam Steingold <sds@gnu.org>
restore and obsolete `gnus-string-equal' and `bibtex-string='
* lisp/gnus/gnus-util.el (gnus-string-equal): Restore and declare obsolete.
* lisp/textmodes/bibtex.el (bibtex-string=): Likewise.
---
lisp/gnus/gnus-util.el | 10 ++++++++++
lisp/textmodes/bibtex.el | 5 +++++
2 files changed, 15 insertions(+)
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index 31a275c7d0..dda2b4ff5f 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -1073,6 +1073,16 @@ ARG is passed to the first function."
s)
(error string)))
+;; This might use `compare-strings' to reduce consing in the
+;; case-insensitive case, but it has to cope with null args.
+;; (`string-equal' uses symbol print names.)
+(defun gnus-string-equal (x y)
+ "Like `string-equal', except it compares case-insensitively."
+ (declare (obsolete string-equal-ignore-case "29.1"))
+ (and (= (length x) (length y))
+ (or (string-equal x y)
+ (string-equal (downcase x) (downcase y)))))
+
(defcustom gnus-use-byte-compile t
"If non-nil, byte-compile crucial run-time code."
:type 'boolean
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 64cb0dc0fe..8135d40d26 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -2213,6 +2213,11 @@ 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."
+ (declare (obsolete string-equal-ignore-case "29.1"))
+ (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]+")