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

Re: mouse BACK



From: jidanni@xxxxxxxxxxx said
Subject: [emacs-w3m:10090] Re: mouse BACK
Message-ID: <87k5ixdhpp.fsf@xxxxxxxxxxx>
Date: Wed, 16 Apr 2008 21:58:42 +0800

> I am sorry. Your solution was too luxurious.
> I was just hoping for one extra line, "back", in the right mouse menu:
> 
> w3m Mode
> back >
> w3m >
> bookmark >
> tab >
> 

OK! I understand. 

I made a simple menu for right-mouse-button like my firefox ;-p

Please put new code in ~/.emacs-w3m.el.
And you can set `w3m-rmouse-menubar' as

(setq w3m-rmouse-menubar
    '("w3m"
      ["Back to Previous Page"
       w3m-view-previous-page
       (w3m-history-previous-link-available-p)]))

;; -------------------------------------------
(defvar w3m-rmouse-menubar
  (let ((a (when w3m-use-japanese-menu
	     (decode-coding-string "\e$B%\"\e(B" 'iso-2022-jp)))) ;; ア
    `("w3m"
      [,(w3m-make-menu-item "前のページに戻る" "Back to Previous Page")
       w3m-view-previous-page
       (w3m-history-previous-link-available-p)]
      [,(w3m-make-menu-item "次のページに移動する" "Forward to Next Page")
       w3m-view-next-page
       (w3m-history-next-link-available-p)]
      [,(w3m-make-menu-item "上の階層に移動する" "Up to Parent Page")
       w3m-view-parent-page
       (w3m-parent-page-available-p)]
      "----" ;; separator
      [,(w3m-make-menu-item "このページを再取得する" "Reload This Page")
       w3m-reload-this-page w3m-current-url]
      [,(w3m-make-menu-item "すべてのページを再取得する" "Reload All Pages")
       w3m-reload-all-pages (cdr (w3m-list-buffers))]
      [,(w3m-make-menu-item "プロセスを中止する" "Cancel Process")
       w3m-process-stop w3m-current-process]))
  "*Menubar for click the right mouse button.")

(defadvice w3m-setup-menu (after make-rmouse-menu activate)
  (w3m-static-unless (featurep 'xemacs)
    (let ((map (make-sparse-keymap)))
      (easy-menu-define
	w3m-rmouse-menu map
	"w3m rmouse menu item" w3m-rmouse-menubar))))

(defun w3m-mouse-major-mode-menu (event)
  "Pop up a W3M mode-specific menu of mouse commands."
  (interactive "e")
  (mouse-set-point event)
  (let* ((bmkitems (if w3m-bookmark-mode
		       (cdr w3m-bookmark-menu-items)
		     (car w3m-bookmark-menu-items)))
	 (bmkmenu (if w3m-bookmark-menu-items-pre
		      `(,@bmkitems
			"----"
			,@w3m-bookmark-menu-items-pre)
		    bmkitems)))
    (w3m-static-if (featurep 'xemacs)
	(let (menubar)
	  (when current-menubar
	    (run-hooks 'activate-menubar-hook))
	  (setq menubar
		(cons "w3m"
		      (delq nil
			    `(,@(cdr w3m-rmouse-menubar)
			      "----"
			      "----"
			      ,(assoc "w3m" current-menubar)
			      "----"
			      ,(assoc "Bookmark" current-menubar)
			      ,(assoc "Tab" current-menubar)))))
	  (popup-menu menubar event))
      (run-hooks 'menu-bar-update-hook)
      (popup-menu (delete nil
			  `(,@w3m-rmouse-menubar
			    "----"
			    "----"
			    ,w3m-menubar
			    "----"
			    ,(cons "Bookmark" bmkmenu)
			    ,(when w3m-tab-menubar-make-items-preitems
			       (cons "Tab" w3m-tab-menubar-make-items-preitems))))
		  event))))

-- 
Hideyuki SHIRAI (mailto:shirai@xxxxxxxxxxx)
P.S.

作っていて、結構気に入ったので CVS に放り込もうと思うのですが、
反対の人いますか?