Add doom-env-version-hook

This commit is contained in:
Henrik Lissner 2016-05-25 00:11:07 -04:00
parent 3af24222b3
commit a4060ac9f4
2 changed files with 10 additions and 2 deletions

View file

@ -1,5 +1,8 @@
;;; defuns-spaceline.el
(defvar doom-env-version-hook '()
"Hook that runs whenever the environment version changes (e.g. rbenv/pyenv)")
;;;###autoload
(defun doom|spaceline-env-update ()
(when doom--env-command
@ -7,7 +10,8 @@
(let ((s (shell-command-to-string doom--env-command)))
(setq doom--env-version (if (string-match "[ \t\n\r]+\\'" s)
(replace-match "" t t s)
s))))))
s))
(run-hook-with-args 'doom-env-version-hook doom--env-version)))))
;;;###autoload
(defun doom/-flycheck-count (state)

View file

@ -14,7 +14,11 @@
(def-version-cmd! ruby-mode "ruby --version | cut -d' ' -f2")
(setq ruby-deep-indent-paren t)
;; Don't interfere with my custom RET behavior
(define-key ruby-mode-map [?\n] nil))
(define-key ruby-mode-map [?\n] nil)
(add-hook 'doom-env-version-hook
(lambda (v) (when (eq major-mode 'ruby-mode)
(push (if (string-prefix-p "2" v) "Ruby_2" "Ruby") helm-dash-docsets)))))
(use-package ruby-refactor
:after ruby-mode