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: RE: `mouse-save-then-kill' changes Date: Sun, 7 Nov 2010 20:42:01 -0800 Message-ID: <7A994E9631EC4CA18888238DFF8EB246@us.oracle.com> References: <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 1289191417 14523 80.91.229.12 (8 Nov 2010 04:43:37 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 8 Nov 2010 04:43:37 +0000 (UTC) Cc: emacs-devel@gnu.org To: "'Stefan Monnier'" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 08 05:43:33 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 1PFJZp-0002Dw-Kb for ged-emacs-devel@m.gmane.org; Mon, 08 Nov 2010 05:43:30 +0100 Original-Received: from localhost ([127.0.0.1]:56365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFJZp-0003YY-4a for ged-emacs-devel@m.gmane.org; Sun, 07 Nov 2010 23:43:29 -0500 Original-Received: from [140.186.70.92] (port=46118 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFJZg-0003Xq-BP for emacs-devel@gnu.org; Sun, 07 Nov 2010 23:43:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PFJZf-0005uV-7q for emacs-devel@gnu.org; Sun, 07 Nov 2010 23:43:20 -0500 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:17317) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PFJZf-0005u1-2G for emacs-devel@gnu.org; Sun, 07 Nov 2010 23:43:19 -0500 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id oA84hFRd016527 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 8 Nov 2010 04:43:17 GMT Original-Received: from acsmt355.oracle.com (acsmt355.oracle.com [141.146.40.155]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id oA7Nef8a023136; Mon, 8 Nov 2010 04:43:14 GMT Original-Received: from abhmt003.oracle.com by acsmt353.oracle.com with ESMTP id 755683841289191319; Sun, 07 Nov 2010 20:41:59 -0800 Original-Received: from dradamslap1 (/10.159.221.90) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 07 Nov 2010 20:41:59 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Act+9nnBW0sFgNvZQkKPxesYR2uATAAAL3KQ 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:132438 Archived-At: > I obviously can't, since I don't know what you're actually doing. I think I was pretty clear. I'm substituting another action for the delete/kill region action that happens when you click `mouse-3' a second time at the same place. (I even mentioned what I'm substituting for it, although that is irrelevant.) In the past, the delete/kill region action was done by function `mouse-save-then-kill-delete-region', so it was enough to bind that symbol to a different function (using `flet'). Or to advise that function (`around' with no `ad-do-it'). Trivial. Now, that separate function (`m-s-t-k-d-r') is no longer used in `mouse-save-then-kill' (it is still used for the secondary selection, however). The delete/kill region code is now in line instead. It is only 3 lines now, so that is an understandable change. Result: to substitute something (anything) for the delete/kill action now requires copying all of the `m-s-t-k' code and replacing just those 3 lines. > This said, rather than ask us to write the code differently > so that you can override an internal function (which is likely to get > renamed/inlined/changed at some point in the future), I recommend you > ask for a hook instead. I don't see how a hook would help, since I want to do something other than, not something in addition to, deleting/killing the region. If there were a separate function for that action then I could either `defadvice' it or `flet' the function symbol around a call to `mouse-save-then-kill' (what I did previously). Better yet would be for you to define a function _variable_ and have the `m-s-t-k' code funcall that. The default value would be a function that deletes/kills the region: exactly the 3 lines used today. Keep in mind that `mouse-save-then-kill' is a complex function that operates differently depending on the historical context (e.g. whether it is called twice in succession at the same position). The code represents not one action but a logical sequence of possible actions. The action associated with a second `mouse-3' click at the same place is only one part of that complex sequence: the part that deletes/kills the region. That particular action is almost an arbitrary choice for that particular click. One can easily conceive of other, alternative actions for that final `mouse-3' click, keeping the rest of the sequence: `mouse-1' (possibly double etc. clicks)..., previous `mouse-3' click(s) at different positions.... That means separating out the final `mouse-3' click action as something variable. Anyway, I simply _asked if there was any chance_ of your creating a separate function for those 3 lines. I would like to see that. And preferably with that function being just the default value of a function variable that gets funcalled. If not, so be it. I've already copied the code and modified it for my use.