]> git.ekhem.eu.org Git - guix.git/commitdiff
[emacs] Simplify entering long keybindings.
authorJakub Czajka <jakub@ekhem.eu.org>
Fri, 23 Dec 2022 17:40:24 +0000 (18:40 +0100)
committerJakub Czajka <jczajka@google.com>
Sun, 24 Dec 2023 18:53:07 +0000 (19:53 +0100)
Emacs has a lot of built-in keybindings and users can define
more. They can be long. This commit installs which-key and
transient which help when entering long keybindings.

conf/home/emacs.scm
emacs/.config/emacs/conf/conf-keys.el [new file with mode: 0644]

index 584b77b7a772d44b433b94fd81b90dfbcc08cde8..0439f3fd0532049aeb37b991068e7e39203a4f18 100644 (file)
             (list "bash/.config/profile.d/50-notmuch.sh"
                   "emacs/.config/emacs/conf/conf-email.el")))))
 
+(define emacs-keys-service
+  (service home-program-service-type
+          (home-program-configuration
+           (packages
+            (list emacs-transient
+                  emacs-which-key))
+           (dotfiles
+            (list "emacs/.config/emacs/conf/conf-keys.el")))))
+
 (define emacs-package-service
   (service home-program-service-type
           (home-program-configuration
         emacs-dired-service
         emacs-document-service
         emacs-email-service
+        emacs-keys-service
         emacs-package-service
         emacs-pass-service
         emacs-service))
diff --git a/emacs/.config/emacs/conf/conf-keys.el b/emacs/.config/emacs/conf/conf-keys.el
new file mode 100644 (file)
index 0000000..3276ba9
--- /dev/null
@@ -0,0 +1,28 @@
+;; Copyright (c) 2022 Jakub Czajka <jakub@ekhem.eu.org>
+;; License: GPL-3.0 or later.
+;;
+;; conf-keys.el - configuration for keybinding completion.
+
+(require 'conf-package)
+
+(use-package which-key
+  :ensure t
+  :init
+  ;; Enable everywhere.
+  ;; `which-key-mode' is an autoload.
+  (which-key-mode)
+  :custom
+  (which-key-idle-delay 0.3)
+  (which-key-max-description-length 25)
+  (which-key-separator " ")
+  ;; Sort entries alphabetically.
+  (which-key-sort-order 'which-key-key-order-alpha)
+  :config
+  (which-key-setup-side-window-bottom))
+
+(use-package transient
+  :commands
+  (transient-define-prefix)
+  :ensure t)
+
+(provide 'conf-keys)