Function: speedbar-extension-list-to-regex

speedbar-extension-list-to-regex is a byte-compiled function defined in speedbar.el.gz.

Signature

(speedbar-extension-list-to-regex EXTLIST)

Documentation

Take EXTLIST, a list of extensions and transform it into regexp.

All the preceding . are stripped for an optimized expression starting with . followed by extensions, followed by full-filenames.

Source Code

;; Defined in /usr/src/emacs/lisp/speedbar.el.gz
(defun speedbar-extension-list-to-regex (extlist)
  "Take EXTLIST, a list of extensions and transform it into regexp.
All the preceding `.' are stripped for an optimized expression starting
with `.' followed by extensions, followed by full-filenames."
  (let ((regex1 nil) (regex2 nil))
    (while extlist
      (if (= (string-to-char (car extlist)) ?.)
	  (setq regex1 (concat regex1 (if regex1 "\\|" "")
			       (substring (car extlist) 1)))
	(setq regex2 (concat regex2 (if regex2 "\\|" "") (car extlist))))
      (setq extlist (cdr extlist)))
    ;; Concatenate all the subexpressions together, making sure all types
    ;; of parts exist during concatenation.
    (concat "\\("
	    (if regex1 (concat "\\(\\.\\(" regex1 "\\)\\)") "")
	    (if (and regex1 regex2) "\\|" "")
	    (if regex2 (concat "\\(" regex2 "\\)") "")
	    "\\)$")))