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

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

[elpa] externals/standard-themes df4845996e: Add user option standard-th


From: ELPA Syncer
Subject: [elpa] externals/standard-themes df4845996e: Add user option standard-themes-disable-other-themes
Date: Wed, 4 Jan 2023 23:58:12 -0500 (EST)

branch: externals/standard-themes
commit df4845996e532df62ea1b5609b0b7264045ab44b
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Add user option standard-themes-disable-other-themes
---
 README.org         | 28 +++++++++++++++++++++++++++-
 standard-themes.el | 32 ++++++++++++++++++++++++++++++--
 2 files changed, 57 insertions(+), 3 deletions(-)

diff --git a/README.org b/README.org
index 5aaea1729f..40b1564e9a 100644
--- a/README.org
+++ b/README.org
@@ -186,6 +186,32 @@ aspects of the theme.  All customizations need to be 
evaluated before
 loading a theme.  Any change after the theme has been loaded require a
 re-load ([[#h:59c399d6-5dca-4686-b793-255be8bffc31][Loading a theme]]).
 
+** Disable other themes
+:PROPERTIES:
+:CUSTOM_ID: h:bc4827ec-7ec1-4511-ae1b-491c28835b19
+:END:
+
+[ Part of {{{development-version}}}. ]
+
+#+vindex: standard-themes-disable-other-themes
+The user option ~standard-themes-disable-other-themes~ controls which
+themes to disable when loading a Standard theme 
([[#h:59c399d6-5dca-4686-b793-255be8bffc31][Loading a theme]]).
+
+When the value is non-nil, the command ~standard-themes-toggle~ as
+well as the functions ~standard-themes-load-dark~ and
+~standard-themes-load-light~, will disable all other themes while
+loading the specified Standard 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 command and functions will
+only disable the other Standard theme.
+
+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.
+
 ** Enable mixed fonts
 :PROPERTIES:
 :CUSTOM_ID: h:a939ee30-f705-4d70-aa00-cca5528ef172
@@ -597,7 +623,7 @@ 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 either of the =standard-themes=, the user is encouraged to
-disable all others:
+disable all others ([[#h:bc4827ec-7ec1-4511-ae1b-491c28835b19][Disable other 
themes]]):
 
 #+begin_src emacs-lisp
 (mapc #'disable-theme custom-enabled-themes)
diff --git a/standard-themes.el b/standard-themes.el
index 649510120c..509639f608 100644
--- a/standard-themes.el
+++ b/standard-themes.el
@@ -53,6 +53,27 @@
 (defconst standard-themes-items '(standard-dark standard-light)
   "Symbols of the Standard themes.")
 
+(defcustom standard-themes-disable-other-themes t
+  "Disable all other themes when loading a Standard theme.
+
+When the value is non-nil, the command `standard-themes-toggle'
+as well as the functions `standard-themes-load-dark' and
+`standard-themes-load-light', will disable all other themes while
+loading the specified Standard 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 command and functions
+will only disable the other Standard theme.
+
+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 'standard-themes
+  :package-version '(standard-themes . "1.2.0")
+  :type 'boolean)
+
 (defcustom standard-themes-post-load-hook nil
   "Hook that runs after loading a Standard theme.
 This is used by the command `standard-themes-toggle'."
@@ -612,10 +633,17 @@ overrides."
         (standard-themes--palette-value theme))
     (user-error "No enabled Ef theme could be found")))
 
+(defun standard-themes--disable-themes ()
+  "Disable themes per `standard-themes-disable-other-themes'."
+  (mapc #'disable-theme
+        (if standard-themes-disable-other-themes
+            custom-enabled-themes
+          (standard-themes--list-known-themes))))
+
 (defun standard-themes--load-theme (theme)
   "Load THEME while disabling other Standard themes.
 Run `standard-themes-post-load-hook'."
-  (mapc #'disable-theme (standard-themes--list-known-themes))
+  (standard-themes--disable-themes)
   (load-theme theme :no-confirm)
   (run-hooks 'standard-themes-post-load-hook))
 
@@ -637,7 +665,7 @@ Run `standard-themes-post-load-hook'."
          (intern
           (completing-read "Load Standard theme (will disable all others): "
                            standard-themes-items nil t))))
-    (mapc #'disable-theme (standard-themes--list-known-themes))
+    (standard-themes--disable-themes)
     (pcase theme
       ('standard-light (standard-themes-load-light))
       ('standard-dark (standard-themes-load-dark)))))



reply via email to

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