summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-01-17 18:01:59 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2022-01-17 18:01:59 +0100
commit9f902eb808b8c493f99ccf869fb3eb641ab96e7c (patch)
treeb9f59e68c1f93b4f6e2c3edd4e98b7e32c7448de /lisp
parent1c7307673bc20813a58452ad0056b505dcb20a7f (diff)
downloademacs-9f902eb808b8c493f99ccf869fb3eb641ab96e7c.tar.gz
emacs-9f902eb808b8c493f99ccf869fb3eb641ab96e7c.tar.bz2
emacs-9f902eb808b8c493f99ccf869fb3eb641ab96e7c.zip
Change textsec-mixed-numbers-p to use recommended algorithm
* lisp/international/textsec.el (textsec-mixed-numbers-p): New function.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/international/textsec.el25
1 files changed, 13 insertions, 12 deletions
diff --git a/lisp/international/textsec.el b/lisp/international/textsec.el
index 340468828ca..a13d500e082 100644
--- a/lisp/international/textsec.el
+++ b/lisp/international/textsec.el
@@ -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)