I am reading the 8.1.2 The Body of zap-to-char of Elisp Introduction

The body of zap-to-char

 (if (char-table-p translation-table-for-input)
     (setq char (or (aref translation-table-for-input char) char)))
 (kill-region (point) (progn
                        (search-forward (char-to-string char) nil nil arg)

What does the variable translation-table-for-input do here?

Its default value is 'nil` by my emacs setting.

  • 1
    Have you asked Emacs? C-h v translation-table-for-input gives you a summary, and C-h S translation-table-for-input takes you to the info node C-h i g (elisp)Translation of Characters which tells you more about translation tables. – phils Apr 7 '20 at 10:41

What does variable translation-table-for-input do here?

It potentially translates char to some other char.

(setq char (or (aref translation-table-for-input char) char))

is saying: "if char has a mapping in translation-table-for-input then use that; otherwise keep its original value".

That then affects what the subsequent search is searching for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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