branch: externals/ef-themes
commit 8155fd60dbf32dea386c36114f88ac5476ded12d
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Add command to select Ef theme
---
ef-themes.el | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/ef-themes.el b/ef-themes.el
index e4382e02cc..ef9dd1320a 100644
--- a/ef-themes.el
+++ b/ef-themes.el
@@ -44,6 +44,35 @@
:prefix "ef-themes-"
:tag "Ef Themes")
+;;; Commands and their helper functions
+
+(defun ef-themes--list-enabled-themes ()
+ "Return list of `custom-enabled-themes' with ef- prefix."
+ (seq-filter
+ (lambda (theme)
+ (string-prefix-p "ef-" (symbol-name theme)))
+ custom-enabled-themes))
+
+(defconst ef-themes-themes '(ef-summer ef-winter)
+ "List of Ef Themes.")
+
+(defvar ef-themes--select-theme-history nil)
+
+(defun ef-themes--select-prompt ()
+ "Minibuffer prompt for `ef-themes-select'."
+ (completing-read "Select Ef Theme: "
+ ef-themes-themes
+ nil t nil
+ 'ef-themes--select-theme-history))
+
+;;;###autoload
+(defun ef-themes-select (theme)
+ "Load an Ef THEME using minibuffer completion.
+When called from Lisp, THEME is a symbol."
+ (interactive
+ (list (intern (ef-themes--select-prompt))))
+ (load-theme theme :no-confirm))
+
;;; Faces and variables
(defconst ef-themes-faces