Subject: Re: Patch for Modus themes 1.1.1?

From: Protesilaos Stavrou <[email-masked]>
Date: Sat, 27 Feb 2021 10:53:14 +0200

On 2021-02-27, 10:15 +0200, Eli Zaretskii <[email-masked]> wrote:

>> From: Protesilaos Stavrou <[email-masked]>
>> Cc: [email-masked]
>> Date: Sat, 27 Feb 2021 04:35:49 +0200
>> 
>> > A simple implementation that checks whether a theme is already loaded,
>> > and if not, looks it up in a suitable list of directories and loads
>> > when found.  The main part is to make sure themes are looked up in the
>> > directories where we expect them to be, as opposed to load-path, which
>> > is where 'require' looks for files to load.  A Lisp implementation
>> > should be fine, I think.
>> >
>> > Let me know if you need further clarifications.
>> 
>> Hello Eli,
>> 
>> This is what I could come up with.  It is not what you stipulated, as it
>> only accounts for the default themes' directory instead of checking the
>> 'custom-theme-load-path'.
>
> Hmm... I'm surprised.  What I had in mind was a simple use of
> locate-file, which already accepts a path argument, so you could pass
> custom-theme-load-path to it, and it would do the job.

Thank you for the feedback (and sorry for putting you through the
trouble)!  I will try again using that approach.

> Maybe I misunderstand or misremember the problem which led us here.
> Wasn't the problem that 'load' and 'require' search along load-path
> instead of custom-theme-load-path?

Yes, that was the problem.  So the "modus-themes.el" dependency could
not be placed in etc/themes/ as (require 'modus-themes) would not find
it.

> IOW, could you show the code you'd use to load the other components of
> the theme if you could use 'load' and 'require'?  My idea was simply
> to replace
>
>   (require 'foo-themes)
>
> with
>
>   (require-theme 'foo-themes)
>
> Would that solve your original problem, assuming that require-theme
> would look for and load foo-themes.el?

Indeed, with the function I provided all I had to change was 'require'
to 'require-theme-base'.

-- 
Protesilaos Stavrou
protesilaos.com