[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to bind a command to mouse-1 properly?
From: |
Dmitry Gutov |
Subject: |
How to bind a command to mouse-1 properly? |
Date: |
Wed, 12 Dec 2012 11:36:09 +0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) |
Hi all,
If I bind a command other than `mouse-set-point' to [mouse-1], the mark
is active after the mouse click. Example:
1. (global-set-key [mouse-1] (lambda (e) (interactive "e")
(mouse-set-point e)))
2. Click somewhere in a buffer.
3. Press `C-s', then search for some existing word.
=> the region will be active and span from the position of the click to
the new point.
If, on the other hand,
1. (global-set-key [mouse-1] 'mouse-set-point)
2, 3: same as before.
=> the region is not active.
Should I (setq deactivate-mark t) inside the command body?
--Dmitry
- How to bind a command to mouse-1 properly?,
Dmitry Gutov <=