> From: nicholas.do...@hp.com [mailto:nicholas.do...@hp.com] > Sent: Friday, May 18, 2012 3:20 PM > To: Richard Stanton > Cc: email@example.com; Jonathan Leech-Pepin > Subject: Re: [O] Problem exporting to PDF (and viewing) > > Richard Stanton <stan...@haas.berkeley.edu> wrote: > > > > > 2) If not, where is the code that interprets %s? I can try > > > > stepping through it and see what I can find. > > > > > > > > > > It happens in org.el:org-open-file, specifically this piece of the code (I > think): > > > > > > ,---- > > > | (while (string-match "%s" cmd) > > > | (setq cmd (replace-match > > > | (save-match-data > > > | (shell-quote-argument > > > | (convert-standard-filename file))) > > > | t t cmd))) > > > `---- > > > > I did some tracing through, and have found where things go wrong. > > > > At the start of the code listed above, > > > > cmd = "c:/progra~1/sumatrapdf/sumatrapdf.exe %s" > > file = "c:/dropbox/org/personal.pdf" > > > > (convert-standard-filename file) returns "C:/dropbox/org/personal.pdf" > > > > So far so good... > > > > However, > > > > (shell-quote-argument (convert-standard-filename file)) returns > > "c\\:dropbox/org/personal.pdf" > > > > That's where the problem occurs. After this block of code is > > completed, cmd takes the value "c:/progra~1/sumatrapdf/sumatrapdf.exe > c\\:dropbox/org/personal.pdf" > > > > This command causes sumatrapdf to squawk with an error. It's the "\\:" > > that causes the problem. If, after this block of code executes, I > > manually switch the "\\:" back to ":/", so cmd goes back to > > > > "c:/progra~1/sumatrapdf/sumatrapdf.exe c:/dropbox/org/personal.pdf" > > > > and then press "c" to continue, the PDF file pops up just fine. Could we > > just > drop the call to shell-quote-argument? It seems like everything would work > fine without this call. > > > > Can you trace the execution of shell-quote-argument? In particular, what is > the value of system-type and what result do you get when you evaluate the > form > > (w32-shell-dos-semantics) > > ? > > It seems that it falls through to the default case and I'm not sure it should.
Tracing through (shell-quote-argument "c:/dropbox/org/personal.pdf"), system-type is windows-nt (w32-shell-dos-semantics) returns nil This result occurs because I'm using (Cygwin) bash as my shell inside Emacs, not the Windows default, cmdproxy.exe. It's therefore true that my shell does *not* expect DOS file names (and gets very upset when you pass it a backslash...), but escaping the ":" seems to cause problems because now ":" is taken to be part of the file name, I think, rather than part of "c:", the name of the (Windows) disk.