From 523a96a99ed7fe21c945b8e1cd0e3a2bc76c4ba0 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 17 Jan 2022 16:06:04 +0100 Subject: [PATCH] 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 ab17623ec52..884425d4922 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) -- 2.39.2