Function: insert-directory-wildcard-in-dir-p

insert-directory-wildcard-in-dir-p is a byte-compiled function defined in files.el.gz.

Signature

(insert-directory-wildcard-in-dir-p DIR)

Documentation

Return non-nil if DIR contents a shell wildcard in the directory part.

The return value is a cons (DIR . WILDCARDS); DIR is the default-directory in the Dired buffer, and WILDCARDS are the wildcards.

Valid wildcards are *, ?, [abc] and [a-z].

Source Code

;; Defined in /usr/src/emacs/lisp/files.el.gz
(defun insert-directory-wildcard-in-dir-p (dir)
  "Return non-nil if DIR contents a shell wildcard in the directory part.
The return value is a cons (DIR . WILDCARDS); DIR is the
`default-directory' in the Dired buffer, and WILDCARDS are the wildcards.

Valid wildcards are `*', `?', `[abc]' and `[a-z]'."
  (let ((wildcards "[?*"))
    (when (and (or (not (featurep 'ls-lisp))
                   ls-lisp-support-shell-wildcards)
               (string-match (concat "[" wildcards "]") (file-name-directory dir))
               (not (file-exists-p dir))) ; Prefer an existing file to wildcards.
      (let ((regexp (format "\\`\\([^%s]*/\\)\\([^%s]*[%s].*\\)"
                            wildcards wildcards wildcards)))
        (string-match regexp dir)
        (cons (match-string 1 dir) (match-string 2 dir))))))