How can I get mouse selection to work in emacs and iTerm2 on Mac?
For Emacs in iTerm 2, I've found that the following bit in my ~/.emacs
file works very well, providing the ability to insert the character at an arbitrary location, mark a region, and use the scroll wheel:
;; Enable mouse support
(unless window-system
(require 'mouse)
(xterm-mouse-mode t)
(global-set-key [mouse-4] (lambda ()
(interactive)
(scroll-down 1)))
(global-set-key [mouse-5] (lambda ()
(interactive)
(scroll-up 1)))
(defun track-mouse (e))
(setq mouse-sel-mode t)
)
I put this in my .emacs:
(require 'mouse)
(xterm-mouse-mode t)
(defun track-mouse (e))
(setq mouse-sel-mode t)
and that seems to do the trick, and now a mouse click in a split changes focus to the split.
Note: I am using iterm2, and I found the info here: http://groups.google.com/group/iterm2-discuss/browse_thread/thread/8e1f2ee7db26c07d/17ac15e69c554998?show_docid=17ac15e69c554998&pli=1