From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.help Subject: How to bind a command to mouse-1 properly? Date: Wed, 12 Dec 2012 11:36:09 +0400 Message-ID: <87y5h3lo2e.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1355297801 1767 80.91.229.3 (12 Dec 2012 07:36:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Dec 2012 07:36:41 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 12 08:36:54 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Tigs4-0002IJ-3T for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Dec 2012 08:36:48 +0100 Original-Received: from localhost ([::1]:59588 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tigrr-0005Xl-5p for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Dec 2012 02:36:35 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tigrh-0005WK-0e for help-gnu-emacs@gnu.org; Wed, 12 Dec 2012 02:36:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tigre-0000Bs-QB for help-gnu-emacs@gnu.org; Wed, 12 Dec 2012 02:36:24 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:56062) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tigre-0000Bn-Jp for help-gnu-emacs@gnu.org; Wed, 12 Dec 2012 02:36:22 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Tigro-00021Q-Du for help-gnu-emacs@gnu.org; Wed, 12 Dec 2012 08:36:32 +0100 Original-Received: from 178.252.98.87 ([178.252.98.87]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 Dec 2012 08:36:32 +0100 Original-Received: from dgutov by 178.252.98.87 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 Dec 2012 08:36:32 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 26 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 178.252.98.87 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) Cancel-Lock: sha1:T/b1bU0p6QjXWU8Ne3XOHPjjQ2g= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88142 Archived-At: 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