info-gnus-english
[Top][All Lists]
Advanced

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

Re: Can emacs-w3m open links in browser


From: David Hanak
Subject: Re: Can emacs-w3m open links in browser
Date: Mon, 20 Sep 2004 19:13:27 -0500
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (windows-nt)

On Mon, 20 Sep 2004, Jose A. Ortega Ruiz wrote:

> on a emacs-w3m buffer, press ? and look for the text 'Display the
> current page using the external browser'; or 
>
> C-h w w3m-view-url-with-external-browser

Soooo, this sounded like a good tip.  Unfortunately it wasn't bound to
any key.  But this isn't something that can stop me, so I quickly found
out that this function requires a certain "fiber.exe" to view external
URLs...  Darn.  I have to modify w3m-content-type-alist to call my
browse method instead -- ok, why not.  But then, I thought better.  I
didn't like that I can't move around with the arrow keys in the message
buffer either, so why not modify the keymap instead?

I stumbled across the variable mm-inline-text-html-with-w3m-keymap,
which which I can switch off all w3m keybindings in Gnus buffers.
Almost what I need, except for Enter, which *should* do something,
namely follow the URL.  Ok, try again.  Eventually I came up with the
following solution:

(add-hook 'gnus-article-mode-hook
  '(lambda ()
     (make-local-variable 'w3m-minor-mode-map)
     (setq w3m-minor-mode-map (make-sparse-keymap))
     (define-key w3m-minor-mode-map "\C-m" 'my-w3m-browse-url-at-point)))

(defun my-w3m-browse-url-at-point ()
  (interactive)
  (let ((url (w3m-url-at-point)))
    (if url
        (browse-url url)
      (message "No URL under point."))))

And it works, it's better than ever!

Of course the make-local-variable part isn't really neccessary, I could
simply overwrite the minor-mode-map globally, as I'm not using w3m
anywhere else.  But it is less obtrusive this way.

-- 
David Hanak - Research Engineer
Institute for Software Integrated Systems  |  http://www.isis.vanderbilt.edu
Vanderbilt University                      |      Work phone: (615) 343 1319
Box 1829, Station B, Nashville, TN 37235   |            PGP key ID: 266BC45F

reply via email to

[Prev in Thread] Current Thread [Next in Thread]