all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to bind a command to mouse-1 properly?
@ 2012-12-12  7:36 Dmitry Gutov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Gutov @ 2012-12-12  7:36 UTC (permalink / raw)
  To: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: How to bind a command to mouse-1 properly?
@ 2012-12-12  9:42 martin rudalics
  2012-12-12 10:01 ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2012-12-12  9:42 UTC (permalink / raw)
  To: dgutov; +Cc: help-gnu-emacs

 > If I bind a command other than `mouse-set-point' to [mouse-1], the mark
 > is active after the mouse click.

I suppose this issue was discussed in bug#9541 and in

http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00399.html

martin



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-12 12:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-12  7:36 How to bind a command to mouse-1 properly? Dmitry Gutov
  -- strict thread matches above, loose matches on Subject: below --
2012-12-12  9:42 martin rudalics
2012-12-12 10:01 ` Dmitry Gutov
2012-12-12 10:21   ` martin rudalics
2012-12-12 11:25     ` Dmitry Gutov
2012-12-12 12:43       ` martin rudalics

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.