From: "Drew Adams" <drew.adams@oracle.com>
To: "'Stefan Monnier'" <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: RE: `mouse-save-then-kill' changes
Date: Sun, 7 Nov 2010 20:42:01 -0800 [thread overview]
Message-ID: <7A994E9631EC4CA18888238DFF8EB246@us.oracle.com> (raw)
In-Reply-To: <jwvoca0tro8.fsf-monnier+emacs@gnu.org>
> 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.
next prev parent reply other threads:[~2010-11-08 4:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-05 17:49 `mouse-save-then-kill' changes Drew Adams
2010-11-07 19:01 ` Stefan Monnier
2010-11-07 20:36 ` Drew Adams
2010-11-08 3:38 ` Stefan Monnier
2010-11-08 4:42 ` Drew Adams [this message]
2010-11-08 9:11 ` tomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7A994E9631EC4CA18888238DFF8EB246@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.