doomemacs/core/defuns/macros-spaceline.el

18 lines
696 B
EmacsLisp
Raw Normal View History

;;; defuns-spaceline.el
;;;###autoload
2016-05-12 14:53:31 +08:00
(defmacro def-version-cmd! (modes command)
2016-05-21 10:37:30 +08:00
"Define a COMMAND for MODE that will set `doom--env-command' when that mode is
2016-02-26 13:08:41 +08:00
activated, which should return the version number of the current environment. It is used
2016-05-21 10:37:30 +08:00
by `doom|spaceline-env-update' to display a version number in the modeline. For instance:
2016-02-26 13:08:41 +08:00
2016-05-12 14:53:31 +08:00
(def-version-cmd! ruby-mode \"ruby --version | cut -d' ' -f2\")
2016-02-26 13:08:41 +08:00
This will display the ruby version in the modeline in ruby-mode buffers. It is cached the
first time."
2016-05-21 10:37:30 +08:00
(add-hook! (focus-in find-file) 'doom|spaceline-env-update)
`(add-hook! ,modes (setq doom--env-command ,command)))
(provide 'defuns-spaceline)
;;; defuns-spaceline.el ends here