emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Adam Spiers <orgmode@adamspiers.org>
To: org-mode mailing list <emacs-orgmode@gnu.org>
Subject: BUG: org-open-file fails with multiple %s in mailcap entry
Date: Sat, 22 Dec 2007 12:30:27 +0000	[thread overview]
Message-ID: <20071222123027.GJ13112@atlantic.linksys.moosehall> (raw)

The use of format in org-open-file assumes that there will only ever
be a single '%s' in a mailcap entry:

    (cond
     ((and (stringp cmd) (not (string-match "^\\s-*$" cmd)))
      ;; Remove quotes around the file name - we'll use
     shell-quote-argument.
      (if (string-match "['\"]%s['\"]" cmd)
        (setq cmd (replace-match "%s" t t cmd)))
      (setq cmd (format cmd (shell-quote-argument file)))

However this is not necessarily the case, e.g. I have

text/html; mailcap_bg %s url_handler.sh "@s" || logger "url_handler.sh failed on %s"; test=test -n "$DISPLAY" && mailcap_test %s firefox; nametemplate=%s.html
text/html; w3m -T text/html -dump %s || lynx -dump %s || links -dump %s; copiousoutput; nametemplate=%s.html; description=HTML text

The mailcap(4) man page doesn't explicitly say whether multiple %s is
allowed or not, but it has always worked for me.  The 

  w3m || lynx || links

example above is a particularly common use case, AFAIK.

             reply	other threads:[~2007-12-22 12:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-22 12:30 Adam Spiers [this message]
2008-01-03 12:33 ` BUG: org-open-file fails with multiple %s in mailcap entry Carsten Dominik
2008-01-03 12:41   ` Adam Spiers
2008-01-03 12:51     ` Carsten Dominik

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.orgmode.org/

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

  git send-email \
    --in-reply-to=20071222123027.GJ13112@atlantic.linksys.moosehall \
    --to=orgmode@adamspiers.org \
    --cc=emacs-orgmode@gnu.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/org-mode.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).