[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: `mouse-save-then-kill' changes

From: Drew Adams
Subject: RE: `mouse-save-then-kill' changes
Date: Sun, 7 Nov 2010 20:42:01 -0800

> 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

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

If not, so be it.  I've already copied the code and modified it for my use.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]