diff options
Diffstat (limited to '.emacs.d')
-rw-r--r-- | .emacs.d/modules/thanos-commands.el | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/.emacs.d/modules/thanos-commands.el b/.emacs.d/modules/thanos-commands.el index 7dba0c7..3cb0f8c 100644 --- a/.emacs.d/modules/thanos-commands.el +++ b/.emacs.d/modules/thanos-commands.el @@ -232,6 +232,31 @@ (replace-regexp-in-string "\\.json" ".m3u8" url) name) nil 0))))) +;; Input methods +(defvar thanos/input-methods + '("greek" "bulgarian-phonetic" "nil") + "List of input methods to toggle.") + +(defvar thanos/input-methods-index 0 + "Index of the next input method in `thanos/input-methods' to use.") + +(defun thanos/toggle-input-method () + "Switch to the next input method in `thanos/input-methods'." + (interactive) + (setf thanos/input-methods-index + (mod (1+ thanos/input-methods-index) (length thanos/input-methods))) + (let ((input-method (nth thanos/input-methods-index thanos/input-methods))) + (set-input-method (if (string= "nil" input-method) nil input-method)))) + +(defun thanos/toggle-input-method () + "Switch to the next input method in `thanos/input-methods'." + (interactive) + (setf thanos/input-methods-index + (mod (1+ thanos/input-methods-index) (length thanos/input-methods))) + (let ((input-method (nth thanos/input-methods-index thanos/input-methods))) + (set-input-method (if (string= "nil" input-method) nil input-method)))) + +(define-key global-map (kbd "C-\\") #'thanos/toggle-input-method) (provide 'thanos-commands) ;;; thanos-commands.el ends here |