home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

commit af1fe0037b666068ff82fd7654218ef240f2cda7
parent 484833169274d66f6585e9135087ccbbdfde8d00
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Tue,  9 Jul 2024 18:18:54 +0200

tools/emacs: initial configuration of run-command

Add a "dynamic" hack based list. If a folder `hack` is in the
project (or current directory if no project), then add any executable
file in the list.

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

Diffstat:
Mtools/emacs/config/config-programming.el | 24++++++++++++++++++++++++
1 file changed, 24 insertions(+), 0 deletions(-)

diff --git a/tools/emacs/config/config-programming.el b/tools/emacs/config/config-programming.el @@ -3,6 +3,8 @@ ;;; Configure general programming ;;; Code: +(declare-function vde-project--project-root-or-default-directory "proj-func") + (defun my-recompile (args) (interactive "P") (cond @@ -36,6 +38,28 @@ (compile (concat python-shell-interpreter " " (buffer-file-name)))) ((call-interactively 'compile)))) +(use-package run-command + :bind ("C-c c" . run-command) + :config + ;; TODO (defun run-command-recipe-make ()) + (defun run-command-recipe-hack () + "Returns a dynamic list of commands based of the presence of an `hack' folder +in the project root *or* the default-directory." + (let* ((dir (vde-project--project-root-or-default-directory)) + (hack-dir (expand-file-name "hack" dir)) + (files (directory-files hack-dir))) + (when (file-accessible-directory-p hack-dir) + (mapcar (lambda (file) + (let ((hack-file (expand-file-name file hack-dir))) + (when (and (file-regular-p hack-file) + (file-executable-p hack-file)) + (list :command-line hack-file + :command-name file + :working-dir dir + :runner 'run-command-runner-compile)))) + files)))) + (add-to-list 'run-command-recipes 'run-command-recipe-hack)) + ;; try out consult-gh ;; (use-package consult-gh ;; :after consult