2

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?

2
  • @phils I would like to write inserting macros/functions which uses the full functionality of a specific input-method (e.g. french-azerty). But it seems that insert bypasses the input-method. When french-azerty is activated, typying qwerty in the buffer gives azerty. I don't underestand why (insert "qwerty") doesn't gives azerty? 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/…
    – Name
    Commented Jan 11, 2015 at 21:11
  • @phils If you are certain that an input-method cannot intervene when inserting, please convert your comments to an answer in order that I may be able to mark it as an accepted answer.
    – Name
    Commented Jan 12, 2015 at 12:44

1 Answer 1

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.