home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 7a5ee7fa24fde495d9d0a2f56658716ac4d8938d
parent 6fc4a973e2d6dde899e2413b5b3a914c06feba9b
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Wed,  8 Apr 2020 10:38:31 +0200

config-compile.el: re-enable compile

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Mtools/emacs/config/config-compile.el | 132+++++++++++++++++++++++++++++++++++++++++++------------------------------------
1 file changed, 72 insertions(+), 60 deletions(-)

diff --git a/tools/emacs/config/config-compile.el b/tools/emacs/config/config-compile.el @@ -1,64 +1,76 @@ -;;; -*- lexical-binding: t; -*- -(when nil - (progn (use-package compile - :defer 2 - :config - (progn - ;; http://stackoverflow.com/a/13408008/1219634 - (setq-default compilation-scroll-output t - ;; I'm not scared of saving everything. - compilation-ask-about-save nil - ;; Automatically scroll and jump to the first error - compilation-scroll-output 'next-error - ;; compilation-scroll-output 'first-error - ;; compilation-auto-jump-to-first-error t - ;; Skip over warnings and info messages in compilation - compilation-skip-threshold 2 - ;; Don't freeze when process reads from stdin - compilation-disable-input t - ;; Show three lines of context around the current message - compilation-context-lines 3) - (require 'ansi-color) - (defun vde/colorize-compilation-buffer () - (unless (or (derived-mode-p 'grep-mode) ;Don't mess up colors in Grep/Ag results buffers - (derived-mode-p 'ag-mode)) - (ansi-color-apply-on-region compilation-filter-start (point)))) - (add-hook 'compilation-filter-hook #'vde/colorize-compilation-buffer) +;;; config-compile.el --- -*- lexical-binding: t; -*- +;;; Commentary: +;;; Generic compilation configuration +;;; Code: + +;; UseCompile +(use-package compile + :commands (compile) + :preface + (autoload 'ansi-color-apply-on-region "ansi-color") + + (defvar compilation-filter-start) - (defun vde/mark-compilation-window-as-dedicated () - "Setup the *compilation* window with custom settings." - (when (string-prefix-p "*compilation: " (buffer-name)) - (save-selected-window - (save-excursion - (let* ((w (get-buffer-window (buffer-name)))) - (when w - (select-window w) - (switch-to-buffer (buffer-name)) - (set-window-dedicated-p w t))))))) - (add-hook 'compilation-mode-hook 'vde/mark-compilation-window-as-dedicated))) + (defun vde/colorize-compilation-buffer () + (unless (or (derived-mode-p 'grep-mode) + (derived-mode-p 'ag-mode) + (derived-mode-p 'rg-mode)) + (let ((inhibit-read-only t)) + (ansi-color-apply-on-region compilation-filter-start (point))))) + :config + (setq-default compilation-scroll-output t + ;; I'm not scared of saving everything. + compilation-ask-about-save nil + ;; Automatically scroll and jump to the first error + compilation-scroll-output 'next-error + ;; compilation-scroll-output 'first-error + ;; compilation-auto-jump-to-first-error t + ;; Skip over warnings and info messages in compilation + compilation-skip-threshold 2 + ;; Don't freeze when process reads from stdin + compilation-disable-input t + ;; Show three lines of context around the current message + compilation-context-lines 3) + (add-hook 'compilation-filter-hook #'vde/colorize-compilation-buffer) + (defun vde/mark-compilation-window-as-dedicated () + "Setup the *compilation* window with custom settings." + (when (string-prefix-p "*compilation: " (buffer-name)) + (save-selected-window + (save-excursion + (let* ((w (get-buffer-window (buffer-name)))) + (when w + (select-window w) + (switch-to-buffer (buffer-name)) + (set-window-dedicated-p w t))))))) + (add-hook 'compilation-mode-hook 'vde/mark-compilation-window-as-dedicated) + :hook ((compilation-mode . goto-address-mode))) +;; -UseCompile + +(when nil + (progn - (use-package flycheck - :if (not (eq system-type 'windows-nt)) - :defer 4 - :commands (flycheck-mode - flycheck-next-error - flycheck-previous-error) - :init - (dolist (where '((emacs-lisp-mode-hook . emacs-lisp-mode-map) - (haskell-mode-hook . haskell-mode-map) - (js2-mode-hook . js2-mode-map) - (go-mode-hook . go-mode-map) - (c-mode-common-hook . c-mode-base-map))) - (add-hook (car where) - `(lambda () - (bind-key "M-n" #'flycheck-next-error ,(cdr where)) - (bind-key "M-p" #'flycheck-previous-error ,(cdr where))) - t)) - :config - (add-hook 'prog-mode-hook 'flycheck-mode) - (defalias 'show-error-at-point-soon - 'flycheck-show-error-at-point) - (setq flycheck-idle-change-delay 1.2)) + (use-package flycheck + :if (not (eq system-type 'windows-nt)) + :defer 4 + :commands (flycheck-mode + flycheck-next-error + flycheck-previous-error) + :init + (dolist (where '((emacs-lisp-mode-hook . emacs-lisp-mode-map) + (haskell-mode-hook . haskell-mode-map) + (js2-mode-hook . js2-mode-map) + (go-mode-hook . go-mode-map) + (c-mode-common-hook . c-mode-base-map))) + (add-hook (car where) + `(lambda () + (bind-key "M-n" #'flycheck-next-error ,(cdr where)) + (bind-key "M-p" #'flycheck-previous-error ,(cdr where))) + t)) + :config + (add-hook 'prog-mode-hook 'flycheck-mode) + (defalias 'show-error-at-point-soon + 'flycheck-show-error-at-point) + (setq flycheck-idle-change-delay 1.2)) - )) + )) (provide 'setup-compile)