[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompat
From: |
Protesilaos Stavrou |
Subject: |
bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible) |
Date: |
Sun, 28 Feb 2021 17:57:16 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
[ resending because it was lost, as Lars explained on emacs-devel:
"Discarded messages to the bug tracker yesterday" ]
On 2021-02-28, 15:19 +0000, "Basil L. Contovounesios" <contovob@tcd.ie> wrote:
> Protesilaos Stavrou <info@protesilaos.com> writes:
>
>> With optional PATHS as a list of filesystem paths, search for THEME
>> file in those locations instead and load it, if present."
>
> I think PATH is usually written in the singular, as in e.g.:
>
> If PATH is non-nil, it should be a list of directories to use
> instead of `custom-theme-load-path' when searching for THEME.
> PATH should have the same form as `load-path' or `exec-path'.
>
>> ((let* ((dirs (or paths (custom-theme--load-path)))
>> (file (unless (featurep theme)
>> (locate-file (symbol-name theme) dirs '(".el"
>> ".elc")))))
>> (when file
>> (require theme file))))))
>>
>> [ Note that the 'require' call was part of the parallel thread with my
>> reply to Mauro's feedback. Or keep 'load-file' for that? ]
>
> Shouldn't 'load' suffice, given we're already checking 'featurep'?
>
> Thanks,
Very well! This is the updated version:
(defun require-theme (theme &optional path)
"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'.
When THEME is an element of `custom-available-themes', load it and ask
for confirmation if it is not considered safe by `custom-safe-themes'.
Otherwise load the file indicated by THEME, if present. In the latter
case, the file is intended to work as the basis of a theme declared
with `deftheme'.
If optional PATH is non-nil, it should be a list of directories
to search for THEME in, instead of `custom-theme-load-path'.
PATH should have the same form as `load-path' or `exec-path'."
(cond
((memq theme (custom-available-themes))
(load-theme theme))
((let* ((dirs (or path (custom-theme--load-path)))
(file (unless (featurep theme)
(locate-file (symbol-name theme) dirs '(".el" ".elc")))))
(when file
(load-file file))))))
Code aside, if you think the doc string is too verbose or difficult to
read, I will try to simplify it.
--
Protesilaos Stavrou
protesilaos.com
- bug#45068: [PATCH] Modus themes 1.2.0, (continued)
- bug#45068: [PATCH] Modus themes 1.2.0, Gregory Heytings, 2021/03/05
- bug#45068: [PATCH] Modus themes 1.2.0, Gregory Heytings, 2021/03/06
- bug#45068: [PATCH] Modus themes 1.2.0, Protesilaos Stavrou, 2021/03/06
- bug#45068: [PATCH] Modus themes 1.2.0, Gregory Heytings, 2021/03/06
- bug#45068: [PATCH] Modus themes 1.2.0, Protesilaos Stavrou, 2021/03/06
- bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible), Basil L. Contovounesios, 2021/03/04
bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible), Protesilaos Stavrou, 2021/03/01
bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible), Protesilaos Stavrou, 2021/03/01
bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible),
Protesilaos Stavrou <=