Revert "Add new command 'toggle-theme'"

This reverts commit f31b9d86a6.
This commit is contained in:
Philip Kaludercic 2022-09-11 13:28:38 +02:00
parent 3f0944c51f
commit feffb03a36
No known key found for this signature in database
GPG key ID: F2C3CC513DB89F66
9 changed files with 2 additions and 40 deletions

View file

@ -667,11 +667,6 @@ type @kbd{M-x disable-theme}.
the @file{*Custom Themes*} buffer; or type @kbd{M-x describe-theme} the @file{*Custom Themes*} buffer; or type @kbd{M-x describe-theme}
anywhere in Emacs and enter the theme name. anywhere in Emacs and enter the theme name.
@findex toggle-theme
Some themes have dual variants (most often these are light and dark
pairs). You can switch between these by typing @kbd{M-x
toggle-theme}. Note that this only works if only one theme is active.
@node Creating Custom Themes @node Creating Custom Themes
@subsection Creating Custom Themes @subsection Creating Custom Themes
@cindex custom themes, creating @cindex custom themes, creating

View file

@ -5,7 +5,7 @@
;; Author: Fabrice Niessen <(concat "fniessen" at-sign "pirilampo.org")> ;; Author: Fabrice Niessen <(concat "fniessen" at-sign "pirilampo.org")>
;; Contributor: Thibault Polge <(concat "thibault" at-sign "thb.lt")> ;; Contributor: Thibault Polge <(concat "thibault" at-sign "thb.lt")>
;; URL: https://github.com/fniessen/emacs-leuven-dark-theme ;; URL: https://github.com/fniessen/emacs-leuven-dark-theme
;; Version: 20220906.2016 ;; Version: 20220202.1126
;; Keywords: color theme ;; Keywords: color theme
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
@ -1083,8 +1083,6 @@ more...")
(add-to-list 'custom-theme-load-path (add-to-list 'custom-theme-load-path
(file-name-as-directory (file-name-directory load-file-name)))) (file-name-as-directory (file-name-directory load-file-name))))
(put 'leuven-dark 'dual-theme 'leuven) ;see `toggle-theme'
(provide-theme 'leuven-dark) (provide-theme 'leuven-dark)
;; This is for the sake of Emacs. ;; This is for the sake of Emacs.

View file

@ -4,7 +4,7 @@
;; Author: Fabrice Niessen <(concat "fniessen" at-sign "pirilampo.org")> ;; Author: Fabrice Niessen <(concat "fniessen" at-sign "pirilampo.org")>
;; URL: https://github.com/fniessen/emacs-leuven-theme ;; URL: https://github.com/fniessen/emacs-leuven-theme
;; Version: 20220906.2016 ;; Version: 20200513.1928
;; Keywords: color theme ;; Keywords: color theme
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
@ -1065,8 +1065,6 @@ more...")
(add-to-list 'custom-theme-load-path (add-to-list 'custom-theme-load-path
(file-name-as-directory (file-name-directory load-file-name)))) (file-name-as-directory (file-name-directory load-file-name))))
(put 'leuven 'dual-theme 'leuven-dark) ;see `toggle-theme'
(provide-theme 'leuven) (provide-theme 'leuven)
;; This is for the sake of Emacs. ;; This is for the sake of Emacs.

View file

@ -190,8 +190,6 @@ Semantic, and Ansi-Color faces are included.")
`(ansi-color-bright-white ((,class (:background ,alum-1 `(ansi-color-bright-white ((,class (:background ,alum-1
:foreground ,alum-1)))))) :foreground ,alum-1))))))
(put 'tango-dark 'dual-theme 'tango) ;see `toggle-theme'
(provide-theme 'tango-dark) (provide-theme 'tango-dark)
;;; tango-dark-theme.el ends here ;;; tango-dark-theme.el ends here

View file

@ -173,8 +173,6 @@ Semantic, and Ansi-Color faces are included.")
`(ansi-color-bright-white ((,class (:background ,alum-1 `(ansi-color-bright-white ((,class (:background ,alum-1
:foreground ,alum-1)))))) :foreground ,alum-1))))))
(put 'tango 'dual-theme 'tango-dark) ;see `toggle-theme'
(provide-theme 'tango) (provide-theme 'tango)
;;; tango-theme.el ends here ;;; tango-theme.el ends here

View file

@ -142,8 +142,6 @@
'(widget-field ((t (:box (:line-width 2 :color "grey75" :style pressed-button))))) '(widget-field ((t (:box (:line-width 2 :color "grey75" :style pressed-button)))))
'(window-number-face ((t (:foreground "red" :weight bold))))) '(window-number-face ((t (:foreground "red" :weight bold)))))
(put 'tsdh-dark 'dual-theme 'tsdh-light) ;see `toggle-theme'
(provide-theme 'tsdh-dark) (provide-theme 'tsdh-dark)
;;; tsdh-dark-theme.el ends here ;;; tsdh-dark-theme.el ends here

View file

@ -104,8 +104,6 @@ Used and created by Tassilo Horn.")
'(show-paren-mismatch ((t (:background "deep pink" :weight bold)))) '(show-paren-mismatch ((t (:background "deep pink" :weight bold))))
'(window-number-face ((t (:foreground "red" :weight bold))))) '(window-number-face ((t (:foreground "red" :weight bold)))))
(put 'tsdh-light 'dual-theme 'tsdh-dark) ;see `toggle-theme'
(provide-theme 'tsdh-light) (provide-theme 'tsdh-light)
;;; tsdh-light-theme.el ends here ;;; tsdh-light-theme.el ends here

View file

@ -515,8 +515,6 @@ It includes all faces in list FACES."
(end-of-file nil))))) (end-of-file nil)))))
(and (eq (car-safe sexp) 'deftheme) (and (eq (car-safe sexp) 'deftheme)
(setq doc (nth 2 sexp))))))) (setq doc (nth 2 sexp)))))))
(when-let ((dual (get theme 'dual-theme)))
(princ (format " The dual theme is `%s'" dual)))
(princ "\n\nDocumentation:\n") (princ "\n\nDocumentation:\n")
(princ (if (stringp doc) (princ (if (stringp doc)
(substitute-command-keys doc) (substitute-command-keys doc)

View file

@ -1372,25 +1372,6 @@ Return t if THEME was successfully loaded, nil otherwise."
(enable-theme theme)) (enable-theme theme))
t) t)
(defun toggle-theme (&optional no-confirm no-enable)
"Toggle the current active theme by enabling its dual pair.
The current theme will be immediately disabled before the dual
theme has been enabled. If THEME is not active an error will be
raised. If theme is nil For NO-CONFIRM and NO-ENABLE, see
`load-theme'."
(interactive)
(cond
((length= custom-enabled-themes 0)
(user-error "No theme is active, cannot toggle"))
((length> custom-enabled-themes 1)
(user-error "More than one theme active, cannot unambiguously toggle")))
(let* ((theme (car custom-enabled-themes))
(dual (get theme 'dual-theme)))
(unless dual
(error "`%s' has no dual theme to toggle between" theme))
(disable-theme theme)
(load-theme dual no-confirm no-enable)))
(defun custom-theme-load-confirm (hash) (defun custom-theme-load-confirm (hash)
"Query the user about loading a Custom theme that may not be safe. "Query the user about loading a Custom theme that may not be safe.
The theme should be in the current buffer. If the user agrees, The theme should be in the current buffer. If the user agrees,