sjrmanning / darkokai

:new_moon: Dark colour theme inspired by monokai with an uninspired name.
MIT License
118 stars 11 forks source link

Remove unsafe local variables #1

Closed purcell closed 8 years ago

purcell commented 8 years ago

It's bad practice to throw unsafe "eval" forms in local variables.

A neater alternative is to handle this in your emacs config:

(defvar sanityinc/theme-mode-hook nil
  "Hook triggered when editing a theme file.")

(defun sanityinc/run-theme-mode-hooks-if-theme ()
  "Run `sanityinc/theme-mode-hook' if this appears to a theme."
  (when (string-match "\\(color-theme-\\|-theme\\.el\\)" (buffer-name))
    (run-hooks 'sanityinc/theme-mode-hook)))

(add-hook 'emacs-lisp-mode-hook 'sanityinc/run-theme-mode-hooks-if-theme)

then

(add-hook 'sanityinc/theme-mode-hook 'rainbow-mode)
(add-hook 'sanityinc/theme-mode-hook '(lambda () (aggressive-indent-mode -1)))
sjrmanning commented 8 years ago

Good idea :) Thanks for this!