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

Re: w3m Links



At Wed, 29 Jun 2011 10:40:58 +0800,
James Harkins wrote:
>
> At Tue, 28 Jun 2011 10:36:49 -0700,
> docgnome wrote:
> > I tried
> >
> > (add-hook 'mime-view-mode-hook
> >           '(lambda()
> >              (local-set-key (kbd "RET") 'browse-url-at-point)))
> >
> > but RET is still bound to w3m-safe-view-this-url
>
> Indeed, doesn't work for RET on my machine either.
>
> I'm no elisp expert but I guess the hook will need to be added to something other than 'mime-view-mode-hook.
>
> I also have this in my .emacs:
>
> (eval-after-load "w3m"
>  '(progn
>  (define-key w3m-mode-map [left] 'backward-char)
>  (define-key w3m-mode-map [right] 'forward-char)
>  (define-key w3m-mode-map [up] 'previous-line)
>  (define-key w3m-mode-map [down] 'next-line)
>  (define-key w3m-minor-mode-map [left] 'backward-char)
>  (define-key w3m-minor-mode-map [right] 'forward-char)
>  (define-key w3m-minor-mode-map [up] 'previous-line)
>  (define-key w3m-minor-mode-map [down] 'next-line)
> ))
>
> (You know, because I like the arrow keys to navigate through the text, not from one link to the next.) Maybe this could be adapted.

1/

The eval-after-load works:

  (eval-after-load "w3m"
    '(progn
       (define-key w3m-minor-mode-map (kbd "RET") 'w3m-view-url-with-external-browser)))

The key to use for links is stored as a text property, thus modifying
the local map does not take effect.

Keymap Lookup Order
http://www.masteringemacs.org/articles/2011/02/08/mastering-key-bindings-emacs/

And because the buffer is not displayed in w3m-mode or even with
w3m-minor-mode enabled (C-h m) adding the modification of
w3m-minor-mode-map in a w3m-mode-hook (or w3m-minor-mode-hook) does
have no effect, neither.

2/

browse-url does not work, because if w3m renders the buffer, there is
no URL at point.

HTH,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

Attachment: pgpDJWKZZgVY3.pgp
Description: PGP signature