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

Re: mouse BACK



From: jidanni@xxxxxxxxxxx said
Subject: [emacs-w3m:10083] mouse BACK
Message-ID: <87fxtojbh0.fsf@xxxxxxxxxxx>
Date: Tue, 15 Apr 2008 06:52:27 +0800

> One merely left click the mouse to follow a link.
> But how about when one wants to go BACK.
> No, no such simple mouse click to do that. Not even in a menu.
> Maybe there is in the toolbar, but in ~/.Xresources I use
> Emacs.toolBar: 0 to prevent the big toolbar = waste of space.
> Yes, I read info node (emacs-w3m)Browsing with Mouse Operations.
> Anyway, there should be a way to go back with the mouse just as easy
> as left clicking to go forward.
...

> Maybe BACK should also be in the highest level of the right-mouse
> menu, just like firefox.

I have written the advice code for New right-mouse menu like(?)
firefox.

Put the undermentioned code in your w3m-init-file (~/.emacs-w3m)
and try it.

(defvar w3m-mode-menu)
(defvar w3m-rmouse-menu nil)
(defadvice w3m-mouse-major-mode-menu (around rmouse-pop activate)
  (mouse-set-point event)
  (unless w3m-rmouse-menu
    (let ((menu (copy-keymap w3m-mode-menu))
	  tmp menu)
      (when w3m-use-tab-menubar
	(setq tmp (assq 'Session menu))
	(setq menu (delete tmp menu)))
      (setq tmp (assq 'Bookmark menu))
      (setq menu (delete tmp menu))
      (setq w3m-rmouse-menu menu)))
  (run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
  (let* ((menu (copy-keymap (lookup-key w3m-mode-map [menu-bar])))
	 (w3m (assq 'w3m menu)))
    (setq menu (delete w3m menu))
    (popup-menu (list menu
		      '(keymap (dummy menu-item "----"))
		      '(keymap (dummy menu-item "----"))
		      w3m-rmouse-menu)
		event)))

But, this code is very dirty. So, I think to write more smart
code and commit, sometime ;-p

-- 
Hideyuki SHIRAI (mailto:shirai@xxxxxxxxxxx)
こちらは、日本人向け (for Japanese)

(defvar w3m-mode-menu)
(defvar w3m-rmouse-menu nil)
(defadvice w3m-mouse-major-mode-menu (around rmouse-pop activate)
  (mouse-set-point event)
  (unless w3m-rmouse-menu
    (let ((menu (copy-keymap w3m-mode-menu))
	  tmp menu)
      (if w3m-use-japanese-menu
	  (progn
	    (when w3m-use-tab-menubar
	      (setq tmp (assq 'セッション menu))
	      (setq menu (delete tmp menu)))
	    (setq tmp (assq 'ブックマーク menu))
	    (setq menu (delete tmp menu)))
	(when w3m-use-tab-menubar
	  (setq tmp (assq 'Session menu))
	  (setq menu (delete tmp menu)))
	(setq tmp (assq 'Bookmark menu))
	(setq menu (delete tmp menu)))
      (setq w3m-rmouse-menu menu)))
  (run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
  (let* ((menu (copy-keymap (lookup-key w3m-mode-map [menu-bar])))
	 (w3m (assq 'w3m menu)))
    (setq menu (delete w3m menu))
    (popup-menu (list menu
		      '(keymap (dummy menu-item "----"))
		      '(keymap (dummy menu-item "----"))
		      w3m-rmouse-menu)
		event)))

## 右マウスで出すのはこういう方がよいかもしれない。。。