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

Re: make middle mouse key open a new window



From: jidanni@xxxxxxxxxxx said
Subject: [emacs-w3m:10785] make middle mouse key open a new window
Message-ID: <87y6uyqqsr.fsf@xxxxxxxxxxx>
Date: Sun, 22 Mar 2009 09:39:32 +0800

> I would like the middle mouse key to do like C-u C-u RET, view this
> URL in a new window, like Firefox. But I find the left and middle
> mouse keys are just bound to the same thing...

Yamaoka-san has already submitted the solution. 

From: Katsumi Yamaoka <yamaoka@xxxxxxx> said
Subject: [emacs-w3m:09458] Re: middle click to open url in new session
Message-ID: <b4mveemoodl.fsf@xxxxxxx>
Date: Mon, 21 May 2007 12:18:46 +0900

or http://emacs-w3m.namazu.org/ml/msg09350.html

;; put your ~/.w3m.el 

(define-key w3m-mode-map [mouse-2] 'w3m-mouse-view-this-url-new-session)

(defadvice mouse-drag-track (after replace-mouse-2-event activate)
  "Replace mounse-2 event with the key for `w3m-view-this-url' command.
This will be done only when mouse-1 is clicked in an emacs-w3m buffer
and `mouse-1-click-follows-link' is non-nil."
  (let ((keys (this-command-keys)))
    (if (and (vectorp keys)
	     (eq (car-safe (aref keys 0)) 'down-mouse-1)
	     (eq (car-safe (car unread-command-events)) 'mouse-2)
	     (with-current-buffer
		 (window-buffer
		  (posn-window (event-start (car unread-command-events))))
	       (eq major-mode 'w3m-mode)))
	(setcar unread-command-events
		(aref (car (where-is-internal 'w3m-view-this-url
					      w3m-mode-map))
		      0)))))


-- 
Hideyuki SHIRAI (mailto:shirai@xxxxxxxxxxx)