[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Shift selection using interactive spec
From: |
Juri Linkov |
Subject: |
Re: Shift selection using interactive spec |
Date: |
Wed, 26 Mar 2008 12:48:22 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) |
>> As an honest-to-god USER of Emacs, I want to say I completely agree
>> with Kim, here. Since I discovered cua-mode, I've had the following
>> code in my .emacs:
>>
>>> (let ((move-fns '(c-forward-conditional c-backward-conditional
>>> c-down-conditional c-up-conditional
>>> c-down-conditional-with-else
>>> c-up-conditional-with-else
>>> c-beginning-of-statement c-end-of-statement)))
>>> (require 'cua-base)
>>> (dolist (symbol move-fns)
>>> (unless (eq 'move (get symbol 'CUA))
>>> (display-warning 'emacs (format "Adding CUA property to `%s'."
>>> symbol))
>>> (setf (get symbol 'CUA) 'move))))
>>
>> All I have to do to make an existing command support shift-select is
>> add its name to the list. (The move-fns list used to be a lot longer
>> when I was using Emacs 21.)
>
> Changing a command's behavior after the thought can be dealt with by
> using advice.
>
> Attaching properties is a can of worms that does not work for anonymous
> functions.
But an interactive code does not work when a spec is a Lisp expression
that is not a string. So just as an interactive Lisp expression should
call a special function `shift-translation-handler' explicitly,
anonymous functions can call the same function as well (though it is
not recommended to use anonymous functions for commands). So both these
approaches are on a par in this regard.
But using properties seems to be more preferable since there is a need to
implement more related features like delete-selection-mode and inventing
more funny interactive codes doesn't seem like a wise thing to do.
The only problem I see is that properties currently are hard to discover.
I think that just as `C-h f' describe-function displays information
when the function is advised, we should change `C-h v' describe-variable
to display information about attached variable properties as well.
Also as Kim already noted supporting external packages using the
interactive specification code approach would be a nightmare.
So it seems it would be the best to go the way Kim suggested and
just reimplement in C cua-selection-mode with properties that was
proven by time and experience to be the right solution.
--
Juri Linkov
http://www.jurta.org/emacs/
- Re: Shift selection using interactive spec, (continued)
- Re: Shift selection using interactive spec, Chong Yidong, 2008/03/18
- Re: Shift selection using interactive spec, Stefan Monnier, 2008/03/18
- Re: Shift selection using interactive spec, Chong Yidong, 2008/03/18
- Re: Shift selection using interactive spec, Stefan Monnier, 2008/03/18
- Re: Shift selection using interactive spec, Kim F. Storm, 2008/03/18
- Re: Shift selection using interactive spec, Lennart Borgman (gmail), 2008/03/18
- Re: Shift selection using interactive spec, M Jared Finder, 2008/03/19
- Re: Shift selection using interactive spec, David Kastrup, 2008/03/26
- Re: Shift selection using interactive spec,
Juri Linkov <=
- Re: Shift selection using interactive spec, David Kastrup, 2008/03/26
- Re: Shift selection using interactive spec, Lennart Borgman (gmail), 2008/03/26
- Re: Shift selection using interactive spec, Juri Linkov, 2008/03/26
- Re: Shift selection using interactive spec, David Kastrup, 2008/03/26
- Re: Shift selection using interactive spec, Johan Bockgård, 2008/03/26
- Re: Shift selection using interactive spec, David Kastrup, 2008/03/26
- Re: Shift selection using interactive spec, Stefan Monnier, 2008/03/26
- Re: Shift selection using interactive spec, Juri Linkov, 2008/03/26
- Re: Shift selection using interactive spec, Lennart Borgman (gmail), 2008/03/26
- Re: Shift selection using interactive spec, Richard Stallman, 2008/03/26