emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master d921875 79/90: counsel.el (counsel-load-theme): New comman


From: Oleh Krehel
Subject: [elpa] master d921875 79/90: counsel.el (counsel-load-theme): New command
Date: Tue, 30 Jun 2015 07:29:24 +0000

branch: master
commit d9218751ca0adc9688f19de03c3b429046c19232
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    counsel.el (counsel-load-theme): New command
---
 counsel.el |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/counsel.el b/counsel.el
index 0ae079f..27ec9e7 100644
--- a/counsel.el
+++ b/counsel.el
@@ -542,6 +542,30 @@ Optional INITIAL-INPUT is the initial input in the 
minibuffer."
               :keymap counsel-describe-map
               :initial-input initial-input)))
 
+(declare-function powerline-reset "ext:powerline")
+
+(defun counsel--load-theme-action (x)
+  "Disable current themes and load theme X."
+  (condition-case nil
+      (progn
+        (mapc #'disable-theme custom-enabled-themes)
+        (load-theme (intern x))
+        (when (fboundp 'powerline-reset)
+          (powerline-reset)))
+    (error "Problem loading theme %s" x)))
+
+;;;###autoload
+(defun counsel-load-theme ()
+  "Forward to `load-theme'.
+Usable with `ivy-resume', `ivy-next-line-and-call' and
+`ivy-previous-line-and-call'."
+  (interactive)
+  (ivy-read "Load custom theme: "
+            (mapcar 'symbol-name
+                    (custom-available-themes))
+            :action #'counsel--load-theme-action))
+
+
 (provide 'counsel)
 
 ;;; counsel.el ends here



reply via email to

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