Emacs clean up.
This commit is contained in:
@@ -2,16 +2,17 @@
|
||||
;;; Commentary:
|
||||
;; Loaded from init.el after Evil.
|
||||
;;
|
||||
;; :build Run ./build.sh from the project root.
|
||||
;; :build Run ./build.sh from the nearest ancestor dir containing it.
|
||||
;; :build ARGS Run ./build.sh ARGS, e.g. :build release -v
|
||||
;;
|
||||
;; If no build.sh is found (or it isn't executable), report it and do nothing.
|
||||
;;
|
||||
;; The compilation buffer opens at the bottom (45% height, full width) and
|
||||
;; takes focus when the build starts. ANSI colours are rendered.
|
||||
;; Kill a running build with M-x kill-compilation.
|
||||
;;; Code:
|
||||
|
||||
(setq compile-command "./build.sh"
|
||||
compilation-read-command nil ; run without prompting
|
||||
(setq compilation-read-command nil ; run without prompting
|
||||
compilation-ask-about-save nil
|
||||
compilation-scroll-output t)
|
||||
|
||||
@@ -31,10 +32,15 @@
|
||||
|
||||
;; :build runs ./build.sh; :build ARGS appends ARGS.
|
||||
(evil-define-command my/ex-build (args)
|
||||
"Run `./build.sh ARGS' from the project root."
|
||||
"Run `./build.sh ARGS' from the nearest directory containing build.sh."
|
||||
(interactive "<a>")
|
||||
(let ((compile-command (concat "./build.sh " args))) ; nil args -> ""
|
||||
(project-compile)))
|
||||
(let ((root (locate-dominating-file default-directory "build.sh")))
|
||||
(unless root
|
||||
(user-error "No build.sh found"))
|
||||
(let ((default-directory root))
|
||||
(unless (file-executable-p "build.sh")
|
||||
(user-error "build.sh is not executable"))
|
||||
(compile (string-trim (concat "./build.sh " args)))))) ; nil args -> ""
|
||||
|
||||
(evil-ex-define-cmd "build" #'my/ex-build)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user