From 9f2a566fa39232d9bd8cbda60f5f4acb1992295e Mon Sep 17 00:00:00 2001 From: bd Date: Thu, 12 Sep 2024 09:07:58 -0400 Subject: added smarter compile functions that look for a makefile --- .config/emacs/modules/bd--devel.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to '.config') 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 -- cgit v1.2.3