Zap the orderless `embark' family, tweak 'company', and clean up

This commit is contained in:
Gerard Vermeulen 2024-06-18 15:19:29 +02:00
parent 249b089ee8
commit 950b806f79

View File

@ -257,14 +257,10 @@ of [[info:emacs#Saving Customizations][saving customizations (info)]].
;; Pin packages to GNU ELPA or to MELPA STABLE for info and/or stability. ;; Pin packages to GNU ELPA or to MELPA STABLE for info and/or stability.
package-pinned-packages '((auctex . "gnu") package-pinned-packages '((auctex . "gnu")
(citar . "melpa-stable") (citar . "melpa-stable")
(citar-embark . "melpa-stable")
(compat . "gnu") (compat . "gnu")
(consult . "gnu") (consult . "gnu")
(dash . "melpa-stable") (dash . "melpa-stable")
(debbugs . "gnu") (debbugs . "gnu")
(denote . "gnu")
(embark . "gnu")
(embark-consult . "gnu")
(emms . "gnu") (emms . "gnu")
(engrave-faces . "gnu-devel") (engrave-faces . "gnu-devel")
(f . "melpa-stable") (f . "melpa-stable")
@ -1250,15 +1246,11 @@ sub makeglossaries {
[[info:vertico#Top][Vertico (info)]] provides a performant and minimalistic vertical completion UI [[info:vertico#Top][Vertico (info)]] provides a performant and minimalistic vertical completion UI
based on the default completion system and behaves therefore correctly under all based on the default completion system and behaves therefore correctly under all
circumstances. [[https://cestlaz.github.io/post/using-emacs-80-vertico/][Using Vertico, Marginalia, Consult, and Embark]] links to a video circumstances. [[https://cestlaz.github.io/post/using-emacs-80-vertico/][Using Vertico, Marginalia, Consult, and Embark]] links to a video
demonstration. Vertico integrates well with fully supported complementary demonstration. This setup completes Vertico with:
packages to enrich the completion UI: 1. [[info:marginalia#Top][Marginalia (info)]] for rich annotations in the minibuffer.
1. [[info:embark#Top][Embark (info)]] for minibuffer actions with context menus, 2. [[info:consult#Top][Consult (info)]] for useful search and navigation commands.
2. [[info:marginalia#Top][Marginalia (info)]] for rich annotations in the minibuffer, and
3. [[info:consult#Top][Consult (info)]] for useful search and navigation commands,
where the order is that of [[https://github.com/bdarcus/citar#installation][enhancing citar's experience]] and the configuration
steps below.
Finally, [[https://company-mode.github.io/][company: a modular complete-anything framework for Emacs]] provides Finally, [[https://company-mode.github.io/][Company: a modular complete-anything framework for Emacs]] can provide
completion in any buffer. completion in any buffer.
** [[info:vertico#Top][Vertico (info)]] ** [[info:vertico#Top][Vertico (info)]]
@ -1336,64 +1328,6 @@ documentation.
| vertico-scroll-up | scroll-up-command | {{{kbd(C-v)}}} | | vertico-scroll-up | scroll-up-command | {{{kbd(C-v)}}} |
|-------------------------------+----------------------------------+---------------------| |-------------------------------+----------------------------------+---------------------|
** [[info:orderless#Top][Orderless (info)]] :noexport:
:PROPERTIES:
:CUSTOM_ID: sec:orderless-configuration
:header-args:emacs-lisp: :tangle no
:END:
Listing [[lst:configure-orderless]] configures [[info:orderless#Company][orderless for company (info)]]. Note:
*Python editing is orders of magnitude faster after removal of Orderless*.
#+caption[Configure =orderless=]:
#+caption: Configure =orderless=.
#+name: lst:configure-orderless
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'marginalia)
(with-eval-after-load 'orderless
(setopt orderless-component-separator " +")
(defun just-one-face (fn &rest args)
(let ((orderless-match-faces [completions-common-part]))
(apply fn args)))
(advice-add 'company-capf--candidates :around #'just-one-face)))
#+end_src
** [[info:embark#Top][Embark (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:embark-configuration
:END:
Listing [[lst:bind-embark-commands][bind =embark= commands]] binds =embark= commands to the global key map:
1. =embark-act= prompts the user for an action and performs it. GAV: ~org-mode~
and ~embark~ do not play together nicely.
2. Except for highlighting of email and web URLs, =embark-dwim= englobes the
functionality of src_emacs-lisp[:results none]{(find-library "goto-addr")}
that activates mail and web URLs to turn them into clickable buttons. Since
=embark-dwim= acts on a superset of target types, it renders =goto-addr=
superfluous. See:
1. [[info:emacs#Goto Address mode][Goto Address mode (info)]].
2. [[info:embark#The default action on a target][The default (embark-dwim) action on a target (info)]].
3. =embark-bindings= allows to explore all current command key bindings in the
minibuffer.
4. The initialization of =prefix-help-command= enables minibuffer help after a
prefix key (for instance {{{kbd(C-x)}}} or {{{kbd(C-c)}}}) as typing
{{{kbd(C-x C-h)}}} or {{{kbd(C-c C-h)}}} shows.
#+caption[Bind =embark= commands globally]:
#+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'.
(when (ensure-package-installation 'embark-consult)
(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)]] ** [[info:marginalia#Top][Marginalia (info)]]
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: sec:marginalia-configuration :CUSTOM_ID: sec:marginalia-configuration
@ -1520,14 +1454,11 @@ configures =company= after ensuring the =company= installation.
#+name: lst:setup-company #+name: lst:setup-company
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'company) (when (ensure-package-installation 'company)
;; https://github.com/purcell/emacs.d/issues/778 ;; GAV: `desktop' may enable `company-mode' for files it remembers.
(setopt company-transformers '(company-sort-by-occurrence))
(add-hook 'LaTeX-mode-hook #'company-mode)
(add-hook 'org-mode-hook #'company-mode)
(add-hook 'emacs-lisp-mode-hook #'company-mode) (add-hook 'emacs-lisp-mode-hook #'company-mode)
(add-hook 'lisp-interaction-mode-hook #'company-mode) (add-hook 'lisp-interaction-mode-hook #'company-mode)
(add-hook 'lisp-mode-hook #'company-mode) (add-hook 'lisp-mode-hook #'company-mode)
(add-hook 'python-mode-hook #'company-mode) (add-hook 'python-mode-hook #'company-mode) ; works with `eglot'.
(add-hook 'ielm-mode-hook #'company-mode) (add-hook 'ielm-mode-hook #'company-mode)
(add-hook 'sly-mrepl-mode-hook #'company-mode)) (add-hook 'sly-mrepl-mode-hook #'company-mode))
#+end_src #+end_src
@ -2548,11 +2479,7 @@ processor, text to product converter) to an Emacs setup. Listing
#+caption: Set =oc= and =citar= options. #+caption: Set =oc= and =citar= options.
#+name: lst:set-oc+citar-options #+name: lst:set-oc+citar-options
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'citar 'citar-embark) (when (ensure-package-installation 'citar)
(with-eval-after-load 'embark
(when (fboundp 'citar-embark-mode)
(citar-embark-mode +1)))
(with-eval-after-load 'oc (with-eval-after-load 'oc
(setopt org-cite-export-processors '((latex biblatex) (setopt org-cite-export-processors '((latex biblatex)
(t csl)) (t csl))