From: Jakub Czajka Date: Fri, 23 Dec 2022 17:40:24 +0000 (+0100) Subject: [emacs] Simplify entering long keybindings. X-Git-Url: https://git.ekhem.eu.org/?a=commitdiff_plain;h=57e7e88661892473dc59663143294ffa86ca2f86;p=guix.git [emacs] Simplify entering long keybindings. 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. --- diff --git a/conf/home/emacs.scm b/conf/home/emacs.scm index 584b77b..0439f3f 100644 --- a/conf/home/emacs.scm +++ b/conf/home/emacs.scm @@ -91,6 +91,15 @@ (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 @@ -133,6 +142,7 @@ 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 index 0000000..3276ba9 --- /dev/null +++ b/emacs/.config/emacs/conf/conf-keys.el @@ -0,0 +1,28 @@ +;; Copyright (c) 2022 Jakub Czajka +;; 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)