* Re: master 85e1719 1/4: Add a new command `mailcap-view-file'
[not found] ` <20210601082441.0348220DFE@vcs0.savannah.gnu.org>
@ 2021-06-01 19:37 ` Basil L. Contovounesios
2021-06-02 5:33 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Basil L. Contovounesios @ 2021-06-01 19:37 UTC (permalink / raw)
To: emacs-devel; +Cc: Lars Ingebrigtsen
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: master 85e1719 1/4: Add a new command `mailcap-view-file'
2021-06-01 19:37 ` master 85e1719 1/4: Add a new command `mailcap-view-file' Basil L. Contovounesios
@ 2021-06-02 5:33 ` Lars Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-02 5:33 UTC (permalink / raw)
To: Basil L. Contovounesios; +Cc: emacs-devel
"Basil L. Contovounesios" <contovob@tcd.ie> writes:
> What if mailcap-mime-info returns a function?
Right; that should be fixed.
>> + (mailcap-extension-to-mime (file-name-extension file)))))
>
> Is this the same as mailcap-file-name-to-mime-type?
Looks like it.
> Should any of this function's logic be shared with mailcap-view-mime?
I think so. By the way, that function looks somewhat unsafe?
(defun mailcap--async-shell (command file)
...
(async-shell-command (format command file) buf)
No quoting of the file name?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-02 5:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20210601082439.8239.91284@vcs0.savannah.gnu.org>
[not found] ` <20210601082441.0348220DFE@vcs0.savannah.gnu.org>
2021-06-01 19:37 ` master 85e1719 1/4: Add a new command `mailcap-view-file' Basil L. Contovounesios
2021-06-02 5:33 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.