From d86375a468b092b20e4fc5a75d2684cc4e7e625d Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sun, 4 Jul 2021 04:15:58 +0300 Subject: [PATCH] selectrum: add icon support Use the package `all-the-icons-completion` to add icons to vertical completion buffers. --- docs/modules.org | 2 +- modules/completion/selectrum/README.org | 2 ++ modules/completion/selectrum/TODO.org | 9 ++++++--- modules/completion/selectrum/config.el | 3 +++ modules/completion/selectrum/packages.el | 5 +++++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/docs/modules.org b/docs/modules.org index 54be24d84..7bf0a7207 100644 --- a/docs/modules.org +++ b/docs/modules.org @@ -46,7 +46,7 @@ completion. + helm =+fuzzy +childframe= - *Another* 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/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 Modules that configure Emacs one way or another, or focus on making it easier diff --git a/modules/completion/selectrum/README.org b/modules/completion/selectrum/README.org index d6ff6c683..6feddfe92 100644 --- a/modules/completion/selectrum/README.org +++ b/modules/completion/selectrum/README.org @@ -26,6 +26,7 @@ TODO ** Module Flags + ~+prescient~ Enables prescient filtering and sorting for Selectrum searches instead of orderless. ++ ~+icons~ Adds icons to ~file~ and ~buffer~ category completion selections. ** Plugins [[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/raxod502/prescient.el][prescient]] (~+prescient~) [[https://github.com/minad/consult/][consult-flycheck]] (~:checkers syntax~) +[[https://github.com/iyefrat/all-the-icons-completion][all-the-icons-completion]] (~+icons~) * Prerequisites This module has no prerequisites. diff --git a/modules/completion/selectrum/TODO.org b/modules/completion/selectrum/TODO.org index 427e21969..0c2a00bf1 100644 --- a/modules/completion/selectrum/TODO.org +++ b/modules/completion/selectrum/TODO.org @@ -92,6 +92,12 @@ and [[https://github.com/raxod502/selectrum/issues/561][561]], as well as having than the bugginess imo. *** Vertico is more actively maintained 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 ** 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~ ~bookmark~ or ~file~ export buffers open the links in the same window rather than 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 This is due to orderless adding a bunch of other matches. diff --git a/modules/completion/selectrum/config.el b/modules/completion/selectrum/config.el index 18a337de0..dce3dd441 100644 --- a/modules/completion/selectrum/config.el +++ b/modules/completion/selectrum/config.el @@ -158,6 +158,9 @@ (use-package! marginalia :hook (doom-first-input . marginalia-mode) :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 :desc "Cycle marginalia views" "M-A" #'marginalia-cycle) diff --git a/modules/completion/selectrum/packages.el b/modules/completion/selectrum/packages.el index f66d1f329..231601d1a 100644 --- a/modules/completion/selectrum/packages.el +++ b/modules/completion/selectrum/packages.el @@ -21,3 +21,8 @@ (package! marginalia :pin "e31e03c5857bf7aada333f693caedfc3087d6297") (package! wgrep :pin "f9687c28bbc2e84f87a479b6ce04407bb97cfb23") + +(when (featurep! +icons) + (package! all-the-icons-completion + :recipe (:host github :repo "iyefrat/all-the-icons-completion") + :pin "975345f1b618fd316729c3cae6d11b96db530fd4"))