summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2025-07-06 17:48:14 +0800
committerJSDurand <mmemmew@gmail.com>2025-07-06 17:48:14 +0800
commit43811c932c9b206c33943f3c41b886141fb28069 (patch)
treebf2056b7b08376e3fe064de5bc3274fd4da27fb4
parentf625d194fbac2e31f2d932863479586ffb0045dc (diff)
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.
-rw-r--r--input-conf.el25
1 files changed, 25 insertions, 0 deletions
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