Compare commits

...

2 Commits

1 changed files with 46 additions and 83 deletions

View File

@ -1386,17 +1386,13 @@ Listing [[lst:bind-embark-commands][bind =embark= commands]] binds =embark= comm
#+caption: Bind =embark= commands globally.
#+name: lst:bind-embark-commands
#+begin_src emacs-lisp -n :results silent
;; GAV: ~org-mode~ and ~embark~ do not play together nicely.
;; GAV: ~embark~ is a dependency of ~citar-embark~ and ~embark-consult~.
;; GAV: `org-mode' and `embark' do not play together nicely.
;; GAV: `embark' is a dependency of `citar-embark' and `embark-consult'.
(when (ensure-package-installation 'embark-consult)
(when (fboundp 'embark-act)
(keymap-global-set "C-," #'embark-act))
(when (fboundp 'embark-dwim)
(keymap-global-set "C-:" #'embark-dwim))
(when (fboundp 'embark-bindings)
(keymap-global-set "C-h B" #'embark-bindings))
(when (fboundp 'embark-prefix-help-command)
(setq prefix-help-command #'embark-prefix-help-command)))
(keymap-global-set "C-," #'embark-act)
(keymap-global-set "C-:" #'embark-dwim)
(keymap-global-set "C-h B" #'embark-bindings)
(setq prefix-help-command #'embark-prefix-help-command))
#+end_src
** [[info:marginalia#Top][Marginalia (info)]]
@ -1410,8 +1406,7 @@ Listing [[lst:enable-marginalia-mode]] enables =marginalia-mode=.
#+caption: Enable =marginalia-mode=.
#+name: lst:enable-marginalia-mode
#+begin_src emacs-lisp -n :results silent
(when (and (ensure-package-installation 'marginalia)
(fboundp 'marginalia-mode))
(when (ensure-package-installation 'marginalia)
(marginalia-mode +1))
#+end_src
@ -1429,9 +1424,42 @@ Consult usage tips are:
consult-mark)}}} or {{{kbd(M-g m)}}}. See [[https://arialdomartini.github.io//emacs-mark-ring][Emacs: Mark Ring]].
2. {{{kbd(M-x consult-org-heading)}}} or {{{kbd(C-c C-h)}}} is an alternative to
{{{kbd(M-x org-goto)}}} or {{{kbd(C-c C-j)}}}.
3. Listing [[lst:find-file-preview]] uses the internal functions
~consult--file-preview~ and ~consult--read~ to visit files with previewing
during selection. See: [[https://github.com/minad/consult/wiki][Consult Wiki]].
#+caption[Bind =consult= commands]:
#+caption: Bind =consult= commands.
#+name: lst:bind-consult-commands
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'consult)
;; C-c bindings (current-global-map)
(keymap-global-set "C-c h" #'consult-history)
(keymap-global-set "C-c m" #'consult-mode-command)
;; C-x bindings (ctl-x-map)
(keymap-set ctl-x-map "M-:" #'consult-complex-command)
(keymap-set ctl-x-map "b" #'consult-buffer)
(keymap-set ctl-x-4-map "b" #'consult-buffer-other-window)
(keymap-set ctl-x-5-map "b" #'consult-buffer-other-frame)
(keymap-set ctl-x-r-map "x" #'consult-register)
(keymap-set ctl-x-r-map "b" #'consult-bookmark)
;; M-g bindings (goto-map)
(keymap-set goto-map "g" #'consult-goto-line)
(keymap-set goto-map "M-g" #'consult-goto-line)
(keymap-set goto-map "o" #'consult-outline)
(keymap-set goto-map "m" #'consult-mark)
(keymap-set goto-map "k" #'consult-global-mark)
(keymap-set goto-map "i" #'consult-imenu)
(keymap-set goto-map "e" #'consult-compile-error)
(with-eval-after-load 'org
(keymap-set org-mode-map "C-c C-h" #'consult-org-heading))
;; M-s bindings (search-map)
(keymap-set search-map "g" #'consult-git-grep)
(keymap-set search-map "f" #'consult-find)
(keymap-set search-map "k" #'consult-keep-lines)
(keymap-set search-map "l" #'consult-line)
(keymap-set search-map "m" #'consult-multi-occur)
(keymap-set search-map "u" #'consult-focus-lines)
;; Other bindings (current-global-map)
(keymap-global-set "M-y" #'consult-yank-pop))
#+end_src
#+attr_latex: :booktabs yes :float table
#+caption[Configuration specific key bindings]:
@ -1480,70 +1508,6 @@ Consult usage tips are:
| org-store-link | global-map | {{{kbd(C-c l)}}} |
|-----------------------------+----------------------+--------------------|
#+caption[Bind =consult= commands]:
#+caption: Bind =consult= commands.
#+name: lst:bind-consult-commands
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'consult)
;; C-c bindings (current-global-map)
(keymap-global-set "C-c h" #'consult-history)
(keymap-global-set "C-c m" #'consult-mode-command)
;; C-x bindings (ctl-x-map)
(keymap-set ctl-x-map "M-:" #'consult-complex-command)
(keymap-set ctl-x-map "b" #'consult-buffer)
(keymap-set ctl-x-4-map "b" #'consult-buffer-other-window)
(keymap-set ctl-x-5-map "b" #'consult-buffer-other-frame)
(keymap-set ctl-x-r-map "x" #'consult-register)
(keymap-set ctl-x-r-map "b" #'consult-bookmark)
;; M-g bindings (goto-map)
(keymap-set goto-map "g" #'consult-goto-line)
(keymap-set goto-map "M-g" #'consult-goto-line)
(keymap-set goto-map "o" #'consult-outline)
(keymap-set goto-map "m" #'consult-mark)
(keymap-set goto-map "k" #'consult-global-mark)
(keymap-set goto-map "i" #'consult-imenu)
(keymap-set goto-map "e" #'consult-compile-error)
(with-eval-after-load 'org
(keymap-set org-mode-map "C-c C-h" #'consult-org-heading))
;; M-s bindings (search-map)
(keymap-set search-map "g" #'consult-git-grep)
(keymap-set search-map "f" #'consult-find)
(keymap-set search-map "k" #'consult-keep-lines)
(keymap-set search-map "l" #'consult-line)
(keymap-set search-map "m" #'consult-multi-occur)
(keymap-set search-map "u" #'consult-focus-lines)
;; Other bindings (current-global-map)
(keymap-global-set "M-y" #'consult-yank-pop))
#+end_src
#+caption[Implement =find-file= with previewing before selection]:
#+caption: Implement =find-file= with previewing before selection.
#+name: lst:find-file-preview
#+begin_src emacs-lisp -n :results silent
(defun consult-find-file-preview
(prompt &optional dir _default mustmatch initial predicate)
"Helper to implement previewing when calling `find-file'.
See `read-file-name' for the meaning of PROMPT, DIR, MUSTMATCH, INITIAL,
and PREDICATE."
(interactive)
(let ((default-directory (or dir default-directory))
(minibuffer-completing-file-name t))
(consult--read #'read-file-name-internal :state (consult--file-preview)
:prompt prompt :initial initial
:require-match mustmatch :predicate predicate)))
(defun toggle-find-file-preview ()
"Toggle previewing when calling `find-file'."
(interactive)
(let ((done "Enabled"))
(if (eq read-file-name-function #'read-file-name-default)
(setq read-file-name-function #'consult-find-file-preview)
(setq read-file-name-function #'read-file-name-default
done "Disabled"))
(message "%s `find-file' previewing" done)))
#+end_src
** [[https://company-mode.github.io/][Company (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:company-setup
@ -5763,10 +5727,9 @@ formatter for Python]].
#+caption: Configure =electric-operator=.
#+name: lst:configure-electric-operator
#+begin_src emacs-lisp -n :results silent
(when (and (ensure-package-installation 'electric-operator)
(fboundp 'electric-operator-mode))
(dolist (symbol '(c-mode-common-hook python-mode-hook))
(add-hook symbol #'electric-operator-mode)))
(when (ensure-package-installation 'electric-operator)
(add-hook 'c-mode-common-hook #'electric-operator-mode)
(add-hook 'python-mode-hook #'electric-operator-mode))
#+end_src
** [[https://joaotavora.github.io/yasnippet/][Smart snippets]]