Function: textsec-suspicious-nonspacing-p
textsec-suspicious-nonspacing-p is a byte-compiled function defined in
textsec.el.gz.
Signature
(textsec-suspicious-nonspacing-p STRING)
Documentation
Say whether STRING uses nonspacing characters in suspicious ways.
If it doesn't, return nil. If it does, return a string explaining the potential problem.
Use of nonspacing characters is considered suspicious if there are two or more consecutive identical nonspacing characters, or too many consecutive nonspacing characters.
Source Code
;; Defined in /usr/src/emacs/lisp/international/textsec.el.gz
(defun textsec-suspicious-nonspacing-p (string)
"Say whether STRING uses nonspacing characters in suspicious ways.
If it doesn't, return nil. If it does, return a string explaining
the potential problem.
Use of nonspacing characters is considered suspicious if there are
two or more consecutive identical nonspacing characters, or too many
consecutive nonspacing characters."
(let ((prev nil)
(nonspace-count 0))
(catch 'found
(seq-do
(lambda (char)
(let ((nonspacing
(memq (get-char-code-property char 'general-category)
'(Mn Me))))
(when (and nonspacing
(equal char prev))
(throw 'found "Two identical consecutive nonspacing characters"))
(setq nonspace-count (if nonspacing
(1+ nonspace-count)
0))
(when (> nonspace-count 4)
(throw 'found
"Too many consecutive nonspacing characters"))
(setq prev char)))
string)
nil)))