[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 344634d 1/2: Allow obsoleting themes
From: |
Lars Ingebrigtsen |
Subject: |
master 344634d 1/2: Allow obsoleting themes |
Date: |
Sun, 3 Oct 2021 05:04:10 -0400 (EDT) |
branch: master
commit 344634d7cc5206027fda8e791beef8c43de8aedb
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Allow obsoleting themes
* lisp/cus-theme.el (customize-themes): Don't list obsolete themes.
* lisp/custom.el (load-theme): Issue a warning if the theme is
obsolete (bug#47047).
---
etc/NEWS | 5 +++++
lisp/cus-theme.el | 34 ++++++++++++++++++----------------
lisp/custom.el | 7 +++++++
3 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 8c22230..20ed203 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -80,6 +80,11 @@ Emacs buffers, like indentation and the like. The new ert
function
* Lisp Changes in Emacs 29.1
+---
+** Themes can now be made obsolete.
+Using 'make-obsolete' on a theme is now supported. This will make
+'load-theme' issue a warning when loading the theme.
+
* Changes in Emacs 29.1 on Non-Free Operating Systems
diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index 07881e9..f618e33 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -627,22 +627,24 @@ Theme files are named *-theme.el in `"))
(let ((help-echo "mouse-2: Enable this theme for this session")
widget)
(dolist (theme (custom-available-themes))
- (setq widget (widget-create 'checkbox
- :value (custom-theme-enabled-p theme)
- :theme-name theme
- :help-echo help-echo
- :action #'custom-theme-checkbox-toggle))
- (push (cons theme widget) custom--listed-themes)
- (widget-create-child-and-convert widget 'push-button
- :button-face-get 'ignore
- :mouse-face-get 'ignore
- :value (format " %s" theme)
- :action #'widget-parent-action
- :help-echo help-echo)
- (widget-insert " -- "
- (propertize (custom-theme-summary theme)
- 'face 'shadow)
- ?\n)))
+ ;; Don't list obsolete themes.
+ (unless (get theme 'byte-obsolete-info)
+ (setq widget (widget-create 'checkbox
+ :value (custom-theme-enabled-p theme)
+ :theme-name theme
+ :help-echo help-echo
+ :action #'custom-theme-checkbox-toggle))
+ (push (cons theme widget) custom--listed-themes)
+ (widget-create-child-and-convert widget 'push-button
+ :button-face-get 'ignore
+ :mouse-face-get 'ignore
+ :value (format " %s" theme)
+ :action #'widget-parent-action
+ :help-echo help-echo)
+ (widget-insert " -- "
+ (propertize (custom-theme-summary theme)
+ 'face 'shadow)
+ ?\n))))
(goto-char (point-min))
(widget-setup))
diff --git a/lisp/custom.el b/lisp/custom.el
index 858b158..0cd4318 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -1331,6 +1331,13 @@ Return t if THEME was successfully loaded, nil
otherwise."
t))))
(t
(error "Unable to load theme `%s'" theme))))
+ (when-let ((obs (get theme 'byte-obsolete-info)))
+ (display-warning 'initialization
+ (format "The `%s' theme is obsolete%s"
+ theme
+ (if (nth 2 obs)
+ (format " since Emacs %s" (nth 2 obs))
+ ""))))
;; Optimization: if the theme changes the `default' face, put that
;; entry first. This avoids some `frame-set-background-mode' rigmarole
;; by assigning the new background immediately.