]> git.ekhem.eu.org Git - guix.git/commitdiff
[emacs] Configure consult.
authorJakub Czajka <jakub@ekhem.eu.org>
Fri, 23 Dec 2022 16:41:28 +0000 (17:41 +0100)
committerJakub Czajka <jczajka@google.com>
Sun, 24 Dec 2023 18:53:07 +0000 (19:53 +0100)
`completing-read` is the standard emacs function for reading
input. Consult extends `completing-read` based on the context in which
it runs.

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

index 0b26c69207311b5ece4c1fb3fef3ec629bfc0631..5dedf4a93f6112ba8275b95bda409456c5c8c9ea 100644 (file)
@@ -9,6 +9,7 @@
   #:use-module (gnu home services shepherd)
   #:use-module (gnu packages emacs)
   #:use-module (gnu packages emacs-xyz)
+  #:use-module (gnu packages rust-apps)
   #:use-module (gnu services)
   #:use-module (guix gexp)
   #:export (emacs-services))
            (dotfiles
             (list "emacs/.config/emacs/conf/conf-calendar.el")))))
 
+(define emacs-consult-service
+  (service home-program-service-type
+          (home-program-configuration
+           (packages
+            (list emacs-consult
+                  ripgrep))
+           (dotfiles
+            (list "emacs/.config/emacs/conf/conf-consult.el")))))
+
 (define emacs-daemon-shepherd-service
   (shepherd-service
    (provision '(emacs))
@@ -68,6 +78,7 @@
 (define emacs-services
   (list emacs-batch-edit-service
         emacs-calfw-service
+        emacs-consult-service
        emacs-daemon-service
         emacs-package-service
         emacs-service))
diff --git a/emacs/.config/emacs/conf/conf-consult.el b/emacs/.config/emacs/conf/conf-consult.el
new file mode 100644 (file)
index 0000000..d930bcd
--- /dev/null
@@ -0,0 +1,40 @@
+;; Copyright (c) 2022 Jakub Czajka <jakub@ekhem.eu.org>
+;; License: GPL-3.0 or later.
+;;
+;; conf-consult.el - configuration for the consult package.
+
+(require 'conf-package)
+
+(use-package consult
+  :ensure t
+  :bind
+  ("C-c ca"                         . consult-apropos)
+  ([remap bookmark-jump]            . consult-bookmark)
+  ([remap switch-to-buffer]         . consult-buffer)
+  ("C-c cf"                         . consult-find)
+  ([remap goto-line]                . consult-goto-line)
+  ("C-c ci"                         . consult-imenu)
+  ("C-c cI"                         . consult-imenu-multi)
+  ("C-c cl"                         . consult-line)
+  ([remap project-switch-to-buffer] . consult-project-buffer)
+  ([remap jump-to-register]         . consult-register)
+  ([remap point-to-register]        . consult-register-store)
+  :custom
+  ;; Search in hidden folders as well.
+  (consult-find-args "find .")
+  (consult-narrow-key "<"))
+
+(use-package consult
+  :when
+  (conf:executables-p (list "rg"))
+  :bind
+  ("C-c cr" . consult-ripgrep))
+
+(use-package consult
+  :requires
+  (conf-org)
+  :bind
+  (:map org-mode-map
+       ("C-c ch" . consult-org-heading)))
+
+(provide 'conf-consult)