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\\'") themes) (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)