]> git.eshelyaron.com Git - emacs.git/commitdiff
Change textsec-mixed-numbers-p to use recommended algorithm
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 17 Jan 2022 17:01:59 +0000 (18:01 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 17 Jan 2022 17:01:59 +0000 (18:01 +0100)
* lisp/international/textsec.el (textsec-mixed-numbers-p): New
function.

lisp/international/textsec.el

index 340468828cae8c85fc3acb2eccbd4656153d446f..a13d500e082dba55a76761886d92ea93fec5dc6c 100644 (file)
@@ -154,18 +154,19 @@ Levels are (in order of restrictiveness) `ascii-only',
 
 (defun textsec-mixed-numbers-p (string)
   "Return non-nil if there are numbers from different decimal systems in STRING."
-  (> (length
-      (seq-uniq
-       (textsec-scripts
-        (apply #'string
-               (seq-filter (lambda (char)
-                             ;; We're selecting the characters that
-                             ;; have a numeric property.
-                             (eq (get-char-code-property char 'general-category)
-                                 'Nd))
-                           string)))
-       #'equal))
-     1))
+  (>
+   (length
+    (seq-uniq
+     (mapcar
+      (lambda (char)
+        (get-char-code-property char 'numeric-value))
+      (seq-filter (lambda (char)
+                    ;; We're selecting the characters that
+                    ;; have a numeric property.
+                    (eq (get-char-code-property char 'general-category)
+                        'Nd))
+                  string))))
+   1))
 
 (provide 'textsec)