all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* BUG: org-open-file fails with multiple %s in mailcap entry
@ 2007-12-22 12:30 Adam Spiers
  2008-01-03 12:33 ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Adam Spiers @ 2007-12-22 12:30 UTC (permalink / raw)
  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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: BUG: org-open-file fails with multiple %s in mailcap entry
  2007-12-22 12:30 BUG: org-open-file fails with multiple %s in mailcap entry Adam Spiers
@ 2008-01-03 12:33 ` Carsten Dominik
  2008-01-03 12:41   ` Adam Spiers
  0 siblings, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2008-01-03 12:33 UTC (permalink / raw)
  To: Adam Spiers; +Cc: org-mode mailing list

What are you proposing?

- Carsten

On Dec 22, 2007, at 1:30 PM, Adam Spiers wrote:

> 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.
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: BUG: org-open-file fails with multiple %s in mailcap entry
  2008-01-03 12:33 ` Carsten Dominik
@ 2008-01-03 12:41   ` Adam Spiers
  2008-01-03 12:51     ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Adam Spiers @ 2008-01-03 12:41 UTC (permalink / raw)
  To: org-mode mailing list

On Thu, Jan 03, 2008 at 01:33:16PM +0100, Carsten Dominik wrote:
> On Dec 22, 2007, at 1:30 PM, Adam Spiers wrote:
> >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

[snipped]

> What are you proposing?

Simply that every occurrence of '%s' be replaced by the file, not just
the first one.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: BUG: org-open-file fails with multiple %s in mailcap entry
  2008-01-03 12:41   ` Adam Spiers
@ 2008-01-03 12:51     ` Carsten Dominik
  0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2008-01-03 12:51 UTC (permalink / raw)
  To: Adam Spiers; +Cc: org-mode mailing list


On Jan 3, 2008, at 1:41 PM, Adam Spiers wrote:

> On Thu, Jan 03, 2008 at 01:33:16PM +0100, Carsten Dominik wrote:
>> On Dec 22, 2007, at 1:30 PM, Adam Spiers wrote:
>>> 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
>
> [snipped]
>
>> What are you proposing?
>
> Simply that every occurrence of '%s' be replaced by the file, not just
> the first one.

Done for 5.18, thanks.

- Carsten

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-01-03 12:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-22 12:30 BUG: org-open-file fails with multiple %s in mailcap entry Adam Spiers
2008-01-03 12:33 ` Carsten Dominik
2008-01-03 12:41   ` Adam Spiers
2008-01-03 12:51     ` Carsten Dominik

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.