From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: `mouse-save-then-kill' changes Date: Fri, 5 Nov 2010 10:49:37 -0700 Message-ID: <59B673DED28140FEBB895891578B6202@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1288979500 22015 80.91.229.12 (5 Nov 2010 17:51:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 5 Nov 2010 17:51:40 +0000 (UTC) To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 05 18:51:36 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PEQRq-0006YZ-UN for ged-emacs-devel@m.gmane.org; Fri, 05 Nov 2010 18:51:35 +0100 Original-Received: from localhost ([127.0.0.1]:46729 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PEQRq-000088-Dk for ged-emacs-devel@m.gmane.org; Fri, 05 Nov 2010 13:51:34 -0400 Original-Received: from [140.186.70.92] (port=37898 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PEQRk-00007P-H1 for emacs-devel@gnu.org; Fri, 05 Nov 2010 13:51:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PEQRi-0006ak-Ds for emacs-devel@gnu.org; Fri, 05 Nov 2010 13:51:28 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:29846) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PEQRi-0006ZZ-8w for emacs-devel@gnu.org; Fri, 05 Nov 2010 13:51:26 -0400 Original-Received: from rcsinet13.oracle.com (rcsinet13.oracle.com [148.87.113.125]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id oA5HpKQK016376 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 5 Nov 2010 17:51:21 GMT Original-Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by rcsinet13.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id oA5HpKLR016090 for ; Fri, 5 Nov 2010 17:51:20 GMT Original-Received: from abhmt002.oracle.com by acsmt354.oracle.com with ESMTP id 753923461288979376; Fri, 05 Nov 2010 10:49:36 -0700 Original-Received: from dradamslap1 (/10.159.216.226) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 05 Nov 2010 10:49:36 -0700 X-Mailer: Microsoft Office Outlook 11 Thread-Index: Act9EdCGSTQHbNoVR6Chj4JCel69BQ== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:132404 Archived-At: `mouse-save-then-kill' has been changed quite a bit for Emacs 24. I'm trying to adjust my code to the changes. Until now, it called `mouse-save-then-kill-delete-region' to kill/delete the text when you click the same spot. (`mouse-secondary-save-then-kill' still does this.) This made it possible to simply flet-bind `mouse-save-then-kill-delete-region' in order to get an alternative behavior to the killing/deleting part. In my case, in *Completions* I flet-bind it to a command `foobar' that picks up the selected candidates and saves them to a list for special processing. That is, in *Completions* I bind `mouse-3' to a command that does this: (defun foo (&optional arg) (interactive "e\nP") (flet ((mouse-save-then-kill-delete-region (beg end) (foobar nil arg))) (mouse-save-then-kill click)) (setq this-command 'mouse-save-then-kill)) Now (Emacs 24) I have to (a) duplicate all of the code of `mouse-save-then-kill', (b) replace the 3 lines that delete or kill the region by a call to `foobar', and (c) change references to `mouse-save-then-kill' within the new command to the new command name - e.g. places where the code checks `(eq last-command 'mouse-save-then-kill)'. That's quite ugly, for something that used to be simple. Any chance of your moving the 3 kill/delete lines out of `mouse-save-then-kill' into a function, like this? (defun mouse-kill/delete-region (pt) "Kill or delete region, according to `mouse-drag-copy-region'." (if mouse-drag-copy-region (delete-region (mark t) (point)) (kill-region (mark t) (point)))) (You cannot name this function `mouse-save-then-kill-delete-region' since that function still exists and is used for the secondary selection.)