From: Lars Ingebrigtsen <larsi@gnus.org>
Date: Wed, 19 Jan 2022 17:50:40 +0000 (+0100)
Subject: Make textsec-mixed-numbers-p actually work
X-Git-Tag: emacs-29.0.90~2932
X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=50ddfb2428496d7f5b8f37d3345fb2fdb88bb6ea;p=emacs.git

Make textsec-mixed-numbers-p actually work

* lisp/international/textsec.el (textsec-mixed-numbers-p): Fix the
test.
---

diff --git a/lisp/international/textsec.el b/lisp/international/textsec.el
index 62885ae15da..bf90afb7c00 100644
--- a/lisp/international/textsec.el
+++ b/lisp/international/textsec.el
@@ -169,7 +169,8 @@ Levels are (in decreasing order of restrictiveness) `ascii-only',
     (seq-uniq
      (mapcar
       (lambda (char)
-        (get-char-code-property char 'numeric-value))
+        ;; Compare zeros in the respective decimal systems.
+        (- char (get-char-code-property char 'numeric-value)))
       (seq-filter (lambda (char)
                     ;; We're selecting the characters that
                     ;; have a numeric property.
diff --git a/test/lisp/international/textsec-tests.el b/test/lisp/international/textsec-tests.el
index 416490aa085..acd77971501 100644
--- a/test/lisp/international/textsec-tests.el
+++ b/test/lisp/international/textsec-tests.el
@@ -84,6 +84,7 @@
 (ert-deftest test-mixed-numbers ()
   (should-not (textsec-mixed-numbers-p "foo"))
   (should-not (textsec-mixed-numbers-p "8foo8"))
+  (should-not (textsec-mixed-numbers-p "foo20@foo.org"))
   (should (textsec-mixed-numbers-p "8foo৪")))
 
 (ert-deftest test-resolved ()