Function: semantic-symref-derive-find-filepatterns

semantic-symref-derive-find-filepatterns is a byte-compiled function defined in grep.el.gz.

Signature

(semantic-symref-derive-find-filepatterns &optional MODE)

Documentation

Derive a list of file (glob) patterns for the current buffer.

Looks first in semantic-symref-filepattern-alist. If it is not there, it then looks in auto-mode-alist, and attempts to derive something from that. Optional argument MODE specifies the major-mode to test.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/symref/grep.el.gz
(defun semantic-symref-derive-find-filepatterns (&optional mode)
  ;; FIXME: This should be moved to grep.el, where it could be used
  ;; for "C-u M-x grep" as well.
  "Derive a list of file (glob) patterns for the current buffer.
Looks first in `semantic-symref-filepattern-alist'.  If it is not
there, it then looks in `auto-mode-alist', and attempts to derive something
from that.
Optional argument MODE specifies the `major-mode' to test."
  ;; First, try the filepattern alist.
  (let* ((mode (or mode major-mode))
	 (pat (cdr (assoc mode semantic-symref-filepattern-alist))))
    (when (not pat)
      ;; No hit, try auto-mode-alist.
      (dolist (X auto-mode-alist)
	(when (and (eq (cdr X) mode)
                   ;; Only take in simple patterns, so try to convert this one.
                   (string-match "\\\\\\.\\([^\\'>]+\\)\\\\'" (car X)))
          (push (concat "*." (match-string 1 (car X))) pat))))
    ;; Convert the list into some find-flags.
    (if (null pat)
        (error "Customize `semantic-symref-filepattern-alist' for %S"
               major-mode)
      (let ((args `("-name" ,(car pat))))
        (if (null (cdr pat))
            args
          `("(" ,@args
            ,@(mapcan (lambda (s) `("-o" "-name" ,s)) (cdr pat))
            ")"))))))