Function: custom-available-themes

custom-available-themes is a byte-compiled function defined in custom.el.gz.

Signature

(custom-available-themes)

Documentation

Return a list of Custom themes available for loading.

Search the directories specified by custom-theme-load-path for files named FOO-theme.el, and return a list of FOO symbols.

The returned symbols may not correspond to themes that have been 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.

Source Code

;; Defined in /usr/src/emacs/lisp/custom.el.gz
(defun custom-available-themes ()
  "Return a list of Custom themes available for loading.
Search the directories specified by `custom-theme-load-path' for
files named FOO-theme.el, and return a list of FOO symbols.

The returned symbols may not correspond to themes that have been
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'."
  (let ((suffix "-theme\\.el\\'")
        themes)
    (dolist (dir (custom-theme--load-path))
      ;; `custom-theme--load-path' promises DIR exists and is a
      ;; directory, but `custom.el' is loaded too early during
      ;; bootstrap to use `cl-lib' macros, so guard with
      ;; `file-directory-p' instead of calling `cl-assert'.
      (dolist (file (and (file-directory-p dir)
                         (directory-files dir nil suffix)))
        (let ((theme (intern (substring file 0 (string-match-p suffix file)))))
          (and (custom-theme-name-valid-p theme)
               (not (memq theme themes))
               (push theme themes)))))
    (nreverse themes)))