[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ef-themes c5fedb64e3 01/28: Add commands ef-themes-sele
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ef-themes c5fedb64e3 01/28: Add commands ef-themes-select-dark, ef-themes-select-light |
Date: |
Sun, 30 Apr 2023 12:02:36 -0400 (EDT) |
branch: externals/ef-themes
commit c5fedb64e389dc9825278f805f6280aa93b62f84
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add commands ef-themes-select-dark, ef-themes-select-light
These make it easier for users to experiment with the themes we
provide and find the one they prefer.
---
README.org | 11 ++++++++++
ef-themes.el | 72 +++++++++++++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 70 insertions(+), 13 deletions(-)
diff --git a/README.org b/README.org
index d6a6b76efc..a0366efa7d 100644
--- a/README.org
+++ b/README.org
@@ -171,6 +171,8 @@ Everything is in place to set up the package.
;;
;; - `ef-themes-toggle'
;; - `ef-themes-select'
+;; - `ef-themes-select-dark'
+;; - `ef-themes-select-light'
;; - `ef-themes-load-random'
;; - `ef-themes-preview-colors'
;; - `ef-themes-preview-colors-current'
@@ -587,6 +589,15 @@ When ~ef-themes-select~ is called with a prefix argument
(=C-u= by
default), it first produces a minibuffer prompt to limit the choice to
dark or light themes, and then shows only the relevant subset.
+#+findex: ef-themes-select-dark
+#+findex: ef-themes-select-light
+Instead of calling ~ef-themese-select~ with a prefix argument, users
+can invoke either of ~ef-themes-select-dark~, ~ef-themes-select-light~
+commands. Those behave the same as ~ef-themes-select~ except they
+limit the interaction to dark or light Ef themes, respectively. [ The
+commands ~ef-themes-select-dark~ and ~ef-themes-select-light~ are part
+of {{{development-version}}}. ]
+
#+findex: ef-themes-load-random
The command ~ef-themes-load-random~ is for those who appreciate a bit of
serendipity in their life. When call interactively with =M-x= it loads
diff --git a/ef-themes.el b/ef-themes.el
index c04646ebed..8cc62484ba 100644
--- a/ef-themes.el
+++ b/ef-themes.el
@@ -541,23 +541,35 @@ overrides."
(defvar ef-themes--select-theme-history nil
"Minibuffer history of `ef-themes--select-prompt'.")
+(defun ef-themes--load-subset (subset)
+ "Return the `light' or `dark' SUBSET of the Ef themes.
+If SUBSET is neither `light' nor `dark', return all the known Ef themes."
+ (pcase subset
+ ('dark ef-themes-dark-themes)
+ ('light ef-themes-light-themes)
+ (_ (ef-themes--list-known-themes))))
+
+(defun ef-themes--maybe-prompt-subset (variant)
+ "Helper function for `ef-themes--select-prompt' VARIANT argument."
+ (cond
+ ((null variant))
+ ((or (eq variant 'light) (eq variant 'dark)) variant)
+ (t (ef-themes--choose-subset))))
+
(defun ef-themes--select-prompt (&optional prompt variant)
"Minibuffer prompt for `ef-themes-select'.
With optional PROMPT string, use it. Else use a generic prompt.
-With optional VARIANT, prompt for a subset of themes divided into
-light and dark variants. Then limit the completion candidates
-accordingly."
- (let* ((subset (when variant (ef-themes--choose-subset)))
- (themes (pcase subset
- ('dark ef-themes-dark-themes)
- ('light ef-themes-light-themes)
- ;; NOTE 2022-11-02: This condition made sense when
- ;; the code now in `ef-themes--choose-subset' used
- ;; `completing-read'. With `read-multiple-choice'
- ;; we never meet this condition, as far as I can
- ;; tell. But it does no harm to keep it here.
- (_ (ef-themes--list-known-themes))))
+With optional VARIANT as a non-nil value, prompt for a subset of
+themes divided into light and dark variants. Then limit the
+completion candidates accordingly.
+
+If VARIANT is either `light' or `dark' then use it directly
+instead of prompting the user for a choice.
+
+When VARIANT is nil, all Ef themes are candidates for completion."
+ (let* ((subset (ef-themes--maybe-prompt-subset variant))
+ (themes (ef-themes--load-subset subset))
(completion-extra-properties `(:annotation-function
,#'ef-themes--annotate-theme)))
(intern
(completing-read
@@ -598,6 +610,40 @@ is ignored in this scenario."
(interactive (list (ef-themes--select-prompt nil current-prefix-arg)))
(ef-themes--load-theme theme))
+;;;###autoload
+(defun ef-themes-select-light (theme)
+ "Load a light Ef THEME.
+Run `ef-themes-post-load-hook' after loading the theme.
+
+Also see `ef-themes-select-dark'.
+
+This command is the same as `ef-themes-select' except it only
+prompts for light themes when called interactively. Calling it
+from Lisp behaves the same as `ef-themes-select' for the THEME
+argument, meaning that it loads the Ef THEME regardless of
+whether it is light or dark."
+ (interactive
+ (list
+ (ef-themes--select-prompt "Select light Ef theme: " 'light)))
+ (ef-themes--load-theme theme))
+
+;;;###autoload
+(defun ef-themes-select-dark (theme)
+ "Load a dark Ef THEME.
+Run `ef-themes-post-load-hook' after loading the theme.
+
+Also see `ef-themes-select-light'.
+
+This command is the same as `ef-themes-select' except it only
+prompts for light themes when called interactively. Calling it
+from Lisp behaves the same as `ef-themes-select' for the THEME
+argument, meaning that it loads the Ef THEME regardless of
+whether it is light or dark."
+ (interactive
+ (list
+ (ef-themes--select-prompt "Select light Ef theme: " 'dark)))
+ (ef-themes--load-theme theme))
+
(defun ef-themes--toggle-theme-p ()
"Return non-nil if `ef-themes-to-toggle' are valid."
(mapc (lambda (theme)
- [elpa] externals/ef-themes updated (6b06e09750 -> 504c56b566), ELPA Syncer, 2023/04/30
- [elpa] externals/ef-themes 3ca6555712 03/28: Replace = with ~ for code symbols in the manual, ELPA Syncer, 2023/04/30
- [elpa] externals/ef-themes 2993ae19ca 06/28: Add ef-symbiosis theme, ELPA Syncer, 2023/04/30
- [elpa] externals/ef-themes 2b7fe77bcf 16/28: Change name mapping from green to blue, ELPA Syncer, 2023/04/30
- [elpa] externals/ef-themes 8297ff58d1 18/28: ef-symbiosis: refine mail header hues, ELPA Syncer, 2023/04/30
- [elpa] externals/ef-themes 2624810fa6 20/28: Document implicit support for sxhkdrc-mode, ELPA Syncer, 2023/04/30
- [elpa] externals/ef-themes c5fedb64e3 01/28: Add commands ef-themes-select-dark, ef-themes-select-light,
ELPA Syncer <=
- [elpa] externals/ef-themes b2f1ad7203 14/28: ef-symbiosis: tweak link colours, ELPA Syncer, 2023/04/30
- [elpa] externals/ef-themes d47fca33da 15/28: ef-symbiosis: change mail-subject hue from yellow to green, ELPA Syncer, 2023/04/30
- [elpa] externals/ef-themes e6f752df1b 19/28: ef-symbiosis: change prose-macro hue, ELPA Syncer, 2023/04/30
- [elpa] externals/ef-themes 244255e167 26/28: ef-symbiosis: tweak border value, ELPA Syncer, 2023/04/30
- [elpa] externals/ef-themes 31a1e9d862 27/28: Add support for 'proced', including its Emacs 29 faces, ELPA Syncer, 2023/04/30
- [elpa] externals/ef-themes 504c56b566 28/28: Add support for 'jinx' package, ELPA Syncer, 2023/04/30
- [elpa] externals/ef-themes 3a711ba700 02/28: Make 'org-code' use the 'prose-code' semantic color mapping, ELPA Syncer, 2023/04/30
- [elpa] externals/ef-themes da5e02dc5e 05/28: Remove obsolete reference from the README, ELPA Syncer, 2023/04/30
- [elpa] externals/ef-themes c4e7119c7c 07/28: ef-symbiosis: make minor tweaks to line highlights, ELPA Syncer, 2023/04/30
- [elpa] externals/ef-themes 1699b05d7c 09/28: Include ef-symbiosis in ef-themes-dark-themes, ELPA Syncer, 2023/04/30