Skip to content

Commit 72d0268

Browse files
committed
Improve compilation mode, and add a regexp for NodeJS stacktraces.
1 parent 1fe7038 commit 72d0268

File tree

1 file changed

+35
-12
lines changed

1 file changed

+35
-12
lines changed

emacs.d/init.el

+35-12
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,9 @@
237237
;; Turn annoying windows like *help* into popup windows that can be
238238
;; closed with q or C-g!
239239
(use-package popwin
240-
:init
240+
:config
241241
;; Hey, I like full side-by-side compile buffers, so leave 'em alone
242242
(delete '(compilation-mode :noselect t) popwin:special-display-config)
243-
:config
244243
(popwin-mode 1))
245244

246245
;; Simple REST client / HTTP explorer
@@ -274,10 +273,10 @@
274273
(add-hook 'prog-mode-hook 'eldoc-mode))
275274

276275
;; Enable semantic parsing where applicable
277-
(use-package semantic
278-
:commands semantic-mode
279-
:init
280-
(add-hook 'prog-mode-hook 'semantic-mode))
276+
;; (use-package semantic
277+
;; :commands semantic-mode
278+
;; :init
279+
;; (add-hook 'prog-mode-hook 'semantic-mode))
281280

282281
;; Highlight and auto-clean bad whitespace
283282
(use-package whitespace
@@ -341,6 +340,36 @@
341340
:config
342341
(global-yascroll-bar-mode 1))
343342

343+
(use-package compile
344+
:init
345+
;; Shut up compile saves
346+
(setq compilation-ask-about-save nil)
347+
;; Don't save *anything*
348+
(setq compilation-save-buffers-predicate '(lambda () nil))
349+
:config
350+
;; Add NodeJS error format
351+
(setq compilation-error-regexp-alist-alist
352+
;; Tip: M-x re-builder to test this out
353+
(cons '(node "^[ ]+at \\(?:[^\(\n]+ \(\\)?\\([a-zA-Z\.0-9_/-]+\\):\\([0-9]+\\):\\([0-9]+\\)\)?$"
354+
1 ;; file
355+
2 ;; line
356+
3 ;; column
357+
)
358+
compilation-error-regexp-alist-alist))
359+
(setq compilation-error-regexp-alist
360+
(cons 'node compilation-error-regexp-alist))
361+
:bind
362+
(("C-c C-c" . compile)
363+
("C-c C-r" . recompile)))
364+
365+
;; TODO: look at Casey/work dotfiles to make compile better
366+
;; TODO: re-run last command http://stackoverflow.com/questions/275842/is-there-a-repeat-last-command-in-emacs
367+
;;(global-set-key (kbd "C-c C-c") 'compile)
368+
;;(global-set-key "\C-B" 'recompile)
369+
;;global-set-key "\C-x\C-c" 'switch-to-most-recent-compile-buffer)
370+
371+
372+
344373
;; TODO: https://github.com/nschum/highlight-symbol.el
345374

346375

@@ -812,12 +841,6 @@
812841
(global-set-key (kbd "C-q") 'next-error)
813842
(global-set-key (kbd "C-S-q") 'previous-error)
814843

815-
;; TODO: look at Casey/work dotfiles to make compile better
816-
;; TODO: re-run last command http://stackoverflow.com/questions/275842/is-there-a-repeat-last-command-in-emacs
817-
(global-set-key (kbd "C-c C-c") 'compile)
818-
;;(global-set-key "\C-B" 'recompile)
819-
;;global-set-key "\C-x\C-c" 'switch-to-most-recent-compile-buffer)
820-
821844
;; TODO: the keypad insert key is <help> (like F1)! Nice!
822845

823846
(global-set-key "\C-v" 'yank)

0 commit comments

Comments
 (0)