Subject: Re: Patch for Modus themes 1.1.1?

From: Eli Zaretskii <[email-masked]>
Date: Sat, 27 Feb 2021 10:15:54 +0200

> 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.

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?  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?

Thanks.