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

Re: w3m-view-url-with-external-browser horrible user experience



In [emacs-w3m : No.12190] Leo Liu wrote:
> It's been a long time since I last used emacs-w3m (more than a year) and
> I am appalled by its current behaviour.

> When I M-x w3m-view-url-with-external-browser, it displays for SECONDS

>         Browsing <http://whatever.com/>...

> leaving me in suspense when the GUI browser is popping to the front
> stealing me away from emacs.

> The sane behaviour should be like browse-url, where if GUI browser is
> used open the url immediately so that users can M-TAB to switch back to
> emacs.

Does it really take SECONDS?  Though I've never felt it inconvenient,
normal web browsing using emacs-w3m will take SECONDS too, IIUC.

`w3m-view-url-with-external-browser' fetches the header of a url
before launching an external browser, in order to examine the
content type of a url and choose an external browser according
to the user option `w3m-content-type-alist'.  For instance, it
launches an image viewer for image/* types, launches xdvi for
the application/dvi type, etc.  Yes, fetching the header is
indeed an overhead (it runs w3m) if you don't want to use a
browser other than your kitchen sink web browser.  But it is
author's will or purpose, maybe.  Instead, you can replace it
with the one like this:

(defun w3m-view-url-with-browse-url ()
  "Launch `browse-url'."
  (interactive)
  (let ((url (or (w3m-anchor) (w3m-image) w3m-current-url)))
    (when (w3m-url-valid url)
      (message "Browsing <%s>..." url)
      (browse-url url))))

(define-key w3m-mode-map "M" 'w3m-view-url-with-browse-url)