summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2025-07-07 17:57:45 +0800
committerJSDurand <mmemmew@gmail.com>2025-07-07 17:57:45 +0800
commitaed143d3eba709405c769f49b069967b06f4d274 (patch)
tree401ba678276027a812485d28c462aa5a97218bb6
parent5b43126c06f9eca04bfe2b9b47aaf65edae916e5 (diff)
input: Add my own keyboard layout.HEADmaster
* 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.
-rw-r--r--input-conf.el38
1 files changed, 38 insertions, 0 deletions
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