From 43811c932c9b206c33943f3c41b886141fb28069 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sun, 6 Jul 2025 17:48:14 +0800 Subject: input: Convenient toggling between frequently used methods. * input-conf.el (durand-input-method-list): This is a list of my frequently used input methods. (durand-toggle-input): A function to choose amongst the above list of input methods. This function reads a method in the "headlong" manner, so that oft one only needs to press a letter to select an input method, making it behave sort of like a more flexible keymap. (global-map): Replace the binding of the function `toggle-input-method` by the above function. --- input-conf.el | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'input-conf.el') diff --git a/input-conf.el b/input-conf.el index 986286a..a735741 100644 --- a/input-conf.el +++ b/input-conf.el @@ -37,5 +37,30 @@ (setq-default default-input-method "devanagari-kyoto-harvard") +(defvar durand-input-method-list nil + "The list of input methods that I oft use.") + +(setq durand-input-method-list + (list "devanagari-kyoto-harvard" + "tamil99" + "chinese-zozy")) + +(defun durand-toggle-input () + "Toggle input method with my customizations." + (interactive) + (cond + ((null current-input-method) + (let ((input-method + (minibuffer-with-setup-hook + #'durand-headlong-minibuffer-setup-hook + (completing-read + "Input method: " durand-input-method-list + nil t nil nil "devanagari-kyoto-harvard")))) + (activate-input-method input-method))) + ((deactivate-input-method)))) + +(define-key global-map (vector ?\C-\\) #'durand-toggle-input) +(define-key global-map (vector 3 ?i) #'durand-toggle-input) + (provide 'input-conf) ;;; input-conf.el ends here -- cgit v1.2.3-18-g5258