From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Stanton Subject: Re: Problem exporting to PDF (and viewing) Date: Fri, 18 May 2012 16:30:23 -0700 Message-ID: <40C7B1BFC291ED4E9D10436D07736A33470478BC72@EXMAIL7.haas.uc.berkeley.edu> References: <40C7B1BFC291ED4E9D10436D07736A33470478B315@EXMAIL7.haas.uc.berkeley.edu> <23805.1336833570@alphaville> <40C7B1BFC291ED4E9D10436D07736A33470478B372@EXMAIL7.haas.uc.berkeley.edu> <31430.1336884795@alphaville> <40C7B1BFC291ED4E9D10436D07736A33470478BC1E@EXMAIL7.haas.uc.berkeley.edu> <13715.1337379573@alphaville> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:43439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SVWdI-0007X6-DH for emacs-orgmode@gnu.org; Fri, 18 May 2012 19:30:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SVWdG-0004J5-AB for emacs-orgmode@gnu.org; Fri, 18 May 2012 19:30:51 -0400 Received: from gateway-a.haas.berkeley.edu ([128.32.222.29]:53061) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SVWdG-0004GJ-3j for emacs-orgmode@gnu.org; Fri, 18 May 2012 19:30:50 -0400 In-Reply-To: <13715.1337379573@alphaville> Content-Language: en-US List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "nicholas.dokos@hp.com" Cc: "emacs-orgmode@gnu.org" , Jonathan Leech-Pepin > From: nicholas.dokos@hp.com [mailto:nicholas.dokos@hp.com] > Sent: Friday, May 18, 2012 3:20 PM > To: Richard Stanton > Cc: emacs-orgmode@gnu.org; Jonathan Leech-Pepin > Subject: Re: [O] Problem exporting to PDF (and viewing) >=20 > Richard Stanton wrote: >=20 > > > > 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 co= de (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 =3D "c:/progra~1/sumatrapdf/sumatrapdf.exe %s" > > file =3D "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 w= e just > drop the call to shell-quote-argument? It seems like everything would wor= k > fine without this call. > > >=20 > 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 >=20 > (w32-shell-dos-semantics) >=20 > ? >=20 > It seems that it falls through to the default case and I'm not sure it sh= ould. 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 ba= ckslash...), but escaping the ":" seems to cause problems because now ":" i= s taken to be part of the file name, I think, rather than part of "c:", the= name of the (Windows) disk.