Skip to content

Commit

Permalink
consult-theme: Restore to saved theme if candidate is unknown
Browse files Browse the repository at this point in the history
Before this change the default theme was selected.
  • Loading branch information
minad committed Jul 24, 2021
1 parent d42ccdc commit 2c784a9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions consult.el
Original file line number Diff line number Diff line change
Expand Up @@ -3496,11 +3496,14 @@ The command supports previewing the currently selected theme."
:category 'theme
:history 'consult--theme-history
:lookup (lambda (_input _cands x)
(and x (not (equal x "default")) (intern-soft x)))
(unless (equal x "default")
(or (when-let (cand (and x (intern-soft x)))
(car (memq cand avail-themes)))
saved-theme)))
:state (lambda (cand restore)
(cond
((and restore (not cand)) (consult-theme saved-theme))
((memq cand avail-themes) (consult-theme cand))))
(consult-theme (if (and restore (not cand))
saved-theme
cand)))
:default (symbol-name (or saved-theme 'default))))))
(unless (eq theme (car custom-enabled-themes))
(mapc #'disable-theme custom-enabled-themes)
Expand Down

0 comments on commit 2c784a9

Please sign in to comment.