I can activate the input method french-azerty
by M-x set-input-method RET french-azerty
. Then by a qwerty
keyboard I can type like an azerty
one. Thus typying q
in the buffer gives a
. But when I do M-: (insert "q")
it gives q
instead of a
. Is there a way that the evaluations takes into account the chosen input-method? i.e. M-: (insert "qwerty")
gives azerty
?
1 Answer
When you evaluate (insert "qwerty")
the lisp reader creates a string object with the literal value "qwerty". No input method functionality is able to intervene there.
The input method has already done its work by the time a character is inserted into a buffer, such that (using your example) typing q would result in (insert "a")
, not (insert "q")
.
insert
itself is a very low-level function. The only manipulation that happens to its argument is to ensure that unibyte data is not inserted into a multibyte buffer, or vice versa.
However, if you're talking about writing a function to insert text into a buffer, there's absolutely no reason why you would need that sort of magic, because you'll be in a position to process the text however you wish before calling insert
.
insert
bypasses the input-method. Whenfrench-azerty
is activated, typyingqwerty
in the buffer givesazerty
. I don't underestand why(insert "qwerty")
doesn't givesazerty
? So how an insert-method insert a text? A related [discussion][1] on SO allows to use an input method in minibuffer. [1]: stackoverflow.com/questions/15169428/…