From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Spiers Subject: BUG: org-open-file fails with multiple %s in mailcap entry Date: Sat, 22 Dec 2007 12:30:27 +0000 Message-ID: <20071222123027.GJ13112@atlantic.linksys.moosehall> Reply-To: Adam Spiers Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J63Us-00025y-Bc for emacs-orgmode@gnu.org; Sat, 22 Dec 2007 07:30:30 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J63Ur-00024N-Gb for emacs-orgmode@gnu.org; Sat, 22 Dec 2007 07:30:29 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J63Ur-000240-9q for emacs-orgmode@gnu.org; Sat, 22 Dec 2007 07:30:29 -0500 Received: from mail.beimborn.com ([70.84.38.100]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1J63Ur-0003Ox-DF for emacs-orgmode@gnu.org; Sat, 22 Dec 2007 07:30:29 -0500 Received: from mail.beimborn.com (localhost.localdomain [127.0.0.1]) by mail.beimborn.com (8.12.11.20060308/8.12.8) with ESMTP id lBMCUSfJ018357 for ; Sat, 22 Dec 2007 06:30:28 -0600 Received: from localhost (localhost [[UNIX: localhost]]) by mail.beimborn.com (8.12.11.20060308/8.12.11/Submit) id lBMCURbm018352 for emacs-orgmode@gnu.org; Sat, 22 Dec 2007 12:30:27 GMT Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org-mode mailing list 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.