Function: hpath:extension-in-list-p

hpath:extension-in-list-p is a byte-compiled function defined in hpath.el.

Signature

(hpath:extension-in-list-p EXTENSION PATH-LIST)

Documentation

Return t if EXTENSION exists in any filename of PATH-LIST.

Otherwise, return nil. EXTENSION may be of any of these forms:
"*.kotl", ".kotl", or "kotl".

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20261030.2317/hpath.el
(defun hpath:extension-in-list-p (extension path-list)
  "Return t if EXTENSION exists in any filename of PATH-LIST.
Otherwise, return nil.  EXTENSION may be of any of these forms:
\"*.kotl\", \".kotl\", or \"kotl\"."
  ;; Normalize extension with a glob prefix
  (setq extension (concat
		   (cond ((string-prefix-p "*." extension)
			  "")
			 ((string-prefix-p "." extension)
			  "*")
			 (t "*."))
		   extension))
  ;; Log any errors from the 'find' file call below to the *Messages* buffer
  ;; but don't display them in the minimbuffer
  (let ((inhibit-message t))
    (condition-case ()
        ;; Set status to 0 if any filename to be grepped ends in .kotl; otherwise, set it to 1
        (eq 0 (shell-command (format "find %s -name '%s' -print -quit 2>/dev/null | grep -q ."
                                     (mapconcat #'prin1-to-string (mapcar #'expand-file-name (mapcar #'hpath:expand path-list)) " ")
                                     extension)))
      (error nil))))