[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Interactive hat. [Was: CUA-like stuff spuriously enables transient-mark-
From: |
Alan Mackenzie |
Subject: |
Interactive hat. [Was: CUA-like stuff spuriously enables transient-mark-mode] |
Date: |
Wed, 25 Mar 2009 10:16:50 +0000 |
User-agent: |
Mutt/1.5.9i |
Hi, Stefan,
On Tue, Mar 24, 2009 at 09:38:29PM -0400, Stefan Monnier wrote:
> >> Where do you see it hardcoded in the command loop?
> > In Fcall_interactively, Lines 207 and 231, where it is interpreting the
> > interactive string:
> > else if (*string == '^')
> > {
> > if (! NILP (Vshift_select_mode))
> > call1 (Qhandle_shift_selection, Qnil); <================
> > /* Even if shift-select-mode is off, temporarily active
> > regions could be set using the mouse, and should be
> > deactivated. */
> > else if (CONSP (Vtransient_mark_mode)
> > && EQ (XCAR (Vtransient_mark_mode), Qonly))
> > call1 (Qhandle_shift_selection, Qt); <================
> > string++;
> > }
> > .
> I see. I guess we just disagree on what is meant by "hardcoded in the
> command loop": this code is explicitly requested by the "^" code in the
> `interactive' string of a command, so it seems (to me) pretty far from
> "hardcoded in the command loop".
It's hard-coded to the shift-key, rather than using the normal Emacs
mechanism of putting the "shifted" versions of movement commands into a
minor mode map. Interactive strings which use "^" are incompatible with
other Emacs versions. This will cause problems.
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.
The next try is to use a macro which will generate an appropriate
interactive string. Something like:
(defmacro foo-interactive (s-22 s-23)
"doc string"
`(interactive ,(if (emacs-got-interactive-hat) s-23 s22)))
, but I can't get defun to take a macro-generated interactive string. I
suspect it's not possible. It seems to work, sort of, in byte-compiled
defuns.
Could we supply some sort of macro which will add "^" to an interactive
string? Then at least each external library author won't have to figure
it out himself.
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
- Interactive hat. [Was: CUA-like stuff spuriously enables transient-mark-mode],
Alan Mackenzie <=
- Re: Interactive hat., Miles Bader, 2009/03/25
- Re: Interactive hat., Alan Mackenzie, 2009/03/25
- Re: Interactive hat., Miles Bader, 2009/03/25
- Re: Interactive hat., Alan Mackenzie, 2009/03/26
- Re: Interactive hat., David Kastrup, 2009/03/26
- Re: Interactive hat., Alan Mackenzie, 2009/03/26
- Re: Interactive hat., Stefan Monnier, 2009/03/26