Bug in ess-swv-PDF on Windows

View: New views
3 Messages — Rating Filter:   Alert me  

Bug in ess-swv-PDF on Windows

by Kevin Wright-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ess-swv-PDF fails on Windows because it tries to launch a bash shell
in order to open a pdf reader.

Replacing this line:
(shell-command (concat pdfviewer " " namestem ".pdf &")))

with
(w32-shell-execute "open" (concat namestem ".pdf") nil 1))

fixes the problem for me.

Obviously there needs to be some kind of (if-i-am-running-mswindows ()
()) check here too.

Sincerely,

Kevin Wright

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: Bug in ess-swv-PDF on Windows

by Martin Maechler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>>>>> "KevinW" == Kevin Wright <kw.statr@...>
>>>>>     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?

Thank you,
Martin

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: Bug in ess-swv-PDF on Windows

by Kevin Wright-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Sep 4, 2008 at 2:35 AM, Martin Maechler
<maechler@...> wrote:

>>>>>> "KevinW" == Kevin Wright <kw.statr@...>
>>>>>>     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

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help
LightInTheBox - Buy quality products at wholesale price!