aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bard-elisp/bard-compile.el53
-rw-r--r--bard-emacs-modules/bard-emacs-prog.el13
2 files changed, 62 insertions, 4 deletions
diff --git a/bard-elisp/bard-compile.el b/bard-elisp/bard-compile.el
new file mode 100644
index 0000000..5c4d20f
--- /dev/null
+++ b/bard-elisp/bard-compile.el
@@ -0,0 +1,53 @@
+;; Stolen from (http://endlessparentheses.com/ansi-colors-in-the-compilation-buffer-output.html)
+(require 'ansi-color)
+(defun endless/colorize-compilation ()
+ "Colorize from `compilation-filter-start' to `point'."
+ (let ((inhibit-read-only t))
+ (ansi-color-apply-on-region
+ compilation-filter-start (point))))
+
+(add-hook 'compilation-filter-hook
+ #'endless/colorize-compilation)
+
+;; Stolen from (https://oleksandrmanzyuk.wordpress.com/2011/11/05/better-emacs-shell-part-i/)
+(defun regexp-alternatives (regexps)
+ "Return the alternation of a list of regexps."
+ (mapconcat (lambda (regexp)
+ (concat "\\(?:" regexp "\\)"))
+ regexps "\\|"))
+
+(defvar non-sgr-control-sequence-regexp nil
+ "Regexp that matches non-SGR control sequences.")
+
+(setq non-sgr-control-sequence-regexp
+ (regexp-alternatives
+ '(;; icon name escape sequences
+ "\033\\][0-2];.*?\007"
+ ;; non-SGR CSI escape sequences
+ "\033\\[\\??[0-9;]*[^0-9;m]"
+ ;; noop
+ "\012\033\\[2K\033\\[1F"
+ )))
+
+(defun filter-non-sgr-control-sequences-in-region (begin end)
+ (save-excursion
+ (goto-char begin)
+ (while (re-search-forward
+ non-sgr-control-sequence-regexp end t)
+ (replace-match ""))))
+
+(defun filter-non-sgr-control-sequences-in-output (ignored)
+ (let ((start-marker
+ (or comint-last-output-start
+ (point-min-marker)))
+ (end-marker
+ (process-mark
+ (get-buffer-process (current-buffer)))))
+ (filter-non-sgr-control-sequences-in-region
+ start-marker
+ end-marker)))
+
+(add-hook 'comint-output-filter-functions
+ 'filter-non-sgr-control-sequences-in-output)
+
+(provide 'bard-compile)
diff --git a/bard-emacs-modules/bard-emacs-prog.el b/bard-emacs-modules/bard-emacs-prog.el
index e84b39a..cdda570 100644
--- a/bard-emacs-modules/bard-emacs-prog.el
+++ b/bard-emacs-modules/bard-emacs-prog.el
@@ -1,9 +1,5 @@
(use-package haskell-mode
:ensure t
- :hook
- ((haskell-mode . interactive-haskell-mode)
- (haskell-mode . haskell-doc-mode)
- (haskell-mode . haskell-indent-mode))
:config
(setq haskell-interactive-popup-errors nil))
@@ -81,6 +77,15 @@
(when (derived-mode-p 'c-mode 'c++-mode 'java-mode)
(ggtags-mode 1)))))
+(use-package compile
+ :ensure nil
+ :defer 2
+ :config
+ (require 'bard-compile)
+ (setq compilation-scroll-output t
+ compilation-auto-jump-to-first-error t)
+ )
+
;; Version control
(define-key global-map (kbd "C-c g") #'magit-status)
(setq magit-repository-directories