Function: c-make-bare-char-alt
c-make-bare-char-alt is a byte-compiled function defined in
cc-defs.el.gz.
Signature
(c-make-bare-char-alt CHARS &optional INVERTED)
Documentation
Make a character alternative string from the list of characters CHARS.
The returned string is of the type that can be used with
skip-chars-forward and skip-chars-backward. If INVERTED is
non-nil, a caret is prepended to invert the set.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-defs.el.gz
(defun c-make-bare-char-alt (chars &optional inverted)
"Make a character alternative string from the list of characters CHARS.
The returned string is of the type that can be used with
`skip-chars-forward' and `skip-chars-backward'. If INVERTED is
non-nil, a caret is prepended to invert the set."
;; This function ought to be in the elisp core somewhere.
(let ((str (if inverted "^" "")) char char2)
(setq chars (sort (append chars nil) #'<))
(while chars
(setq char (pop chars))
(if (memq char '(?\\ ?^ ?-))
;; Quoting necessary (this method only works in the skip
;; functions).
(setq str (format "%s\\%c" str char))
(setq str (format "%s%c" str char)))
;; Check for range.
(setq char2 char)
(while (and chars (>= (1+ char2) (car chars)))
(setq char2 (pop chars)))
(unless (= char char2)
(if (< (1+ char) char2)
(setq str (format "%s-%c" str char2))
(push char2 chars))))
str))