emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 523a96a99e: Fix some doc strings in textsec.el


From: Lars Ingebrigtsen
Subject: master 523a96a99e: Fix some doc strings in textsec.el
Date: Mon, 17 Jan 2022 10:06:17 -0500 (EST)

branch: master
commit 523a96a99ed7fe21c945b8e1cd0e3a2bc76c4ba0
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix some doc strings in textsec.el
    
    * lisp/international/textsec.el (textsec-single-script-p): Fix
    typo in doc string.
    (textsec-covering-scripts): Improve doc string and sort the results.
---
 lisp/international/textsec.el | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/lisp/international/textsec.el b/lisp/international/textsec.el
index ab17623ec5..884425d492 100644
--- a/lisp/international/textsec.el
+++ b/lisp/international/textsec.el
@@ -48,21 +48,27 @@
 
 Note that the concept of \"single script\" used by this function
 isn't obvious -- some mixtures of scripts count as a \"single
-script\.  See
+script\".  See
 
   https://www.unicode.org/reports/tr39/#Mixed_Script_Detection
 
 for details."
-  (let ((scripts (mapcar (lambda (s)
-                           (append s
-                                   (mapcan (lambda (script)
-                                             (copy-sequence
-                                              (textsec--augment-script 
script)))
-                                           s)))
+  (let ((scripts (mapcar
+                  (lambda (s)
+                    (append s
+                            ;; Some scripts used in East Asia are
+                            ;; commonly used across borders, so we add
+                            ;; those.
+                            (mapcan (lambda (script)
+                                      (copy-sequence
+                                       (textsec--augment-script script)))
+                                    s)))
                          (textsec-scripts string))))
     (catch 'empty
       (cl-loop for s1 in scripts
                do (cl-loop for s2 in scripts
+                           ;; Common/inherited chars can be used in
+                           ;; text with all scripts.
                            when (and (not (memq 'common s1))
                                      (not (memq 'common s2))
                                      (not (memq 'inherited s1))
@@ -83,12 +89,13 @@ for details."
     '(korea))))
 
 (defun textsec-covering-scripts (string)
-  "Return a minimal list of scripts used in STRING."
+  "Return a minimal list of scripts used in STRING.
+Not that a string may have several different minimal cover sets."
   (let* ((scripts (textsec-scripts string))
          (set (car scripts)))
     (dolist (s scripts)
       (setq set (seq-union set (seq-difference s set))))
-    (delq 'common (delq 'inherited set))))
+    (sort (delq 'common (delq 'inherited set)) #'string<)))
 
 (provide 'textsec)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]