From 6bc170097f1dfb7ea4db91544c5ab653279e15cd Mon Sep 17 00:00:00 2001 From: myTerminal Date: Fri, 6 Nov 2020 18:04:01 -0600 Subject: [PATCH] implement a function to reload the currently activated theme --- README.md | 11 ++++++++--- theme-looper.el | 12 +++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bdab556..74f3392 100755 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ A convenience package to switch themes in Emacs. Emacs 24 and later comes with a set of pre-installed color-themes that can be enabled by a simple command like: M-x load-theme RET wombat - + The above command enables (rather activates) 'wombat' theme. However, when you get lazy as I did, you need something like theme-looper.el. So, if you have a list of your favorite color-themes and you want to cycle through them with simple keystrokes, you've come to the right place. ## Installation @@ -28,7 +28,7 @@ The above command enables (rather activates) 'wombat' theme. However, when you g Save the file 'theme-looper.el' to disk and add the directory containing it to 'load-path' using a command in your '.emacs' file like: (add-to-list 'load-path "~/.emacs.d/") - + The above line assumes that you've placed the file into the Emacs directory '.emacs.d'. Start the package with: @@ -89,13 +89,17 @@ If you want to reset your color-theme preferences, simply use (theme-looper-reset-themes-selection) +In order to reload the currently activated color-theme, you can use + + (theme-looper-reload-current-theme) + You can set hook functions to be run after every theme switch (add-hook 'theme-looper-post-switch-hook 'my-func) ## Acknowledgments -Thanks to the below people for their valuable feedback, suggestions, help, and enhancements (in chronological order of contributions): +Thanks to the below people for their valuable feedback, suggestions, help, and enhancements (in chronological order of their contributions): - [syohex](https://github.com/syohex) - [protonpopsicle](https://github.com/protonpopsicle) @@ -103,3 +107,4 @@ Thanks to the below people for their valuable feedback, suggestions, help, and e - [romildo](https://github.com/romildo) - [4goodapp](https://github.com/4goodapp) - [fishyfriend](https://github.com/fishyfriend) +- [kwstat](https://github.com/kwstat) diff --git a/theme-looper.el b/theme-looper.el index f742e2c..1d0ac5c 100755 --- a/theme-looper.el +++ b/theme-looper.el @@ -3,7 +3,7 @@ ;; This file is not part of Emacs ;; Author: Mohammed Ismail Ansari -;; Version: 2.6 +;; Version: 2.7 ;; Keywords: convenience, color-themes ;; Maintainer: Mohammed Ismail Ansari ;; Created: 2014/03/22 @@ -73,6 +73,10 @@ ;; ;; (theme-looper-reset-themes-selection) ;; +;; In order to reload the currently activated color-theme, you can use +;; +;; (theme-looper-reload-current-theme) +;; ;; You can set hook functions to be run after every theme switch ;; ;; (add-hook 'theme-looper-post-switch-hook 'my-func) @@ -283,6 +287,12 @@ Pass `*default*' to select Emacs defaults" (theme-looper--get-looped-themes)))) (theme-looper-enable-theme-with-log some-theme))) +;;;###autoload +(defun theme-looper-reload-current-theme () + "Reloads the currently activated theme" + (interactive) + (theme-looper-enable-theme (theme-looper--get-current-theme))) + ;;;###autoload (defun theme-looper-select-theme () "Lets user select a theme from a list of favorite ones rendered using ivy API"