Function: mm-mailcap-command
mm-mailcap-command is a byte-compiled function defined in
mm-decode.el.gz.
Signature
(mm-mailcap-command METHOD FILE TYPE-LIST)
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/mm-decode.el.gz
(defun mm-mailcap-command (method file type-list)
(let ((ctl (cdr type-list))
(beg 0)
(uses-stdin t)
out sub total)
(while (string-match "%{\\([^}]+\\)}\\|'%s'\\|\"%s\"\\|%s\\|%t\\|%%"
method beg)
(push (substring method beg (match-beginning 0)) out)
(setq beg (match-end 0)
total (match-string 0 method)
sub (match-string 1 method))
(cond
((string= total "%%")
(push "%" out))
((or (string= total "%s")
;; We do our own quoting.
(string= total "'%s'")
(string= total "\"%s\""))
(setq uses-stdin nil)
(push (shell-quote-argument
(gnus-map-function mm-path-name-rewrite-functions file))
out))
((string= total "%t")
(push (shell-quote-argument (car type-list)) out))
(t
(push (shell-quote-argument (or (cdr (assq (intern sub) ctl)) "")) out))))
(push (substring method beg (length method)) out)
(when uses-stdin
(push "<" out)
(push (shell-quote-argument
(gnus-map-function mm-path-name-rewrite-functions file))
out))
(mapconcat #'identity (nreverse out) "")))