First commit.
This commit is contained in:
74
lisp/utilities/compile.el
Normal file
74
lisp/utilities/compile.el
Normal file
@@ -0,0 +1,74 @@
|
||||
;;; compile.el --- sets up Emacs compile support -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(defun user--compilation-mode-hook ()
|
||||
"Compilation mode hook.")
|
||||
|
||||
|
||||
(defun user--compilation-filter-hook ()
|
||||
"Hook for filtering compilation output."
|
||||
;; Temporarily make buffer writable.
|
||||
(let ((inhibit-read-only t))
|
||||
;; Colorize compilation output.
|
||||
(ansi-color-apply-on-region (point-min) (point-max))))
|
||||
|
||||
|
||||
(defun user/compile ()
|
||||
"Compile current context."
|
||||
(interactive)
|
||||
(let ((ede-proj (user/proj-from-path user/ede-proj (path-abs-buffer))))
|
||||
(cond
|
||||
(ede-proj (user/proj-build ede-proj))
|
||||
((feature-p 'flex-compile) (call-interactively 'flex-compile-compile))
|
||||
((fboundp 'mode-compile) (call-interactively 'mode-compile))
|
||||
(t (call-interactively 'compile)))))
|
||||
|
||||
;; https://www.emacswiki.org/emacs/CompileCommand
|
||||
(use-package compile
|
||||
:defer
|
||||
:init
|
||||
(user/bind-key-global :code :compile 'user/compile)
|
||||
:hook ((compilation-mode-hook . user--compilation-mode-hook)
|
||||
(compilation-filter-hook . user--compilation-filter-hook))
|
||||
:config
|
||||
(validate-setq
|
||||
;; Prevent input in compilation buffer.
|
||||
compilation-disable-input nil
|
||||
;; Automatically scroll output.
|
||||
compilation-scroll-output t)
|
||||
|
||||
(with-eval-after-load 'popwin
|
||||
(add-to-list
|
||||
'popwin:special-display-config
|
||||
;; Don't select compilation window when shown
|
||||
'(compilation-mode :height 20 :dedicated t)))
|
||||
|
||||
;; https://github.com/plandes/flex-compile
|
||||
(use-package flex-compile
|
||||
:disabled
|
||||
:pin "MELPA")
|
||||
|
||||
;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Compilation-Mode.html
|
||||
(use-package mode-compile
|
||||
:defer
|
||||
:config
|
||||
;; Ensure byte-run has been loaded or mode-compile will override
|
||||
;; `define-obsolete-variable-alias'.
|
||||
(when (load "byte-run.el" nil :noerror)
|
||||
(validate-setq
|
||||
;; Set a sane compilation frame name.
|
||||
mode-compile-other-frame-name "*compilation*"
|
||||
;; Run make with low priority and use multiple processes.
|
||||
mode-compile-make-program "nice make"
|
||||
mode-compile-default-make-options "-k -j"
|
||||
;; Save the current buffer on compilation.
|
||||
mode-compile-always-save-buffer-p t)
|
||||
|
||||
(with-executable 'clang
|
||||
(add-to-list 'cc-compilers-list "clang")
|
||||
(add-to-list 'c++-compilers-list "clang++")))))
|
||||
|
||||
|
||||
(provide 'utilities/compile)
|
||||
;;; compile.el ends here
|
Reference in New Issue
Block a user