Skip to content

Instantly share code, notes, and snippets.

@Khady
Created March 8, 2018 14:29
Show Gist options
  • Save Khady/da6b0f56faa1b608c0683cdb1612d79a to your computer and use it in GitHub Desktop.
Save Khady/da6b0f56faa1b608c0683cdb1612d79a to your computer and use it in GitHub Desktop.
load emacs theme selected by env variables
(setq-local louis/default-theme (if (window-system) 'doom-molokai 'zenburn))
(setq-local louis/bad-id-theme 'whiteboard)
(let ((count-themes 1)
(louis/themes-ids (make-hash-table :size 30))
(louis/themes-names (make-hash-table :size 30 :test 'equal))
(env-theme-name (getenv "EN"))
(env-theme-id (getenv "EI")))
(mapc
(lambda (theme)
(puthash count-themes theme louis/themes-ids)
(puthash (symbol-name theme) theme louis/themes-names)
(setq count-themes (+ 1 count-themes)))
(custom-available-themes))
(setq-local
louis/selected-theme
(if env-theme-name
(gethash env-theme-name louis/themes-names louis/bad-id-theme)
(if env-theme-id
(gethash (string-to-number env-theme-id) louis/themes-ids louis/bad-id-theme)
louis/default-theme
)))
(load-theme louis/selected-theme t))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment