Function: auto-dark--enable-themes

auto-dark--enable-themes is an interactive and natively compiled function defined in auto-dark.el.

Signature

(auto-dark--enable-themes &optional THEMES)

Documentation

Re-enable THEMES, which defaults to ‘custom-enabled-themes’.

This will load themes if necessary.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/fxsazwcy8jcsigjhcydkb81ip47xqcw0-emacs-packages-deps/share/emacs/site-lisp/elpa/auto-dark-20260313.2356/auto-dark.el
(defun auto-dark--enable-themes (&optional themes)
  "Re-enable THEMES, which defaults to ‘custom-enabled-themes’.
This will load themes if necessary."
  (interactive)
  (let ((full-themes (remq 'user
                           (delete-dups (or themes custom-enabled-themes)))))
    ;; Disable only the themes we’re not going to re-enable.
    (mapc (lambda (theme)
            (unless (memq theme full-themes)
              (disable-theme theme)))
          custom-enabled-themes)
    (let ((failures (mapcan (lambda (theme)
                              (condition-case nil
                                  ;; We use `enable-theme' instead of
                                  ;; `load-theme' when possible because:
                                  ;; 1. `load-theme' prompts about
                                  ;;    `custom-safe-themes' which would
                                  ;;    break init or fire on every
                                  ;;    switch (#64, #82).
                                  ;; 2. `enable-theme' is faster since it
                                  ;;    skips re-evaluating the theme file.
                                  ;; The pre-load in `:set' below handles
                                  ;; the safety prompt once up front.
                                  ;;
                                  ;; However, we check `theme-settings'
                                  ;; rather than `custom-theme-p' because
                                  ;; some theme libraries (e.g.
                                  ;; modus-themes v5) eagerly call
                                  ;; `custom-declare-theme' at
                                  ;; `require'-time for all their themes.
                                  ;; This makes `custom-theme-p' return t
                                  ;; even though no face specs have been
                                  ;; computed yet.  `enable-theme' on such
                                  ;; a theme is a no-op (#96).
                                  (ignore
                                   (if (get theme 'theme-settings)
                                       (enable-theme theme)
                                     (load-theme theme t)))
                                (error (list theme))))
                            (reverse full-themes))))
      (when failures
        (warn "Failed to enable theme(s): %s"
              (mapconcat #'symbol-name failures ", "))))))