[Top][All Lists]

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

How to recognize keyboard insertion?

From: Eli Zaretskii
Subject: How to recognize keyboard insertion?
Date: Sat, 31 Oct 2009 17:57:41 +0200

Do we have infrastructure for detecting, inside one of the functions
that insert text into buffers, characters that were inserted via the
keyboard or keyboard macros?

Failing that, can I safely assume that self-insert-command and its
optimized variant in command_loop_1 are the only ways to insert
characters from keyboard and keyboard macros, and that
self-insert-command is only supposed to be invoked by characters typed
at the keyboard?

I'm asking because, in bidirectional editing, characters that are
mirrored at display time need to be mirrored at keyboard input time.
For example, when typing right-to-left text, the character `)' should
be mirrored so that what ends up in the buffer is `(', because what
the user means is to produce an open parenthesis.  (Displaying this
text will then mirror again, and display `)'; this last part already
works in the bidi Emacs I'm working on).

So I need to mirror characters typed at the keyboard, but not
characters yanked from the kill ring or pasted from X selections.  How
can I discern the first kind from the second?


reply via email to

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