[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: Scripting emacs-w3m - need script blocking



Perfect!

Thank you,
Richard

On Tue, January 31, 2006 6:23 pm, Katsumi Yamaoka wrote:
>>>>>> In [emacs-w3m : No.08515] Richard Freytag wrote:
>
>> I am a grateful that emacs-w3m exists.  It is very useful.  One
>> application I have is reading and saving web pages for later reference.
>
>> My question/problem is: my keyboard-macros and elisp-commands seem to
>> fail
>> because URL opening in emacs-w3m is non-blocking.  The script runs
>> (w3m-goto-url "http://www.google.com";) ... and then finds another URL in
>> that w3m window and attempts to open that new URL.  This causes an error
>> complaining about an attempt to run an asynchronous process.
>
>> Is there a way to block my eLisp keyboard-macro while w3m-goto-url opens
>> a
>> web page and then pick up when the macro is done?
>
> Although I might not accurately grasp what you want to do, it
> might be effective to set the w3m-async-exec variable to nil.
>
> It is t by default, and the w3m-goto-url function returns
> immediately without waiting to finish fetching the contents.
> In that case, the keyboard-macro something like the following
> will not work as expected:
>
> M-x w3m-goto-url RET C-a C-k http://www.google.com RET
> ] RET emacs RET C-c C-c
>
> OTOH, w3m-goto-url returns after preparing the page if
> w3m-async-exec is set to nil.  So, the next one will work:
>
> M-: (setq w3m-async-exec nil) RET
> M-x w3m-goto-url RET C-a C-k http://www.google.com RET
> ] RET emacs RET C-c C-c
> M-: (setq w3m-async-exec t) RET
>
> Similarly, you can also use the `let' form to bind that variable
> in your Lisp commands.  For instance:
>
> (defun your-command ()
>   (interactive)
>   (let ((w3m-async-exec nil))
>     (w3m-goto-url "http://www.google.com";)
>     ...
>     ))
>
> HTH.
>


Best,
Richard