selectrum: add icon support

Use the package `all-the-icons-completion` to add icons to vertical
completion buffers.
This commit is contained in:
Itai Y. Efrat 2021-07-04 04:15:58 +03:00
parent 92586cacd4
commit d86375a468
5 changed files with 17 additions and 4 deletions

View file

@ -46,7 +46,7 @@ completion.
+ helm =+fuzzy +childframe= - *Another* search engine for love and life + helm =+fuzzy +childframe= - *Another* search engine for love and life
+ ido - The /other/ *other* search engine for love and life + ido - The /other/ *other* search engine for love and life
+ [[file:../modules/completion/ivy/README.org][ivy]] =+fuzzy +prescient +childframe +icons= - /The/ search engine for love and life + [[file:../modules/completion/ivy/README.org][ivy]] =+fuzzy +prescient +childframe +icons= - /The/ search engine for love and life
+ [[file:../modules/completion/selectrum/README.org][selectrum]] =+prescient= - The search engine of the future + [[file:../modules/completion/selectrum/README.org][selectrum]] =+prescient +icons= - The search engine of the future
* :config * :config
Modules that configure Emacs one way or another, or focus on making it easier Modules that configure Emacs one way or another, or focus on making it easier

View file

@ -26,6 +26,7 @@ TODO
** Module Flags ** Module Flags
+ ~+prescient~ Enables prescient filtering and sorting for Selectrum searches + ~+prescient~ Enables prescient filtering and sorting for Selectrum searches
instead of orderless. instead of orderless.
+ ~+icons~ Adds icons to ~file~ and ~buffer~ category completion selections.
** Plugins ** Plugins
[[https://github.com/minad/vertico][vertico]] (~+vertico~, experimental for the moment) [[https://github.com/minad/vertico][vertico]] (~+vertico~, experimental for the moment)
@ -38,6 +39,7 @@ TODO
[[https://github.com/mhayashi1120/Emacs-wgrep][wgrep]] [[https://github.com/mhayashi1120/Emacs-wgrep][wgrep]]
[[https://github.com/raxod502/prescient.el][prescient]] (~+prescient~) [[https://github.com/raxod502/prescient.el][prescient]] (~+prescient~)
[[https://github.com/minad/consult/][consult-flycheck]] (~:checkers syntax~) [[https://github.com/minad/consult/][consult-flycheck]] (~:checkers syntax~)
[[https://github.com/iyefrat/all-the-icons-completion][all-the-icons-completion]] (~+icons~)
* Prerequisites * Prerequisites
This module has no prerequisites. This module has no prerequisites.

View file

@ -92,6 +92,12 @@ and [[https://github.com/raxod502/selectrum/issues/561][561]], as well as having
than the bugginess imo. than the bugginess imo.
*** Vertico is more actively maintained *** Vertico is more actively maintained
This might be a temporary concern, but still. This might be a temporary concern, but still.
** TODO Icon support
The icon support works well enough when using Vertico, but is a bit dodgy on
Selectrum due to it not handling lines of varying height that well, which ends
up causing the selection to slide off the screen when moving it the to the
bottom in some cases. Hopefully we just use Vertico and this becomes a nonissue,
but it should still be taken into account.
* PROJ HACKs to be addressed * PROJ HACKs to be addressed
** TODO ~fboundp~ issues ** TODO ~fboundp~ issues
@ -113,9 +119,6 @@ The clicking links exported grep buffers used to open in a new window, but now
*** TODO Open upstream Embark issue for ~bookmark~ and ~file~ *** TODO Open upstream Embark issue for ~bookmark~ and ~file~
~bookmark~ or ~file~ export buffers open the links in the same window rather than ~bookmark~ or ~file~ export buffers open the links in the same window rather than
the other one. This can be reproduces on emacs -Q. the other one. This can be reproduces on emacs -Q.
** TODO Icons
Partially solved, seems to have interaction with selectrum height issue, so not
yet implemented.
** TODO ~company~ completions get ordered really weirdly ** TODO ~company~ completions get ordered really weirdly
This is due to orderless adding a bunch of other matches. This is due to orderless adding a bunch of other matches.

View file

@ -158,6 +158,9 @@
(use-package! marginalia (use-package! marginalia
:hook (doom-first-input . marginalia-mode) :hook (doom-first-input . marginalia-mode)
:init :init
(when (featurep! +icons)
(add-hook 'marginalia-mode-hook
(lambda () (all-the-icons-completion-mode (if marginalia-mode 1 -1)))))
(map! :map minibuffer-local-map (map! :map minibuffer-local-map
:desc "Cycle marginalia views" :desc "Cycle marginalia views"
"M-A" #'marginalia-cycle) "M-A" #'marginalia-cycle)

View file

@ -21,3 +21,8 @@
(package! marginalia :pin "e31e03c5857bf7aada333f693caedfc3087d6297") (package! marginalia :pin "e31e03c5857bf7aada333f693caedfc3087d6297")
(package! wgrep :pin "f9687c28bbc2e84f87a479b6ce04407bb97cfb23") (package! wgrep :pin "f9687c28bbc2e84f87a479b6ce04407bb97cfb23")
(when (featurep! +icons)
(package! all-the-icons-completion
:recipe (:host github :repo "iyefrat/all-the-icons-completion")
:pin "975345f1b618fd316729c3cae6d11b96db530fd4"))