Clean up and rough :make shortcut
This commit is contained in:
parent
0af611cf6d
commit
b2e14c475e
4 changed files with 49 additions and 26 deletions
|
@ -13,8 +13,8 @@
|
|||
:init
|
||||
(progn
|
||||
(add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-mode)
|
||||
(add-hook 'js2-mode-hook 'rainbow-delimiters-mode)
|
||||
(add-hook 'scss-mode-hook 'rainbow-delimiters-mode)))
|
||||
(add-hook 'js2-mode-hook 'rainbow-delimiters-mode)
|
||||
(add-hook 'scss-mode-hook 'rainbow-delimiters-mode)))
|
||||
|
||||
;;; Config modes
|
||||
(use-package yaml-mode
|
||||
|
@ -31,6 +31,26 @@
|
|||
|
||||
(after "evil" (evil-ex-define-cmd "ref[actor]" 'emr-show-refactor-menu))))
|
||||
|
||||
(bind my-mode-map
|
||||
"M-b" 'my:build)
|
||||
|
||||
(defvar my-build-command "make %s")
|
||||
(make-variable-buffer-local 'my-build-command)
|
||||
(add-hook! 'enh-ruby-mode-hook (setq my-build-command "rake %s"))
|
||||
|
||||
(evil-ex-define-cmd "ma[ke]" 'my:build)
|
||||
(evil-define-command my:build (arg)
|
||||
"Call a build command in the current directory.
|
||||
If ARG is nil this function calls `recompile', otherwise it calls
|
||||
`compile' passing ARG as build command."
|
||||
(interactive "<sh>")
|
||||
(let ((makepath (f-traverse-upwards
|
||||
(lambda (path)
|
||||
(f-exists? (f-expand "Makefile" path)))
|
||||
default-directory)))
|
||||
(if makepath
|
||||
(compile (format "cd '%s' && %s" makepath (format my-make-command (or arg ""))))
|
||||
(error "Could not find Makefile"))))
|
||||
|
||||
(provide 'init-dev)
|
||||
;;; init-dev.el ends here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue