unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: emacs-devel@gnu.org
Cc: Lars Ingebrigtsen <larsi@gnus.org>
Subject: Re: master 85e1719 1/4: Add a new command `mailcap-view-file'
Date: Tue, 01 Jun 2021 20:37:36 +0100	[thread overview]
Message-ID: <8735u1jrzz.fsf@tcd.ie> (raw)
In-Reply-To: <20210601082441.0348220DFE@vcs0.savannah.gnu.org> (Lars Ingebrigtsen's message of "Tue, 1 Jun 2021 04:24:40 -0400 (EDT)")

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	other threads:[~2021-06-01 19:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210601082439.8239.91284@vcs0.savannah.gnu.org>
     [not found] ` <20210601082441.0348220DFE@vcs0.savannah.gnu.org>
2021-06-01 19:37   ` Basil L. Contovounesios [this message]
2021-06-02  5:33     ` master 85e1719 1/4: Add a new command `mailcap-view-file' Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8735u1jrzz.fsf@tcd.ie \
    --to=contovob@tcd.ie \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).