[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: Sat, 02 Jun 2018 19:53:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: "Basil L. Contovounesios" <address@hidden>
>> Cc: <address@hidden>,  <address@hidden>
>> Date: Fri, 01 Jun 2018 21:48:21 +0100
>> >> Do you mean a cl-assertion, or an emulation thereof?
>> >
>> > I meant cl-assert.
>> Unless I (being unfamiliar with the subtleties of the build and
>> bootstrap process) am missing something, I think it's too early to load
>> cl-lib here; at least 'make bootstrap' fails for me when I add
>> (eval-when-compile (require 'cl-lib)) to custom.el.  Is there a way
>> around this?
> Yes, explicitly check whether cl-lib is available, and skip the call
> if not.  We don't need this assertion during the bootstrap.

It somehow evaded me until now that cl-assert has an autoload cookie.
This means I can get away with calling it in custom-available-themes
without first requiring cl-lib, whether at top-level or inside the
function, right?  In other words, is the following kosher (and is the
wording up to scratch)?

diff --git a/lisp/custom.el b/lisp/custom.el
index 076790b661..f08a8e9c3e 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -1291,7 +1291,9 @@ custom-available-themes
   (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)
If not, WDYM exactly by "check whether cl-lib is available"?
Passing a non-nil NOERROR argument to a top-level

  (eval-when-compile (require 'cl-lib nil t))

still causes 'make bootstrap' to fail, and writing

  (when (require/featurep/fboundp ...)
    (cl-assert ...))

in custom-available-themes doesn't make sense to me, especially given
that cl-assert is autoloaded.

Am I misunderstanding something?  Sorry about my slow uptake on this;
I'm not deliberately trying to be obtuse, rather trying to learn what
the best approach is here and why.



reply via email to

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