Skip to content

Commit

Permalink
implement a function to reload the currently activated theme
Browse files Browse the repository at this point in the history
  • Loading branch information
myTerminal committed Nov 7, 2020
1 parent 9fec5ae commit 6bc1700
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -89,17 +89,22 @@ 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)
- [divagant-martian](https://github.com/divagant-martian)
- [romildo](https://github.com/romildo)
- [4goodapp](https://github.com/4goodapp)
- [fishyfriend](https://github.com/fishyfriend)
- [kwstat](https://github.com/kwstat)
12 changes: 11 additions & 1 deletion theme-looper.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; This file is not part of Emacs

;; Author: Mohammed Ismail Ansari <team.terminal@gmail.com>
;; Version: 2.6
;; Version: 2.7
;; Keywords: convenience, color-themes
;; Maintainer: Mohammed Ismail Ansari <team.terminal@gmail.com>
;; Created: 2014/03/22
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 6bc1700

Please sign in to comment.