doomemacs/core/defuns/macros-eval.el

24 lines
768 B
EmacsLisp
Raw Normal View History

2016-05-12 14:53:31 +08:00
;;; macros-eval.el
;;;###autoload
(defmacro def-builder! (mode command &optional build-file)
"Register major/minor MODE with build COMMAND. If FILES are provided, do an additional
check to make sure they exist in the project root."
2016-05-21 10:37:30 +08:00
(let ((fn (intern (format "doom--init-builder-%s" mode))))
2016-05-12 14:53:31 +08:00
`(progn
(defun ,fn ()
(when (or (null ,build-file)
2016-05-21 10:37:30 +08:00
(doom/project-has-files ,build-file))
(setq doom--build-command '(,command . ,build-file))))
,(when (eq major-mode mode)
(funcall fn))
2016-05-12 14:53:31 +08:00
(add-hook! ,mode ',fn))))
;;;###autoload
(defmacro def-repl! (mode command)
"Define a REPL for a mode."
`(push '(,mode . ,command) rtog/mode-repl-alist))
(provide 'macros-eval)
;;; macros-eval.el ends here