[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ef-themes c2a6348f60: Add user option ef-themes-disable
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ef-themes c2a6348f60: Add user option ef-themes-disable-other-themes |
Date: |
Wed, 4 Jan 2023 23:57:36 -0500 (EST) |
branch: externals/ef-themes
commit c2a6348f60cabfcd1b7b8872e0cfad2f15988d42
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add user option ef-themes-disable-other-themes
---
README.org | 30 ++++++++++++++++++++++++++++--
ef-themes.el | 35 +++++++++++++++++++++++++++++++++--
2 files changed, 61 insertions(+), 4 deletions(-)
diff --git a/README.org b/README.org
index f5452ec065..3ff7731112 100644
--- a/README.org
+++ b/README.org
@@ -207,6 +207,31 @@ overall character of each theme
([[#h:a6dd030c-6b6c-4992-83e8-3438b4607b51][Prin
All customizations need to be evaluated before loading a theme. Any
change thus requires a theme re-load
([[#h:a6dd030c-6b6c-4992-83e8-3438b4607b51][Loading a theme]]).
+** Disable other themes
+:PROPERTIES:
+:CUSTOM_ID: h:b22371a2-9428-4f83-a3ca-884be559cf1d
+:END:
+
+[ Part of {{{development-version}}}. ]
+
+#+vindex: ef-themes-disable-other-themes
+The user option ~ef-themes-disable-other-themes~ controls which themes
+to disable when loading an Ef theme.
+
+When the value is non-nil, the commands ~ef-themes-toggle~ and
+~ef-themes-select~ will disable all other themes while loading the
+specified Ef theme. This is done to ensure that Emacs does not blend
+two or more themes: such blends lead to awkward results that undermine
+the work of the designer.
+
+When the value is nil, the aforementioned commands will only disable
+other themes within the Ef collection.
+
+This option is provided because Emacs themes are not necessarily
+limited to colors/faces: they can consist of an arbitrary set of
+customizations. Users who use such customization bundles must set
+this variable to a nil value.
+
** Toggle between two Ef themes
:PROPERTIES:
:CUSTOM_ID: h:a58b8e21-0f8f-4763-9b47-185bf7e10043
@@ -499,8 +524,9 @@ Contact me if you need further help with this.
Emacs can load and maintain enabled multiple themes at once. This
typically leads to awkward styling and weird combinations. The theme
-looks broken and the designer's intent is misunderstood. Before loading
-one of the =ef-themes=, the user is encouraged to disable all others:
+looks broken and the designer's intent is misunderstood. Before
+loading one of the ~ef-themes~, the user is encouraged to disable all
+others ([[#h:b22371a2-9428-4f83-a3ca-884be559cf1d][Disable other themes]]):
#+begin_src emacs-lisp
(mapc #'disable-theme custom-enabled-themes)
diff --git a/ef-themes.el b/ef-themes.el
index a17fcff8ba..b29bda7070 100644
--- a/ef-themes.el
+++ b/ef-themes.el
@@ -94,6 +94,26 @@ This is used by the commands `ef-themes-select' and
:package-version '(ef-themes . "0.2.0")
:group 'ef-themes)
+(defcustom ef-themes-disable-other-themes t
+ "Disable all other themes when loading a Ef theme.
+
+When the value is non-nil, the commands `ef-themes-toggle' and
+`ef-themes-select' will disable all other themes while loading
+the specified Ef theme. This is done to ensure that Emacs does
+not blend two or more themes: such blends lead to awkward results
+that undermine the work of the designer.
+
+When the value is nil, the aforementioned commands will only
+disable other themes within the Ef collection.
+
+This option is provided because Emacs themes are not necessarily
+limited to colors/faces: they can consist of an arbitrary set of
+customizations. Users who use such customization bundles must
+set this variable to a nil value."
+ :group 'ef-themes
+ :package-version '(ef-themes . "0.11.0")
+ :type 'boolean)
+
(defcustom ef-themes-to-toggle nil
"Specify two `ef-themes' for `ef-themes-toggle' command.
The variable `ef-themes-collection' contains the symbols of all
@@ -494,10 +514,21 @@ accordingly."
nil t nil
'ef-themes--select-theme-history))))
+(defun ef-themes--disable-themes ()
+ "Disable themes per `ef-themes-disable-other-themes'."
+ (mapc #'disable-theme
+ (if ef-themes-disable-other-themes
+ custom-enabled-themes
+ (ef-themes--list-known-themes))))
+
(defun ef-themes--load-theme (theme)
"Load THEME while disabling other Ef themes.
-Run `ef-themes-post-load-hook'."
- (mapc #'disable-theme (ef-themes--list-known-themes))
+Which themes are disabled is determined by the user option
+`ef-themes-disable-other-themes'.
+
+Run the `ef-themes-post-load-hook' as the final step after
+loading the THEME."
+ (ef-themes--disable-themes)
(load-theme theme :no-confirm)
(run-hooks 'ef-themes-post-load-hook))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/ef-themes c2a6348f60: Add user option ef-themes-disable-other-themes,
ELPA Syncer <=