From aed143d3eba709405c769f49b069967b06f4d274 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Mon, 7 Jul 2025 17:57:45 +0800 Subject: input: Add my own keyboard layout. * input-conf.el ("durand-fr"): I use a French layout, where the arrangements of the keys are quite different than the "standard" layout, so previously it was quite inconvenient to use the quail packages, as I had to translate in my mind to the standard layout, so that the quail package can understand and input the correct keys. Today I discovered that the quail package actually provides a solution to this problem by the variable `quail-keyboard-layout`, which defines how to translate from a keyboard layout to the standard one. By defining my current French layout, I am now finally able to smoothly use the quail packages. One caveat is that the Chinese quail packages are generated from some dictionary files automatically, and the converter missed this functionality, so that by default the Chinese quail packages do not respect this keyboard layout translation. Currently I am overwriting the generated package, but clearly this is not a good practice. I might consider saving the generated and overwritten file to a special file, so that I can continue using that overwritten version in the future. --- input-conf.el | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'input-conf.el') diff --git a/input-conf.el b/input-conf.el index a735741..461b674 100644 --- a/input-conf.el +++ b/input-conf.el @@ -35,8 +35,12 @@ (remove-hook 'quail-activate-hook #'durand-zozy-remap-keys) +;;; Default input method + (setq-default default-input-method "devanagari-kyoto-harvard") +;;; Short-cut headlong selection of input methods. + (defvar durand-input-method-list nil "The list of input methods that I oft use.") @@ -62,5 +66,39 @@ (define-key global-map (vector ?\C-\\) #'durand-toggle-input) (define-key global-map (vector 3 ?i) #'durand-toggle-input) +;;; Custom french keyboard layout + +;; I am used to the french keyboard, so it would be most convenient if +;; the quail packages can automatically translate the keys according +;; to this layout. + +(cond + ((assoc "durand-fr" quail-keyboard-layout-alist #'string=) + (setcdr + (assoc "durand-fr" quail-keyboard-layout-alist #'string=) + "\ + \ + &1é2\"3'4(5§6è7!8ç9à0)°-_<> \ + aAzZeErRtTyYuUiIoOpP^¨$* \ + qQsSdDfFgGhHjJkKlLmMù%`£ \ + wWxXcCvVbBnN,?;.:/=+ \ + ")) + (t + (setq + quail-keyboard-layout-alist + (cons + (cons + "durand-fr" + "\ + \ + &1é2\"3'4(5§6è7!8ç9à0)°-_<> \ + aAzZeErRtTyYuUiIoOpP^¨$* \ + qQsSdDfFgGhHjJkKlLmMù%`£ \ + wWxXcCvVbBnN,?;.:/=+ \ + ") + quail-keyboard-layout-alist)))) + +(quail-set-keyboard-layout "durand-fr") + (provide 'input-conf) ;;; input-conf.el ends here -- cgit v1.2.3-18-g5258