Function: ispell--make-\w-expression

ispell--make-\w-expression is a byte-compiled function defined in ispell.el.gz.

Signature

(ispell--make-\\w-expression CHARS)

Documentation

Make a regular expression like "\\(\\w\\|[-_]\\)".

This (parenthesized) expression matches either a character of
"word" syntax or one in CHARS.

CHARS is a string of characters. A member of CHARS is omitted from the expression if it already has word syntax. (Be careful about special characters such as ?\, ?^, ?], and ?- in CHARS.) If after this filtering there are no chars left, or only one, a special form of the expression is generated.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/ispell.el.gz
(defun ispell--make-\\w-expression (chars)
  "Make a regular expression like \"\\(\\w\\|[-_]\\)\".
This (parenthesized) expression matches either a character of
\"word\" syntax or one in CHARS.

CHARS is a string of characters.  A member of CHARS is omitted
from the expression if it already has word syntax.  (Be careful
about special characters such as ?\\, ?^, ?], and ?- in CHARS.)
If after this filtering there are no chars left, or only one, a
special form of the expression is generated."
  (let ((filtered
	 (mapconcat #'ispell--\\w-filter chars "")))
    (concat
     "\\(\\w"
     (cond
      ((equal filtered "")
       "\\)")
      ((eq (length filtered) 1)
       (concat "\\|" filtered "\\)"))
      (t
       (concat "\\|[" filtered "]\\)"))))))