[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Interactive hat.
From: |
Alan Mackenzie |
Subject: |
Re: Interactive hat. |
Date: |
Wed, 25 Mar 2009 10:53:16 +0000 |
User-agent: |
Mutt/1.5.9i |
Hi, Miles!
On Wed, Mar 25, 2009 at 07:30:13PM +0900, Miles Bader wrote:
> Alan Mackenzie <address@hidden> writes:
> > How is an external library writer going to use the interactive "^"?
> > Assuming that the library should also work under XEmacs and Emacs 22,
> > just using the "^" won't work; an interactive string with "^" throws an
> > error in Emacs 22.
> Isn't that a pretty basic problem with _any_ extension to interactive?
> Do you think `interactive' should never be extended?
Yes, and yes. Or, rather, yes and yes except in the most exceptional of
circumstances, such as adding a new parameter type.
> In this case, I think the right solution would be to simply add another,
> possibly clunkier method for commands to indicate they want to enable
> shift-selection behavior.
Agreed.
> E.g.: have the command loop also look for a `handle-shift-select'
> property on command-name's plist, and treat that as it would "^" in the
> interactive string. Then external library authors who are worried about
> backwards compability could use (put COMMAND 'handle-shift-select t)
> instead of putting ^ in COMMAND's interactive string.
Agreed, except I wouldn't put it in the command loop - I'd put it in a
hook (pre-command-hook), for the same reason font-locking is in a hook
rather than directly in the command loop. M-x shift-select would
install/remove this function onto/from the hook.
Now the question arises, if we've got the property
`handle-shift-select', doesn't the "^" in the interactive string become
redundant?
> [Yeah, that only works for commands which are defined functions, but I
> think that's an acceptable limitation for a feature like this which
> should be used only rarely.]
Yes, a lambda expression can't use this. That's the only use of "^" I
can see which absolutely requires "^". But let's be honest, how often
do hackers write movement commands as anonymous lambdas?
> -Miles
> --
> "1971 pickup truck; will trade for gnus"
Hey, you can get gnus for nothing. :-)
--
Alan Mackenzie (Nuremberg, Germany).