* Problem exporting to PDF (and viewing)
@ 2012-05-11 23:52 Richard Stanton
2012-05-12 7:22 ` Jude DaShiell
0 siblings, 1 reply; 15+ messages in thread
From: Richard Stanton @ 2012-05-11 23:52 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
Using Org-mode version 7.8.09 (release_7.8.09-553-g5750f0) (and earlier versions) I've encountered a problem on my Windows machine when I try to export an Org file to LaTeX, then to Pdf, then viewing (using C-c C-e d).
In my init.el I have the lines
(eval-after-load "org"
'(progn
(if (assoc "\\.pdf\\'" org-file-apps)
(setcdr (assoc "\\.pdf\\'" org-file-apps) "c:/progra~1/sumatrapdf/sumatrapdf.exe %s")
(add-to-list 'org-file-apps '("\\.pdf\\'" . "c:/progra~1/sumatrapdf/sumatrapdf.exe %s") t))))
)
This results in:
org-file-apps is a variable defined in `org.el'.
Its value is ((auto-mode . emacs)
("\\.mm\\'" . default)
("\\.x?html?\\'" . default)
("\\.pdf\\'" . "c:/progra~1/sumatrapdf/sumatrapdf.exe %s"))
When I try to export an org file by typing C-c C-e d, sumatrapdf opens up OK, but complains with an error like this:
Error loading c:\dropbox\org\c\:\dropbox\org\personal.pdf
Any idea why I get the repeated path? A similar constructions works fine on my Mac, so I'm not quite sure what's going wrong here.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Problem exporting to PDF (and viewing)
2012-05-11 23:52 Problem exporting to PDF (and viewing) Richard Stanton
@ 2012-05-12 7:22 ` Jude DaShiell
0 siblings, 0 replies; 15+ messages in thread
From: Jude DaShiell @ 2012-05-12 7:22 UTC (permalink / raw)
To: Richard Stanton; +Cc: emacs-orgmode@gnu.org
Why not search at http://tv.adobe.com/ for strings of interest to see
for example if adobe knows anything about bash that may be useful?
Other people have found things useful for increasing adobe documents
accessibility using that url.
On Fri, 11 May 2012, Richard Stanton wrote:
> Using Org-mode version 7.8.09 (release_7.8.09-553-g5750f0) (and earlier versions) I've encountered a problem on my Windows machine when I try to export an Org file to LaTeX, then to Pdf, then viewing (using C-c C-e d).
>
> In my init.el I have the lines
>
> (eval-after-load "org"
> '(progn
> (if (assoc "\\.pdf\\'" org-file-apps)
> (setcdr (assoc "\\.pdf\\'" org-file-apps) "c:/progra~1/sumatrapdf/sumatrapdf.exe %s")
> (add-to-list 'org-file-apps '("\\.pdf\\'" . "c:/progra~1/sumatrapdf/sumatrapdf.exe %s") t))))
> )
>
> This results in:
>
> org-file-apps is a variable defined in `org.el'.
> Its value is ((auto-mode . emacs)
> ("\\.mm\\'" . default)
> ("\\.x?html?\\'" . default)
> ("\\.pdf\\'" . "c:/progra~1/sumatrapdf/sumatrapdf.exe %s"))
>
> When I try to export an org file by typing C-c C-e d, sumatrapdf opens up OK, but complains with an error like this:
>
> Error loading c:\dropbox\org\c\:\dropbox\org\personal.pdf
>
> Any idea why I get the repeated path? A similar constructions works fine on my Mac, so I'm not quite sure what's going wrong here.
>
>
>
----------------------------------------------------------------
Jude <jdashiel-at-shellworld-dot-net>
<http://www.shellworld.net/~jdashiel/nj.html>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Problem exporting to PDF (and viewing)
@ 2012-05-12 4:10 Richard Stanton
2012-05-12 14:23 ` Jonathan Leech-Pepin
0 siblings, 1 reply; 15+ messages in thread
From: Richard Stanton @ 2012-05-12 4:10 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
Checking further, this works fine using the default Windows shell in Emacs, but fails if I use bash as my shell. Unfortunately, I like to use bash, which I achieve with the following lines in my init.el:
(setq shell-file-name "bash")
(setenv "SHELL" shell-file-name)
(setq explicit-shell-file-name shell-file-name)
> -----Original Message-----
> From: Richard Stanton
> Sent: Friday, May 11, 2012 4:52 PM
> To: emacs-orgmode@gnu.org
> Subject: Problem exporting to PDF (and viewing)
>
> Using Org-mode version 7.8.09 (release_7.8.09-553-g5750f0) (and earlier
> versions) I've encountered a problem on my Windows machine when I try to
> export an Org file to LaTeX, then to Pdf, then viewing (using C-c C-e d).
>
> In my init.el I have the lines
>
> (eval-after-load "org"
> '(progn
> (if (assoc "\\.pdf\\'" org-file-apps)
> (setcdr (assoc "\\.pdf\\'" org-file-apps)
> "c:/progra~1/sumatrapdf/sumatrapdf.exe %s")
> (add-to-list 'org-file-apps '("\\.pdf\\'" .
> "c:/progra~1/sumatrapdf/sumatrapdf.exe %s") t))))
> )
>
> This results in:
>
> org-file-apps is a variable defined in `org.el'.
> Its value is ((auto-mode . emacs)
> ("\\.mm\\'" . default)
> ("\\.x?html?\\'" . default)
> ("\\.pdf\\'" . "c:/progra~1/sumatrapdf/sumatrapdf.exe %s"))
>
> When I try to export an org file by typing C-c C-e d, sumatrapdf opens up OK,
> but complains with an error like this:
>
> Error loading c:\dropbox\org\c\:\dropbox\org\personal.pdf
>
> Any idea why I get the repeated path? A similar constructions works fine on
> my Mac, so I'm not quite sure what's going wrong here.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Problem exporting to PDF (and viewing)
2012-05-12 4:10 Richard Stanton
@ 2012-05-12 14:23 ` Jonathan Leech-Pepin
2012-05-12 14:39 ` Nick Dokos
0 siblings, 1 reply; 15+ messages in thread
From: Jonathan Leech-Pepin @ 2012-05-12 14:23 UTC (permalink / raw)
To: Richard Stanton; +Cc: emacs-orgmode@gnu.org
I suspect you should be able to get it to recognize "C:/Program\
Files/sumatrapdf/sumatrapdf.exe".
Alternately if the exe is found on your PATH (you may need to add it
by hand), you should be able to manage with:
(executable-find "sumatrapdf.exe")
which should be able to track back the path to the appropriate file.
On Sat, May 12, 2012 at 12:10 AM, Richard Stanton
<stanton@haas.berkeley.edu> wrote:
> Checking further, this works fine using the default Windows shell in Emacs, but fails if I use bash as my shell. Unfortunately, I like to use bash, which I achieve with the following lines in my init.el:
>
> (setq shell-file-name "bash")
> (setenv "SHELL" shell-file-name)
> (setq explicit-shell-file-name shell-file-name)
>
>> -----Original Message-----
>> From: Richard Stanton
>> Sent: Friday, May 11, 2012 4:52 PM
>> To: emacs-orgmode@gnu.org
>> Subject: Problem exporting to PDF (and viewing)
>>
>> Using Org-mode version 7.8.09 (release_7.8.09-553-g5750f0) (and earlier
>> versions) I've encountered a problem on my Windows machine when I try to
>> export an Org file to LaTeX, then to Pdf, then viewing (using C-c C-e d).
>>
>> In my init.el I have the lines
>>
>> (eval-after-load "org"
>> '(progn
>> (if (assoc "\\.pdf\\'" org-file-apps)
>> (setcdr (assoc "\\.pdf\\'" org-file-apps)
>> "c:/progra~1/sumatrapdf/sumatrapdf.exe %s")
>> (add-to-list 'org-file-apps '("\\.pdf\\'" .
>> "c:/progra~1/sumatrapdf/sumatrapdf.exe %s") t))))
>> )
>>
>> This results in:
>>
>> org-file-apps is a variable defined in `org.el'.
>> Its value is ((auto-mode . emacs)
>> ("\\.mm\\'" . default)
>> ("\\.x?html?\\'" . default)
>> ("\\.pdf\\'" . "c:/progra~1/sumatrapdf/sumatrapdf.exe %s"))
>>
>> When I try to export an org file by typing C-c C-e d, sumatrapdf opens up OK,
>> but complains with an error like this:
>>
>> Error loading c:\dropbox\org\c\:\dropbox\org\personal.pdf
>>
>> Any idea why I get the repeated path? A similar constructions works fine on
>> my Mac, so I'm not quite sure what's going wrong here.
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Problem exporting to PDF (and viewing)
2012-05-12 14:23 ` Jonathan Leech-Pepin
@ 2012-05-12 14:39 ` Nick Dokos
2012-05-13 4:05 ` Richard Stanton
0 siblings, 1 reply; 15+ messages in thread
From: Nick Dokos @ 2012-05-12 14:39 UTC (permalink / raw)
To: Jonathan Leech-Pepin; +Cc: Richard Stanton, emacs-orgmode@gnu.org
Jonathan Leech-Pepin <jonathan.leechpepin@gmail.com> wrote:
> I suspect you should be able to get it to recognize "C:/Program\
> Files/sumatrapdf/sumatrapdf.exe".
>
> Alternately if the exe is found on your PATH (you may need to add it
> by hand), you should be able to manage with:
>
> (executable-find "sumatrapdf.exe")
>
> which should be able to track back the path to the appropriate file.
>
> On Sat, May 12, 2012 at 12:10 AM, Richard Stanton
> <stanton@haas.berkeley.edu> wrote:
> > Checking further, this works fine using the default Windows shell in Emacs, but fails if I use bash as my shell. Unfortunately, I like to use bash, which I achieve with the following lines in my init.el:
> >
> > (setq shell-file-name "bash")
> > (setenv "SHELL" shell-file-name)
> > (setq explicit-shell-file-name shell-file-name)
> >
> >> -----Original Message-----
> >> From: Richard Stanton
> >> Sent: Friday, May 11, 2012 4:52 PM
> >> To: emacs-orgmode@gnu.org
> >> Subject: Problem exporting to PDF (and viewing)
> >>
> >> Using Org-mode version 7.8.09 (release_7.8.09-553-g5750f0) (and earlier
> >> versions) I've encountered a problem on my Windows machine when I try to
> >> export an Org file to LaTeX, then to Pdf, then viewing (using C-c C-e d).
> >>
> >> In my init.el I have the lines
> >>
> >> (eval-after-load "org"
> >> '(progn
> >> (if (assoc "\\.pdf\\'" org-file-apps)
> >> (setcdr (assoc "\\.pdf\\'" org-file-apps)
> >> "c:/progra~1/sumatrapdf/sumatrapdf.exe %s")
> >> (add-to-list 'org-file-apps '("\\.pdf\\'" .
> >> "c:/progra~1/sumatrapdf/sumatrapdf.exe %s") t))))
> >> )
> >>
> >> This results in:
> >>
> >> org-file-apps is a variable defined in `org.el'.
> >> Its value is ((auto-mode . emacs)
> >> ("\\.mm\\'" . default)
> >> ("\\.x?html?\\'" . default)
> >> ("\\.pdf\\'" . "c:/progra~1/sumatrapdf/sumatrapdf.exe %s"))
> >>
> >> When I try to export an org file by typing C-c C-e d, sumatrapdf opens up OK,
> >> but complains with an error like this:
> >>
> >> Error loading c:\dropbox\org\c\:\dropbox\org\personal.pdf
> >>
> >> Any idea why I get the repeated path? A similar constructions works fine on
> >> my Mac, so I'm not quite sure what's going wrong here.
I don't do Windoze, but this looks to me like a typo in some init file,
perhaps a missing semicolon? I'd grep the usual suspects (on Linux, this
would be /etc/*, and all the config/init files and directories under
$HOME (.profile, .bashrc, .emacs, etc etc), but I have no idea what
these would be on Windoze - you might even have to search the *shudder*
registry) for c:\dropbox\org.
Nick
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Problem exporting to PDF (and viewing)
2012-05-12 14:39 ` Nick Dokos
@ 2012-05-13 4:05 ` Richard Stanton
2012-05-13 4:53 ` Nick Dokos
2012-05-13 6:00 ` Achim Gratz
0 siblings, 2 replies; 15+ messages in thread
From: Richard Stanton @ 2012-05-13 4:05 UTC (permalink / raw)
To: nicholas.dokos@hp.com, Jonathan Leech-Pepin; +Cc: emacs-orgmode@gnu.org
I think the problem is in the org-mode code that interprets "%s." (and how this interacts with my bash shell). This is supposed to pass the executable the fully qualified file name, but somehow it ends up passing the directory twice, which (understandably) confuses the executable.
While this seems to have something to do with the bash shell I'm using, this works fine for everything else, so I'm pretty sure there's no fundamental problem in my setup, and it would be nice to find a way around this problem.
Two thoughts:
1) Is there another string I could use, instead of %s, that results in the file name being passed without the path at all? This would probably cure the problem.
2) If not, where is the code that interprets %s? I can try stepping through it and see what I can find.
Thanks a lot.
Richard
> -----Original Message-----
> From: nicholas.dokos@hp.com [mailto:nicholas.dokos@hp.com]
> Sent: Saturday, May 12, 2012 7:40 AM
> To: Jonathan Leech-Pepin
> Cc: Richard Stanton; emacs-orgmode@gnu.org
> Subject: Re: [O] Problem exporting to PDF (and viewing)
>
> Jonathan Leech-Pepin <jonathan.leechpepin@gmail.com> wrote:
>
> > I suspect you should be able to get it to recognize "C:/Program\
> > Files/sumatrapdf/sumatrapdf.exe".
> >
> > Alternately if the exe is found on your PATH (you may need to add it
> > by hand), you should be able to manage with:
> >
> > (executable-find "sumatrapdf.exe")
> >
> > which should be able to track back the path to the appropriate file.
> >
> > On Sat, May 12, 2012 at 12:10 AM, Richard Stanton
> > <stanton@haas.berkeley.edu> wrote:
> > > Checking further, this works fine using the default Windows shell in
> Emacs, but fails if I use bash as my shell. Unfortunately, I like to use bash,
> which I achieve with the following lines in my init.el:
> > >
> > > (setq shell-file-name "bash")
> > > (setenv "SHELL" shell-file-name)
> > > (setq explicit-shell-file-name shell-file-name)
> > >
> > >> -----Original Message-----
> > >> From: Richard Stanton
> > >> Sent: Friday, May 11, 2012 4:52 PM
> > >> To: emacs-orgmode@gnu.org
> > >> Subject: Problem exporting to PDF (and viewing)
> > >>
> > >> Using Org-mode version 7.8.09 (release_7.8.09-553-g5750f0) (and
> > >> earlier
> > >> versions) I've encountered a problem on my Windows machine when I
> > >> try to export an Org file to LaTeX, then to Pdf, then viewing (using C-c C-
> e d).
> > >>
> > >> In my init.el I have the lines
> > >>
> > >> (eval-after-load "org"
> > >> '(progn
> > >> (if (assoc "\\.pdf\\'" org-file-apps)
> > >> (setcdr (assoc "\\.pdf\\'" org-file-apps)
> > >> "c:/progra~1/sumatrapdf/sumatrapdf.exe %s")
> > >> (add-to-list 'org-file-apps '("\\.pdf\\'" .
> > >> "c:/progra~1/sumatrapdf/sumatrapdf.exe %s") t))))
> > >> )
> > >>
> > >> This results in:
> > >>
> > >> org-file-apps is a variable defined in `org.el'.
> > >> Its value is ((auto-mode . emacs)
> > >> ("\\.mm\\'" . default)
> > >> ("\\.x?html?\\'" . default)
> > >> ("\\.pdf\\'" . "c:/progra~1/sumatrapdf/sumatrapdf.exe %s"))
> > >>
> > >> When I try to export an org file by typing C-c C-e d, sumatrapdf
> > >> opens up OK, but complains with an error like this:
> > >>
> > >> Error loading c:\dropbox\org\c\:\dropbox\org\personal.pdf
> > >>
> > >> Any idea why I get the repeated path? A similar constructions works
> > >> fine on my Mac, so I'm not quite sure what's going wrong here.
>
> I don't do Windoze, but this looks to me like a typo in some init file, perhaps a
> missing semicolon? I'd grep the usual suspects (on Linux, this would be
> /etc/*, and all the config/init files and directories under $HOME (.profile,
> .bashrc, .emacs, etc etc), but I have no idea what these would be on
> Windoze - you might even have to search the *shudder*
> registry) for c:\dropbox\org.
>
> Nick
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Problem exporting to PDF (and viewing)
2012-05-13 4:05 ` Richard Stanton
@ 2012-05-13 4:53 ` Nick Dokos
2012-05-18 20:56 ` Richard Stanton
2012-05-13 6:00 ` Achim Gratz
1 sibling, 1 reply; 15+ messages in thread
From: Nick Dokos @ 2012-05-13 4:53 UTC (permalink / raw)
To: Richard Stanton; +Cc: emacs-orgmode@gnu.org, Jonathan Leech-Pepin
Richard Stanton <stanton@haas.berkeley.edu> wrote:
> I think the problem is in the org-mode code that interprets "%s." (and
> how this interacts with my bash shell). This is supposed to pass the
> executable the fully qualified file name, but somehow it ends up
> passing the directory twice, which (understandably) confuses the
> executable.
>
> While this seems to have something to do with the bash shell I'm
> using, this works fine for everything else, so I'm pretty sure there's
> no fundamental problem in my setup, and it would be nice to find a way
> around this problem.
>
> Two thoughts:
>
> 1) Is there another string I could use, instead of %s, that results in
> the file name being passed without the path at all? This would
> probably cure the problem.
>
Don't know, but I don't think so.
> 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)))
`----
Nick
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Problem exporting to PDF (and viewing)
2012-05-13 4:53 ` Nick Dokos
@ 2012-05-18 20:56 ` Richard Stanton
2012-05-18 21:11 ` Nick Dokos
2012-05-18 22:19 ` Nick Dokos
0 siblings, 2 replies; 15+ messages in thread
From: Richard Stanton @ 2012-05-18 20:56 UTC (permalink / raw)
To: nicholas.dokos@hp.com; +Cc: emacs-orgmode@gnu.org, Jonathan Leech-Pepin
> > 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.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Problem exporting to PDF (and viewing)
2012-05-18 20:56 ` Richard Stanton
@ 2012-05-18 21:11 ` Nick Dokos
2012-05-18 21:45 ` Richard Stanton
2012-05-18 22:19 ` Nick Dokos
1 sibling, 1 reply; 15+ messages in thread
From: Nick Dokos @ 2012-05-18 21:11 UTC (permalink / raw)
To: Richard Stanton; +Cc: emacs-orgmode@gnu.org, Jonathan Leech-Pepin
Richard Stanton <stanton@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"
>
Does it really drop the slash in front of "dropbox"? When I do that
on my system, the : is quoted, but the slash is left alone:
(setq s "C:/dropbox/org/personal.pdf")
"C:/dropbox/org/personal.pdf"
(shell-quote-argument s)
"C\\:/dropbox/org/personal.pdf"
system-type
gnu/linux
If it does indeed drop the slash, can you try just putting it back and leaving
the backslashes alone?
Nick
> 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.
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Problem exporting to PDF (and viewing)
2012-05-18 21:11 ` Nick Dokos
@ 2012-05-18 21:45 ` Richard Stanton
0 siblings, 0 replies; 15+ messages in thread
From: Richard Stanton @ 2012-05-18 21:45 UTC (permalink / raw)
To: nicholas.dokos@hp.com; +Cc: emacs-orgmode@gnu.org, Jonathan Leech-Pepin
> -----Original Message-----
> From: nicholas.dokos@hp.com [mailto:nicholas.dokos@hp.com]
> Sent: Friday, May 18, 2012 2:11 PM
> To: Richard Stanton
> Cc: emacs-orgmode@gnu.org; Jonathan Leech-Pepin
> Subject: Re: [O] Problem exporting to PDF (and viewing)
>
> Richard Stanton <stanton@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"
> >
>
> Does it really drop the slash in front of "dropbox"? When I do that on my
> system, the : is quoted, but the slash is left alone:
>
>
> (setq s "C:/dropbox/org/personal.pdf")
> "C:/dropbox/org/personal.pdf"
> (shell-quote-argument s)
> "C\\:/dropbox/org/personal.pdf"
> system-type
> gnu/linux
>
> If it does indeed drop the slash, can you try just putting it back and leaving
> the backslashes alone?
Oops. I must have deleted it somehow while transcribing. No, the slash is left alone:
"c\\:/Dropbox/org/personal.pdf"
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Problem exporting to PDF (and viewing)
2012-05-18 20:56 ` Richard Stanton
2012-05-18 21:11 ` Nick Dokos
@ 2012-05-18 22:19 ` Nick Dokos
2012-05-18 23:30 ` Richard Stanton
1 sibling, 1 reply; 15+ messages in thread
From: Nick Dokos @ 2012-05-18 22:19 UTC (permalink / raw)
To: Richard Stanton; +Cc: emacs-orgmode@gnu.org, Jonathan Leech-Pepin
Richard Stanton <stanton@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.
Nick
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Problem exporting to PDF (and viewing)
2012-05-18 22:19 ` Nick Dokos
@ 2012-05-18 23:30 ` Richard Stanton
2012-05-19 7:07 ` Achim Gratz
0 siblings, 1 reply; 15+ messages in thread
From: Richard Stanton @ 2012-05-18 23:30 UTC (permalink / raw)
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)
>
> Richard Stanton <stanton@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.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Problem exporting to PDF (and viewing)
2012-05-18 23:30 ` Richard Stanton
@ 2012-05-19 7:07 ` Achim Gratz
0 siblings, 0 replies; 15+ messages in thread
From: Achim Gratz @ 2012-05-19 7:07 UTC (permalink / raw)
To: emacs-orgmode
Richard Stanton writes:
> 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.
No, the backslash would be OK for the shell. But you are not sending
that string to a shell (much less bash), you are sending it to a Win32
program. Windows programs are not expecting any quoting in their
arguments (not even cmd-style quoting). Write a shell wrapper around
each windows program that you are calling through your cygwinized
Emacs...
Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Waldorf MIDI Implementation & additional documentation:
http://Synth.Stromeko.net/Downloads.html#WaldorfDocs
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Problem exporting to PDF (and viewing)
2012-05-13 4:05 ` Richard Stanton
2012-05-13 4:53 ` Nick Dokos
@ 2012-05-13 6:00 ` Achim Gratz
1 sibling, 0 replies; 15+ messages in thread
From: Achim Gratz @ 2012-05-13 6:00 UTC (permalink / raw)
To: emacs-orgmode
Richard Stanton writes:
> While this seems to have something to do with the bash shell I'm
> using, this works fine for everything else, so I'm pretty sure there's
> no fundamental problem in my setup, and it would be nice to find a way
> around this problem.
I am pretty sure there is some fundamental problem, but you never told
us what exactly your setup is.
FWIW, I sometimes get these doubled up prefix paths since I installed
cygwin-setup and cygwin-mount from the EmacsWiki in operations that are
completely unrelated to org (I haven't had time to investigate), but
then it works for the same path if I try the same thing a bit later.
Also, as has been mentioned before, you might want to check where the
string "c:\dropbox\org" comes from, since Emacs would normally expand it
as "c:/dropbox/org", so it seems likely that you pull it in via a
Windows environment variable or it is quoted once too many. Lastly, it
is not a good idea to give such DOS paths with "\" to bash, as bash has
totally different quoting rules than DOS cmd.
Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
SD adaptation for Waldorf rackAttack V1.04R1:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Problem exporting to PDF (and viewing)
@ 2012-05-14 5:33 Richard Stanton
0 siblings, 0 replies; 15+ messages in thread
From: Richard Stanton @ 2012-05-14 5:33 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
Achim Gratz writes
> Richard Stanton writes:
> > While this seems to have something to do with the bash shell I'm
> > using, this works fine for everything else, so I'm pretty sure there's
> > no fundamental problem in my setup, and it would be nice to find a way
> > around this problem.
>
> I am pretty sure there is some fundamental problem, but you never told
> us what exactly your setup is.
>
> FWIW, I sometimes get these doubled up prefix paths since I installed
> cygwin-setup and cygwin-mount from the EmacsWiki in operations that are
> completely unrelated to org (I haven't had time to investigate), but
> then it works for the same path if I try the same thing a bit later.
> Also, as has been mentioned before, you might want to check where the
> string "c:\dropbox\org" comes from, since Emacs would normally expand it
> as "c:/dropbox/org", so it seems likely that you pull it in via a
> Windows environment variable or it is quoted once too many. Lastly, it
> is not a good idea to give such DOS paths with "\" to bash, as bash has
> totally different quoting rules than DOS cmd.
Thanks. I'm using Cygwin bash under Windows Vista, and suspect you may have a point about the directory separator, though nowhere in my init.el do I use a backslash. Anyway, I'll give it a check and see what I can find.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2012-05-19 7:07 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-11 23:52 Problem exporting to PDF (and viewing) Richard Stanton
2012-05-12 7:22 ` Jude DaShiell
-- strict thread matches above, loose matches on Subject: below --
2012-05-12 4:10 Richard Stanton
2012-05-12 14:23 ` Jonathan Leech-Pepin
2012-05-12 14:39 ` Nick Dokos
2012-05-13 4:05 ` Richard Stanton
2012-05-13 4:53 ` Nick Dokos
2012-05-18 20:56 ` Richard Stanton
2012-05-18 21:11 ` Nick Dokos
2012-05-18 21:45 ` Richard Stanton
2012-05-18 22:19 ` Nick Dokos
2012-05-18 23:30 ` Richard Stanton
2012-05-19 7:07 ` Achim Gratz
2012-05-13 6:00 ` Achim Gratz
2012-05-14 5:33 Richard Stanton
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).