[Emacs] Add compilation-mode config

This commit is contained in:
Lucien Cartier-Tilet 2021-10-18 16:28:09 +02:00
parent f46c0c709b
commit 355e3ef249
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -2337,6 +2337,44 @@ And lets add some fancy icons in dired!
:init (image-diredx-adjust-mode 1))
#+end_src
*** Compilation mode
:PROPERTIES:
:CUSTOM_ID: Packages-Configuration-Emacs-built-ins-Compilation-mode-7nh817m0t8j0
:END:
After reading about a blog article, I found out it is possible to run
quite a few things through ~compilation-mode~, so why not? First, lets
redefine some keybinds for this mode. Ill also define a general
keybind in order to re-run my programs from other buffers than the
~compilation-mode~ buffer.
#+begin_src emacs-lisp
(after! compile
(general-define-key
:keymaps 'compilation-mode-map
"g" nil
"r" #'recompile
"h" nil))
(general-define-key
:states 'normal
:prefix "SPC"
"R" #'recompile)
#+end_src
I also want to follow the output of the compilation buffer, as well as
enable some syntax highlighting, so lets do this.
#+begin_src emacs-lisp
(after! compile
(setq compilation-scroll-output t))
(require 'ansi-color)
(defun colorize-compilation-buffer ()
(let ((inhibit-read-only t))
(ansi-color-apply-on-region (point-min) (point-max))))
(add-hook 'compilation-mode-hook #'colorize-compilation-buffer)
#+end_src
*** Eshell
:PROPERTIES:
:CUSTOM_ID: Packages-Configuration-Emacs-built-ins-Eshell0662fl6184j0