bug-gnu-emacs
[Top][All Lists]
Advanced

[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 15:56:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]