[ESS] Bug in ess-swv-PDF on Windows

Kevin Wright kw.statr at gmail.com
Thu Sep 4 16:36:50 CEST 2008


On Thu, Sep 4, 2008 at 2:35 AM, Martin Maechler
<maechler at stat.math.ethz.ch> wrote:
>>>>>> "KevinW" == Kevin Wright <kw.statr at gmail.com>
>>>>>>     on Wed, 3 Sep 2008 16:08:18 -0500 writes:
>
>    KevinW> ess-swv-PDF fails on Windows because it tries to launch a bash shell
>    KevinW> in order to open a pdf reader.
>
> another proof that your Windows installation would be enhanced
> by a quantum leap if you had a bash installed  ;-)
>
> but of course you are right that we should try to behave more
> user-friendly here.
>
>    KevinW> Replacing this line:
>    KevinW> (shell-command (concat pdfviewer " " namestem ".pdf &")))
>
>    KevinW> with
>    KevinW> (w32-shell-execute "open" (concat namestem ".pdf") nil 1))
>
>    KevinW> fixes the problem for me.
>
>    KevinW> Obviously there needs to be some kind of (if-i-am-running-mswindows ()
>    KevinW> ()) check here too.
>
> yes (and we know how to do that).
> But
> o  what is  pdfviewer  (the Emacs variable in that context)
>   for you?
> o  Is "open" really guaranteed to work on all versions of M$ Windows?

(w32-shell-execute "open" "myfile.pdf" nil 1) has the same effect as
double-clicking on the file "myfile.pdf".  The default Windows
application is used (for most people, that will be Acrobat Reader).  I
tried using getOptions(pdfviewer) passed to pdfviewer passed to a
Windows cmd shell, but it wasn't working for me.  I suspect it would
not be too hard, but I'm not very familiar with the details and
stopped once I had a working solution.  Since w32-shell-execute is C
code built into Emacs, I would assume it works on all versions of
Windows that Emacs supports.

Kevin




More information about the ESS-help mailing list