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

w3m-w3m-like-map (was Re: cannot go back to previous position)



;; 本題以外のみに反応

>>>>> In [emacs-w3m : No.05541] 
>>>>>	Yoichi NAKAYAMA <yoichi@geiin.org> wrote:

> ;; 全然関係ないですが、手元では以下を .emacs-w3m に書いて
> ;; w3m-lynx-like-map を上書きすることで w3m もどき map にしています。
> ;; 欲しい人が居るかもしれないので付けといてみます。

昔途中まで作成した w3m-w3m-like-map を添付してみます。
どなたか完成させませんか?

;; SEARCH は vi-mode のを使う手があったのですね。

;;; 作っている途中で w3m の keymap ファイルを読込む機能も
;;; 欲しくなって、それを考えてようとしているうちに放置して
;;; しまったという(^^;

-- 
有沢 明宏
(defvar w3m-w3m-like-map nil
  "w3m-like keymap used in w3m-mode buffers.")
(unless w3m-w3m-like-map
  (let ((map (make-keymap)))
    (suppress-keymap map)
    (define-key map "\C-@" 'set-mark-command) ; MARK
;    (define-key map "\C-a" 'beginning-of-line)
;    (define-key map "\C-b" 'backward-char)
;    (define-key map "\C-e" 'end-of-line)
;    (define-key map "\C-f" 'forward-char)
;;    (define-key map "\C-g" 'what-line) ; LINE_INFO
    (define-key map "\C-h" 'w3m-db-history)
    (define-key map "\t" 'w3m-next-anchor)
    (define-key map "\C-j" 'w3m-view-this-url)
    (define-key map "\C-k" 'w3m-cookie)
;    (define-key map "\C-l" 'recenter)
    (define-key map "\C-m" 'w3m-view-this-url)
;    (define-key map "\C-n" 'next-line)
;    (define-key map "\C-p" 'previous-line)
;    (define-key map "\C-r" 'isearch-backward)
;    (define-key map "\C-s" 'isearch-forward)
    (define-key map "\C-u" 'w3m-previous-anchor)
;    (define-key map "\C-v" 'scroll-up)
    (define-key map "\C-w" 'undefined) ; WRAP_TOGGLE
    (define-key map "\C-z" 'w3m-close-window)

    (define-key map " " 'w3m-scroll-up-or-next-url)
    (define-key map "!" 'shell-command)
    (define-key map "\"" 'undefined) ; REG_MARK
    (define-key map "#" 'undefined) ; PIPE_SHELL
    (define-key map "$" 'end-of-line)
    (define-key map "," (lambda () (interactive) (w3m-scroll-right 1)))
    (define-key map "." (lambda () (interactive) (w3m-scroll-left 1)))
    (define-key map "/" 're-search-forward) ; SEARCH
    (define-key map ":" 'undefined) ; MARK_URL
    (define-key map ";" 'undefined) ; MARK_WORD
    (define-key map "<" 'w3m-scroll-right)
    (define-key map "=" 'w3m-view-header)
    (define-key map ">" 'w3m-scroll-left)
    (define-key map "?" 're-search-backward) ; SEARCH_BACK
    (define-key map "@" 'undefined) ; READ_SHELL
    (define-key map "B" 'w3m-view-previous-page)
    (define-key map "E" 'w3m-edit-this-url)
    (define-key map "F" 'undefined) ; FRAME
    (define-key map "G" 'end-of-buffer)
    (define-key map "H" 'describe-mode)
    (define-key map "I" 'w3m-view-image)
    (define-key map "J" (lambda () (interactive) (scroll-up 1)))
    (define-key map "K" (lambda () (interactive) (scroll-down 1)))
    (define-key map "M" 'w3m-view-url-with-external-browser)
    (define-key map "N" 're-search-backward) ; SEARCH_PREV
    (define-key map "Q" 'w3m-quit)
    (define-key map "R" 'w3m-reload-this-page)
    (define-key map "S" 'undefined) ; SAVE_SCREEN
    (define-key map "U" 'w3m-goto-url)
    (define-key map "V" 'w3m-find-file)
    (define-key map "W" 'backward-word)
    (define-key map "Z" 'w3m-horizontal-recenter)
    (define-key map "[" '(lambda () (interactive) (beginning-of-buffer)
			   (w3m-next-anchor)))
    (define-key map "]" '(lambda () (interactive) (end-of-buffer)
			   (w3m-previous-anchor)))
    (define-key map "^" '(lambda () (interactive) (beginning-of-buffer)
			   (w3m-next-anchor)))
    (define-key map "a" 'w3m-download-this-url)
    (define-key map "b" 'w3m-scroll-down-or-previous-url)
    (define-key map "c" 'w3m-print-current-url)
    (define-key map "g" 'beginning-of-buffer)
    (define-key map "h" 'backward-char)
    (define-key map "i" 'undefined) ; PEEK_IMG
    (define-key map "j" 'next-line)
    (define-key map "k" 'previous-line)
    (define-key map "l" 'forward-char)
    (define-key map "n" 're-search-forward) ; SEARCH_NEXT
    (define-key map "o" '(lambda () (interactive) (customize-group 'w3m)))
    (define-key map "q" 'w3m-close-window)
    (define-key map "s" 'w3m-switch-buffer)
    (define-key map "u" 'w3m-print-this-url)
    (define-key map "s" 'w3m-db-history)
    (define-key map "v" 'w3m-view-source)
    (define-key map "w" 'forward-word)
    (define-key map "z" 'recenter)

    (define-key map "\M-\t" 'w3m-previous-anchor)
    (define-key map "\C-\M-j" 'w3m-download-this-url)
    (define-key map "\C-\M-m" 'w3m-download-this-url)

    (define-key map "\M-:" 'undefined) ; MARK_MID
;    (define-key map "\M-<" 'beginning-of-buffer)
;    (define-key map "\M->" 'end-of-buffer)
    (define-key map "\M-I" 'w3m-save-image)
    (define-key map "\M-M" 'undefined) ; EXTERN_LINK
    (define-key map "\M-W" 'undefined) ; DICT_WORD_AT
    (define-key map "\M-a" 'w3m-bookmark-add-current-url)
    (define-key map "\M-b" 'w3m-bookmark-view)
    (define-key map "\M-e" 'undefined) ; EDIT_SCREEN
    (define-key map "\M-g" 'goto-line)
    (define-key map "\M-n" 'undefined) ; NEXT_MARK
    (define-key map "\M-p" 'undefined) ; PREV_MARK
    (define-key map "\M-s" 'undefined) ; SAVE
    (define-key map "\M-u" 'w3m-goto-url) ; GOTO_RELATIVE
    (define-key map "\M-v" 'scroll-down)
    (define-key map "\M-w" 'undefined) ; DICT_WORD

    (define-key map [up] 'previous-line)
    (define-key map [down] 'next-line)
    (define-key map [right] 'forward-char)
    (define-key map [left] 'backward-char)

    (define-key map [home] 'beginning-of-buffer)
    (define-key map [insertchar] 'undefined) ; MENU
    (define-key map [end] 'end-of-buffer)
    (define-key map [prior] 'scroll-up)
    (define-key map [next] 'scroll-down)

    (setq w3m-w3m-like-map map)))