views:

34

answers:

1

Hi, I am trying to find a quick elisp fix that makes w3m under Emacs swap default behaviour of UP/DOWN arrows (moving between hyperlinks in loaded page), with C-n/C-p (moving to next and previous line in the page). These key-bindings must only apply when focus is in a w3m buffer.

Intuitively this configuration would work better for me since I am currently tuned into cua-mode behaviour, particularly in those situations when performing a quick shift-select copy/paste operation.

Moving between hyperlinks with C-n/C-p will become a very explicit action, whereas the default mapping to UP/DOWN comes as an unhelpful surprise; at least to me.

A: 

It turned out to be easy of course to remap bindings local to a mode and invoke them via a hook...

(add-hook 'w3m-mode-hook
      (lambda ()
        (local-set-key "\C-n" 'w3m-next-anchor)
        (local-set-key "\C-p" 'w3m-previous-anchor)
        (local-set-key '[up] 'previous-line)
        (local-set-key '[down] 'next-line)))
landstatic