1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

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).
This commit is contained in:
Lars Ingebrigtsen 2021-10-03 11:03:07 +02:00
parent ea3e51732d
commit 344634d7cc
3 changed files with 30 additions and 16 deletions

View file

@ -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

View file

@ -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))

View file

@ -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.