GNU bug report logs -
#45068
[PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible)
Previous Next
Reported by: Protesilaos Stavrou <info <at> protesilaos.com>
Date: Sun, 6 Dec 2020 12:25:02 UTC
Severity: normal
Tags: patch
Fixed in version 28.1
Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hi Protesilaos,
Protesilaos Stavrou <info <at> protesilaos.com> writes:
> (defun require-theme (theme &optional directories)
> "Load THEME stored in `custom-theme-load-path'.
>
> THEME is a symbol or string that corresponds to the file name without
> its file type extension. That is assumed to be either '.el' or '.elc'.
>
> If THEME names a valid theme, load and enable it. Otherwise load the
> file, if present. In the latter case, the file is intended to work as
> the basis of a theme declared with `deftheme'.
>
> With optional DIRECTORIES as a list of filesystem paths, search
> for THEME file in those locations instead and load it, if present."
> (let* ((theme-dirs (custom-theme--load-path))
> (custom-dirs (when (and directories (listp directories))
> directories))
> (theme-name (cond
> ((stringp theme)
> theme)
> ((symbolp theme)
> (format "%s" theme))
I think it's better to use `symbol-name' when you're sure it's a symbol.
> (cond
> ((custom-theme-p theme)
> (load-theme theme t))
Some comments about this clause:
The docstring says a valid theme, but this checks for a "known" theme.
I think the docstring should clarify that.
Also, in this clause you don't need all the early work for locating the
file.
More important: doesn't this make it possible to load a non-safe theme
(as controlled by `custom-safe-themes') behind the user's back?
> This works in two ways:
>
> 1. To load a theme's dependency:
>
> (require-theme 'modus-themes)
>
> 2. To load and enable a theme:
>
> (require-theme 'modus-operandi)
IIUC, (2) works only after the theme is "known".
This bug report was last modified 4 years and 135 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.