[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Byte-compilation of custom themes

From: Basil L. Contovounesios
Subject: Re: Byte-compilation of custom themes
Date: Sun, 03 Jun 2018 12:21:07 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> I meant featurep, but since cl-assert is autoloaded, that shouldn't be
> AFAICT it's not autoloaded.

You're right, emacs -Q followed by (fboundp 'cl-assert) returns nil.

> I think the confusing comes from help-fns.el which does (require
> 'cl-lib), so if you do `C-h f cl-assert RET` it will indeed tell you
> it's autoloaded, but it's just because `C-h f` ended up requiring
> cl-lib.

No, the confusion comes from looking at the source of cl-macs.el, in
which cl-assert is given an ;;;###autoload cookie.  I see now that there
are some comments in cl-lib.el that suggest loading cl-loaddefs.el
involves some trickery, so I guess I don't get to eat the cake here.

In that case, I don't see how Eli's suggestion to predicate the
cl-assert call on (featurep 'cl-lib) will help, as feauturep is not
going to load the library for us.  Do we want the following instead?

diff --git a/lisp/custom.el b/lisp/custom.el
index 076790b661..e55c9db1ac 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -1288,10 +1288,13 @@ custom-available-themes
 loaded, and no effort is made to check that the files contain
 valid Custom themes.  For a list of loaded themes, check the
 variable `custom-known-themes'."
+  (eval-when-compile (require 'cl-lib))
   (let ((suffix "-theme\\.el\\'")
     (dolist (dir (custom-theme--load-path))
-      ;; `custom-theme--load-path' promises DIR exists and is a directory.
+      (cl-assert
+       (file-directory-p dir) t
+       "Non-existent directory in `custom-theme-load-path' expansion: %s")
       (dolist (file (directory-files dir nil suffix))
         (let ((theme (intern (substring file 0 (string-match-p suffix file)))))
           (and (custom-theme-name-valid-p theme)

reply via email to

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