summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2024-09-12 09:07:58 -0400
committerbd <bdunahu@operationnull.com>2024-09-12 09:13:36 -0400
commit9f2a566fa39232d9bd8cbda60f5f4acb1992295e (patch)
tree548fca305d775c7f2cfd53c496a3467a31732ee4 /.config
parentf67c2a3ae89f1e8733ccff18daa1572702a805f4 (diff)
added smarter compile functions that look for a makefile
Diffstat (limited to '.config')
-rw-r--r--.config/emacs/modules/bd--devel.el13
1 files changed, 11 insertions, 2 deletions
diff --git a/.config/emacs/modules/bd--devel.el b/.config/emacs/modules/bd--devel.el
index caa8e0a..a37762d 100644
--- a/.config/emacs/modules/bd--devel.el
+++ b/.config/emacs/modules/bd--devel.el
@@ -32,11 +32,20 @@ to.")
(concat "/sudo:root@localhost:"
buffer-file-name))))
+(defun bd/compile-dwim (f)
+ (let ((default-directory
+ (or (locate-dominating-file "." "Makefile")
+ default-directory)))
+ (call-interactively f)))
(setq compilation-always-kill t
compilation-scroll-output 'first-error)
-(keymap-set prog-mode-map "C-," #'recompile)
-(keymap-set prog-mode-map "C-<" #'compile)
+(keymap-set prog-mode-map "C-," #'(lambda ()
+ (interactive)
+ (bd/compile-dwim #'recompile)))
+(keymap-set prog-mode-map "C-<" #'(lambda ()
+ (interactive)
+ (bd/compile-dwim #'compile)))
(add-hook 'prog-mode-hook (lambda ()
(font-lock-add-keywords