GNU bug report logs - #45068
[PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible)

Previous Next

Package: emacs;

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 #122 received at 45068 <at> debbugs.gnu.org (full text, mbox):

From: Protesilaos Stavrou <info <at> protesilaos.com>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 45068 <at> debbugs.gnu.org
Subject: Re: bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2
 (backward-incompatible)
Date: Sun, 28 Feb 2021 15:56:33 +0200
[ resending as it was lost as Lars explained on emacs-devel: "Discarded
  messages to the bug tracker yesterday" ]

On 2021-02-28, 10:33 -0300, Mauro Aranda <maurooaranda <at> gmail.com> wrote:

> I don't understand this double member call.  Was it, by chance, just a
> typo?
>
> I'd use `memq' rather than `member' here, since,
> `custom-available-themes' returns a list of symbols.

Oops, sorry!  The double 'member' was indeed a mistake.  Though using it
was intentional.  Now switched to 'memq'.  Also added 'require' instead
of 'load-file'.

Here is the revised version, just to avoid confusion:

    (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
       ((memq 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)))
            (require theme 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.
>
> No apologies needed.
>
> The rest looks good to me, but let's wait for the other people involved
> to give their feedback.

Yes sure and thanks again!

-- 
Protesilaos Stavrou
protesilaos.com




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.