[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: middle click to open url in new session
----- Katsumi Yamaoka (2007-05-21) wrote:-----
>> I have been using this trick for quite sometime now. But recently I
>> start using Emacs in xterm and this trick will always open a link in a
>> new tab. Can this be fixed?
>
>> To use mouse in xterm, you need to have xterm-mouse-mode enabled.
>
> This will work with both X and xterm:
>
> (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)))))
>
It works like a charm ;)
--
Leo <sdl.web AT gmail.com> (GPG Key: 9283AA3F)