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
Message #116 received at 45068 <at> debbugs.gnu.org (full text, mbox):
On 2021-02-28, 08:41 -0300, Mauro Aranda <maurooaranda <at> gmail.com> wrote:
> Hi Protesilaos,
Hello Mauro and thank you for the valuable feedback!
I have written the function anew based on your suggestions. I also
added a featurep check to ensure that the same file is not loaded
repeatedly. Furthermore, I streamlined the type of THEME to always be a
symbol.
(defun require-theme (theme &optional directories)
"Load THEME stored in `custom-theme-load-path'.
THEME is a symbol that corresponds to the file name without its file
type extension. That is assumed to be either '.el' or '.elc'.
If THEME names an element of `custom-available-themes', load it asking
for confirmation if it is not considered safe by `custom-safe-themes'.
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."
(cond
((member theme (member theme (custom-available-themes)))
(load-theme theme))
((let* ((theme-dirs (custom-theme--load-path))
(custom-dirs (when (and directories (listp directories))
directories))
(dirs (or custom-dirs theme-dirs))
(file (locate-file (symbol-name theme) dirs '(".el" ".elc"))))
(when (and file (not (featurep theme)))
(load-file file))))))
Please feel welcome to suggest any further changes/refinements. This is
not my area of expertise, so apologies for taking so long to get it
right.
--
Protesilaos Stavrou
protesilaos.com
This bug report was last modified 4 years and 136 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.