[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: the w3m keys should work even if on a gnus header
- From: Katsumi Yamaoka <yamaoka@xxxxxxx>
- Date: Mon, 26 Dec 2011 10:43:14 +0900
- X-ml-name: emacs-w3m
- X-mail-count: 11704
- References: <878vm2lm0p.fsf@xxxxxxxxxxx>
In [emacs-w3m : No.11702] jidanni@xxxxxxxxxxx wrote:
> When reading in gnus, as we know, the w3m keys like
>} w3m-next-image
> only work when the cursor is below the [1. text/html],
[...]
> Wouldn't it be neat if they worked no matter where the cursor was?
I hesitate to do that since it will mask new Gnus' features someone
may add in the future. So, I think it should be done at one's risk;
like this:
(defadvice mm-inline-text-html-render-with-w3m (after add-some-w3m-keys
activate)
"Make some emacs-w3m keys be available in the whole of article buffer."
(when (and mm-inline-text-html-with-w3m-keymap
(boundp 'w3m-minor-mode-map)
w3m-minor-mode-map)
(let ((inhibit-read-only t)
(keymap (make-sparse-keymap))
start end)
(define-key keymap "}" 'w3m-next-image)
(define-key keymap "{" 'w3m-previous-image)
(save-restriction
(widen)
(setq start (point-min))
(while (setq start (text-property-any start (point-max) 'keymap nil))
(setq end (text-property-not-all start (point-max) 'keymap nil))
(put-text-property start end 'keymap keymap))))))