diff options
author | William Carroll <wpcarro@gmail.com> | 2020-09-01T09·17+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-09-01T09·17+0100 |
commit | fb5ec068ddd50f6bce41c7a0bad45673db787940 (patch) | |
tree | 19b4ff96983c08f451e7da5f58c95b8f6090ec84 /emacs/.emacs.d/wpc/colorscheme.el | |
parent | a638e15c0dd14a25e6f032b08de5ee1575677497 (diff) |
More Elisp linting
This should cover most of the remaining linting errors. After this, I expect fewer than ten linting errors.
Diffstat (limited to 'emacs/.emacs.d/wpc/colorscheme.el')
-rw-r--r-- | emacs/.emacs.d/wpc/colorscheme.el | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/emacs/.emacs.d/wpc/colorscheme.el b/emacs/.emacs.d/wpc/colorscheme.el index 97ad59e960d8..2045777c4ee2 100644 --- a/emacs/.emacs.d/wpc/colorscheme.el +++ b/emacs/.emacs.d/wpc/colorscheme.el @@ -1,5 +1,9 @@ ;;; colorscheme.el --- Syntax highlight and friends -*- lexical-binding: t -*- + ;; Author: William Carroll <wpcarro@gmail.com> +;; Version: 0.0.1 +;; URL: https://git.wpcarro.dev/wpcarro/briefcase +;; Package-Requires: ((emacs "24.3")) ;;; Commentary: ;; @@ -21,76 +25,76 @@ ;; Constants ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defcustom colorscheme/install-kbds? t +(defcustom colorscheme-install-kbds? t "If non-nil, enable the keybindings.") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Library ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defcustom colorscheme/whitelist - (cycle/from-list +(defcustom colorscheme-whitelist + (cycle-from-list (->> (custom-available-themes) - (list/map #'symbol-name) - (list/filter (>> (s-starts-with? "doom-"))) - (list/map #'intern))) + (list-map #'symbol-name) + (list-filter (>> (s-starts-with? "doom-"))) + (list-map #'intern))) "The whitelist of colorschemes through which to cycle.") -(defun colorscheme/current () +(defun colorscheme-current () "Return the currently enabled colorscheme." - (cycle/current colorscheme/whitelist)) + (cycle-current colorscheme-whitelist)) -(defun colorscheme/disable-all () +(defun colorscheme-disable-all () "Disable all currently enabled colorschemes." (interactive) (->> custom-enabled-themes - (list/map #'disable-theme))) + (list-map #'disable-theme))) -(defun colorscheme/set (theme) +(defun colorscheme-set (theme) "Call `load-theme' with `THEME', ensuring that the line numbers are bright. There is no hook that I'm aware of to handle this more elegantly." (load-theme theme t) (prelude-set-line-number-color "#da5468")) -(defun colorscheme/whitelist-set (colorscheme) - "Focus the COLORSCHEME in the `colorscheme/whitelist' cycle." - (cycle/focus (lambda (x) (equal x colorscheme)) colorscheme/whitelist) - (colorscheme/set (colorscheme/current))) +(defun colorscheme-whitelist-set (colorscheme) + "Focus the COLORSCHEME in the `colorscheme-whitelist' cycle." + (cycle-focus (lambda (x) (equal x colorscheme)) colorscheme-whitelist) + (colorscheme-set (colorscheme-current))) -(defun colorscheme/ivy-select () +(defun colorscheme-ivy-select () "Load a colorscheme using ivy." (interactive) - (let ((theme (ivy-read "Theme: " (cycle/to-list colorscheme/whitelist)))) - (colorscheme/disable-all) - (colorscheme/set (intern theme)))) + (let ((theme (ivy-read "Theme: " (cycle-to-list colorscheme-whitelist)))) + (colorscheme-disable-all) + (colorscheme-set (intern theme)))) -(cl-defun colorscheme/cycle (&key forward?) +(cl-defun colorscheme-cycle (&key forward?) "Cycle next if `FORWARD?' is non-nil. Cycle prev otherwise." - (disable-theme (cycle/current colorscheme/whitelist)) + (disable-theme (cycle-current colorscheme-whitelist)) (let ((theme (if forward? - (cycle/next colorscheme/whitelist) - (cycle/prev colorscheme/whitelist)))) - (colorscheme/set theme) + (cycle-next colorscheme-whitelist) + (cycle-prev colorscheme-whitelist)))) + (colorscheme-set theme) (message (s-concat "Active theme: " (symbol-to-string theme))))) -(defun colorscheme/next () +(defun colorscheme-next () "Disable the currently active theme and load the next theme." (interactive) - (colorscheme/cycle :forward? t)) + (colorscheme-cycle :forward? t)) -(defun colorscheme/prev () +(defun colorscheme-prev () "Disable the currently active theme and load the previous theme." (interactive) - (colorscheme/cycle :forward? nil)) + (colorscheme-cycle :forward? nil)) ;; Keybindings -(when colorscheme/install-kbds? +(when colorscheme-install-kbds? (general-define-key :prefix "<SPC>" :states '(normal) - "Ft" #'colorscheme/next - "Pt" #'colorscheme/prev)) + "Ft" #'colorscheme-next + "Pt" #'colorscheme-prev)) (provide 'colorscheme) ;;; colorscheme.el ends here |