Function: textsec-restriction-level
textsec-restriction-level is a byte-compiled function defined in
textsec.el.gz.
Signature
(textsec-restriction-level STRING)
Documentation
Say what restriction level STRING qualifies for.
Levels are (in decreasing order of restrictiveness) ascii-only,
single-script, highly-restrictive, moderately-restrictive,
minimally-restrictive and unrestricted.
Source Code
;; Defined in /usr/src/emacs/lisp/international/textsec.el.gz
(defun textsec-restriction-level (string)
"Say what restriction level STRING qualifies for.
Levels are (in decreasing order of restrictiveness) `ascii-only',
`single-script', `highly-restrictive', `moderately-restrictive',
`minimally-restrictive' and `unrestricted'."
(let ((scripts (textsec-covering-scripts string)))
(cond
((string-match "\\`[[:ascii:]]+\\'" string)
'ascii-only)
((textsec-single-script-p string)
'single-script)
((or (null (seq-difference scripts '(latin han hiragana katakana)))
(null (seq-difference scripts '(latin han bopomofo)))
(null (seq-difference scripts '(latin han hangul))))
'highly-restrictive)
((and (= (length scripts) 2)
(memq 'latin scripts)
;; This list comes from
;; https://www.unicode.org/reports/tr31/#Table_Recommended_Scripts
;; (but without latin, cyrillic and greek).
(seq-intersection scripts
'(arabic
armenian
bengali
bopomofo
devanagari
ethiopic
georgian
gujarati
gurmukhi
hangul
han
hebrew
hiragana
katakana
kannada
khmer
lao
malayalam
myanmar
oriya
sinhala
tamil
telugu
thaana
thai
tibetan)))
;; The string is covered by Latin and any one other Recommended
;; script, except Cyrillic, Greek.
'moderately-restrictive)
;; Fixme `minimally-restrictive' -- needs well-formedness criteria
;; and Identifier Profile.
(t
'unrestricted))))