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.

Revisions

  1. Khady revised this gist Mar 8, 2018. No changes.
  2. Khady created this gist Mar 8, 2018.
    23 changes: 23 additions & 0 deletions pick-theme-from-env.el
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    (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))