emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 85e1719 1/4: Add a new command `mailcap-view-file'


From: Basil L. Contovounesios
Subject: Re: master 85e1719 1/4: Add a new command `mailcap-view-file'
Date: Tue, 01 Jun 2021 20:37:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

larsi@gnus.org (Lars Ingebrigtsen) writes:

> branch: master
> commit 85e17196fa2b6333fbce7fdac1e2e17b045b91ae
> Author: Lars Ingebrigtsen <larsi@gnus.org>
> Commit: Lars Ingebrigtsen <larsi@gnus.org>
>
>     Add a new command `mailcap-view-file'

[...]

> +(defun mailcap-view-file (file)
> +  "View FILE according to rules given by the mailcap system.
> +This normally involves executing some external program to display
> +the file.
> +
> +See \"~/.mailcap\", `mailcap-mime-data' and related files and variables."
> +  (interactive "fOpen file with mailcap: ")
> +  (setq file (expand-file-name file))
> +  (mailcap-parse-mailcaps)
> +  (let ((command (mailcap-mime-info

What if mailcap-mime-info returns a function?

> +                  (mailcap-extension-to-mime (file-name-extension file)))))

Is this the same as mailcap-file-name-to-mime-type?

> +    (unless command
> +      (error "No viewer for %s" (file-name-extension file)))
> +    ;; Remove quotes around the file name - we'll use shell-quote-argument.
> +    (while (string-match "['\"]%s['\"]" command)
> +      (setq command (replace-match "%s" t t command)))
> +    (setq command (replace-regexp-in-string
> +                "%s"
> +                (shell-quote-argument (convert-standard-filename file))
> +                command
> +                nil t))
> +    (start-process-shell-command command nil command)))

Should any of this function's logic be shared with mailcap-view-mime?

Thanks,

-- 
Basil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]