[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat 0de389aca6 19/84: Add string-equal-ignore-case f
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat 0de389aca6 19/84: Add string-equal-ignore-case from Emacs 29 |
Date: |
Tue, 3 Jan 2023 08:57:32 -0500 (EST) |
branch: externals/compat
commit 0de389aca6ce4429933bde15bc5e26f8b387889b
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Add string-equal-ignore-case from Emacs 29
---
compat-29.el | 7 +++++++
compat-tests.el | 21 +++++++++++++++++++++
compat.texi | 9 +++++++++
3 files changed, 37 insertions(+)
diff --git a/compat-29.el b/compat-29.el
index 8b14b23a43..af29d96446 100644
--- a/compat-29.el
+++ b/compat-29.el
@@ -100,6 +100,13 @@ If N is zero or negative, return nil.
If N is greater or equal to the length of LIST, return LIST (or a copy)."
(compat--ntake-elisp n (copy-sequence list))) ;FIXME: only copy as much
as necessary
+(compat-defun string-equal-ignore-case (string1 string2)
+ "Like `string-equal', but case-insensitive.
+Upper-case and lower-case letters are treated as equal.
+Unibyte strings are converted to multibyte for comparison."
+ (declare (pure t) (side-effect-free t))
+ (eq t (compare-strings string1 0 nil string2 0 nil t)))
+
;;;; Defined in subr.el
(compat-defun function-alias-p (func &optional noerror)
diff --git a/compat-tests.el b/compat-tests.el
index 2a334b9b68..2b5c8ba817 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -2030,6 +2030,27 @@ being compared against."
;; (ought t "~root")
;; (ought t "~root/")
;; (ought t "~root/file"))
+(compat-deftests string-equal-ignore-case
+ (ought t "" "")
+ (ought t "a" "a")
+ (ought t "a" "A")
+ (ought t "A" "a")
+ (ought nil "aA" "a")
+ (ought nil "a" "Aa")
+ (ought t "aA" "aA")
+ (ought t "Aa" "Aa")
+ (ought nil "aB" "aA")
+ (ought nil "Ba" "Aa")
+ (ought t "AAA BBB" "AAA BBB")
+ (ought t "aaa BBB" "AAA BBB")
+ (ought t "AAA bbb" "AAA BBB")
+ (ought t "AAA BBB" "aaa BBB")
+ (ought t "AAA BBB" "AAA bbb")
+ (ought t "AAA BBB" "aaa bbb")
+ (ought t "AAA BBB" "aaa bbb")
+ (ought t "AAA bbb" "aaa bbb")
+ (ought t "aaa BBB" "aaa bbb"))
+
(provide 'compat-tests)
;;; compat-tests.el ends here
diff --git a/compat.texi b/compat.texi
index 80077f1bcb..e82badff2a 100644
--- a/compat.texi
+++ b/compat.texi
@@ -2379,6 +2379,15 @@ meaning as with @code{window-text-pixel-size}.
@xref{Size of Displayed Text,,,elisp}.
@end defun
+@c copied from lispref/strings.texi
+@defun string-equal-ignore-case string1 string2
+@code{string-equal-ignore-case} compares strings ignoring case
+differences, like @code{char-equal} when @code{case-fold-search} is
+@code{t}.
+
+@xref{Text Comparison,,,elisp}.
+@end defun
+
- [elpa] externals/compat 933d6fdf80 24/84: Add buffer-match-p from Emacs 29, (continued)
- [elpa] externals/compat 933d6fdf80 24/84: Add buffer-match-p from Emacs 29, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 8d17ffdd88 29/84: Add file-has-changed-p from Emacs 29, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 252d33e897 31/84: Fix incompatible function calls in compat-29, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 9e0eb5b72f 33/84: Add compat-declare-version to compat-29.el, ELPA Syncer, 2023/01/03
- [elpa] externals/compat fdae099b00 34/84: Move if-let and related function from subr-x to subr, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 6ac6ed2a99 36/84: Use make-symbol instead of gensym in function-alias-p tests, ELPA Syncer, 2023/01/03
- [elpa] externals/compat ef5246cf55 38/84: Fix issues related to 'expect' tests, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 0a84a7c219 48/84: Add add-display-text-property from Emacs 29, ELPA Syncer, 2023/01/03
- [elpa] externals/compat e6d279af18 14/84: Extend byte-compile-docstring-max-column to 100, ELPA Syncer, 2023/01/03
- [elpa] externals/compat c177ff5e83 17/84: Reuse ntake in take definition, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 0de389aca6 19/84: Add string-equal-ignore-case from Emacs 29,
ELPA Syncer <=
- [elpa] externals/compat ff331f6c29 22/84: Add prefixed plist-put from Emacs 29, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 9aac0f55d1 23/84: Add prefixed plist-member from Emacs 29, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 9ab3081959 26/84: Add string-pixel-width from Emacs 29, ELPA Syncer, 2023/01/03
- [elpa] externals/compat d375504e3c 27/84: Add with-buffer-unmodified-if-unchanged from Emacs 29, ELPA Syncer, 2023/01/03
- [elpa] externals/compat ded0f01036 40/84: Revert "Fix gv-expander for compat-alist-get", ELPA Syncer, 2023/01/03
- [elpa] externals/compat 878221eabd 44/84: Update the commentary section for compat-29, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 4a56adbcdf 42/84: Remove references to the deleted "Emacs 24.5" node, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 0c14c42bc1 50/84: Copy edebug specifications instead of referencing, ELPA Syncer, 2023/01/03
- [elpa] externals/compat b888c2fb49 53/84: Replace when-let with expansions in compat-29, ELPA Syncer, 2023/01/03
- [elpa] externals/compat 59cd42a912 60/84: Generate test names without double-dashes, ELPA Syncer, 2023/01/03