C-x RET \ or
M-x set-input-method to select the text input method; e.g. I use
I must say
C-\ is genius, because it brings you back to the default input which you use the most.
I want Emacs to automatically detect the entered text method and accordingly change the default font (
font0 for English) as I enter the text input method to either
font1 in case of Greek or
font2 in case of Hebrew.
How to achieve this in Emacs 24.3.1 by Elisp in .emacs?
Platform: Windows 7-32bit.
This is my trial:
(defun font-for-input () (cond ((equal current-input-method nil) (face-remap-add-relative 'default :family "Consolas" :height 110)) ((string-equal current-input-method "greek") (face-remap-add-relative 'default :family "Romans" :height 120)) ((string-equal current-input-method "hebrew") (face-remap-add-relative 'default :family "DejaVu Sans" :height 120)) ) ) (font-for-input)
So there are three states:
nil: Consolas 11 or by hitting
C-\ to deactivate
set-input-method and return to default (English in my case)
Greek: change to Romans 12
Hebrew: change to DejaVu Sans 12
Interesting, this is my first code in Elisp! it works but clumsy. I want Emacs to automagically change these fonts as it detects the
current-input-method if any? Any suggestions to improve the code (more consice) are appreciated.
Ok, I admit this seems totally silly and impractical. I think what I need actually is 3 key bindings -- one for each language or input method (English, Greek, and Hebrew). Hitting either one should set-input-method to that language and change font accordingly and hook that to whatever buffer in current use -- be it text, org mode or TeX, etc. Any help?