Skip to content

Instantly share code, notes, and snippets.

@mrvdb
Created May 23, 2014 10:24
Show Gist options
  • Save mrvdb/569e63f69122369faa4b to your computer and use it in GitHub Desktop.
Save mrvdb/569e63f69122369faa4b to your computer and use it in GitHub Desktop.
;; Register a new input method
(register-input-method
"MyTeX" "UTF-8" 'quail-use-package
"\\" "Personalized TeX input method"
"~/.emacs.d/mytex-inputmethod")
(defun mrb/set-input-method()
(interactive)
(setq default-input-method "MyTeX")
;; Toggle only if it not active yet
(if (not current-input-method)
(toggle-input-method)))
(add-hook 'set-language-environment-hook 'mrb/set-input-method)
;; And now we can set it
(set-language-environment "UTF-8")
;; So we have it active at this point, but for new buffers it's still
;; not active, let's do that for the most common modes I use
;; FIXME: this works ok-ish, but is not a very clean solution I think.
(add-hook 'text-mode-hook 'mrb/set-input-method)
;; Orgmode is derived from outline-mode -> text-mode so this should already work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment