emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/modus-themes 7465ffcfbe 1/2: Add annotation function to


From: ELPA Syncer
Subject: [elpa] externals/modus-themes 7465ffcfbe 1/2: Add annotation function to theme selection prompts
Date: Sat, 25 Mar 2023 11:59:10 -0400 (EDT)

branch: externals/modus-themes
commit 7465ffcfbebd67d9d98fe9bbcb83e5b761affc6b
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Add annotation function to theme selection prompts
---
 modus-themes.el | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/modus-themes.el b/modus-themes.el
index fa0e75580a..6612a1aabb 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -1183,14 +1183,19 @@ symbol, which is safe when used as a face attribute's 
value."
 (defvar modus-themes--select-theme-history nil
   "Minibuffer history of `modus-themes--select-prompt'.")
 
+(defun modus-themes--annotate-theme (theme)
+  "Return completion annotation for THEME."
+  (format " -- %s" (car (split-string (get (intern theme) 
'theme-documentation) "\\."))))
+
 (defun modus-themes--select-prompt ()
   "Minibuffer prompt to select a Modus theme."
-  (intern
-   (completing-read
-    "Select Modus theme: "
-    (modus-themes--list-known-themes)
-    nil t nil
-    'modus-themes--select-theme-history)))
+  (let ((completion-extra-properties `(:annotation-function 
,#'modus-themes--annotate-theme)))
+    (intern
+     (completing-read
+      "Select Modus theme: "
+      (modus-themes--list-known-themes)
+      nil t nil
+      'modus-themes--select-theme-history))))
 
 ;;;###autoload
 (defun modus-themes-select (theme)
@@ -1278,7 +1283,8 @@ color mappings of the palette, instead of its named 
colors."
 (defun modus-themes--list-colors-prompt ()
   "Prompt for Modus theme.
 Helper function for `modus-themes-list-colors'."
-  (let ((def (format "%s" (modus-themes--current-theme))))
+  (let ((def (format "%s" (modus-themes--current-theme)))
+        (completion-extra-properties `(:annotation-function 
,#'modus-themes--annotate-theme)))
     (completing-read
      (format "Use palette from theme [%s]: " def)
      (modus-themes--list-known-themes) nil t nil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]