Package: emacs21-common
Version: 21.4a-3
Severity: wishlist
Tags: patch

Subject: emacs21-common: Please integrate w3m-el browser into browse-url... 
commands.
Package: emacs21-common
Version: 21.4a-3
Severity: wishlist
Tags: patch

If package 'w3m-el' is installed, it should be possible to use it as the
WWW browser when issuing one of the browse-url... commands in 'browse-url.el'.

IMHO, w3m should even be the default browser when installed, because if I
want to browse an HTML file from emacs, I do not want to leave the editor.
But this may be a controversial issue, thus it seems to be sufficient to let
a user set the configuration variable 'browse-url-browser-function' if needed.

The attached patch is my personal workaround for the missing integration,
it might be useful as a starting point for a standard solution.

Regards, Andreas Hoenen

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.8-2-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages emacs21-common depends on:
ii  dpkg                          1.13.21    package maintenance system for Deb
ii  emacsen-common                1.4.17     Common facilities for all emacsen

emacs21-common recommends no packages.

-- no debconf information

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.8-2-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages emacs21-common depends on:
ii  dpkg                          1.13.21    package maintenance system for Deb
ii  emacsen-common                1.4.17     Common facilities for all emacsen

emacs21-common recommends no packages.

-- no debconf information
(if (fboundp 'w3m)
    (progn
      ;; Analoguous to definition of `browse-url-w3':
      (defun browse-url-w3m (url &optional new-window)
        "Ask the w3m WWW browser to load URL.
Default to the URL around or before point.

When called interactively, if variable `browse-url-new-window-flag' is
non-nil, load the document in a new window.  A non-nil interactive
prefix argument reverses the effect of `browse-url-new-window-flag'.

When called non-interactively, optional second argument NEW-WINDOW is
used instead of `browse-url-new-window-flag'."
        (interactive (browse-url-interactive-arg "W3 URL: "))
        ;; Hack: Transform an http:// URL to its file:// counterpart
        ;; if the file exists.
        (if (equal (compare-strings "http:/" 0 nil url 0 6) t)
            (if (file-exists-p (substring url 6))
                (setq url (concat "file://" (substring url 6)))))
        (w3m-browse-url url (browse-url-maybe-new-window new-window)))
      (setq browse-url-browser-function 'browse-url-w3m)))

Reply via email to