summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.emacs23
1 files changed, 23 insertions, 0 deletions
diff --git a/.emacs b/.emacs
index 99771bf..cb9c1fe 100644
--- a/.emacs
+++ b/.emacs
@@ -474,6 +474,29 @@
(lambda ()
(ibuffer-switch-to-saved-filter-groups "my/ibuffer-groups")))
+;;; Development helpers.
+(defun my/emacs-run-testcase ()
+ (interactive)
+ (require 'which-func)
+ (let* ((emacs-root (project-root (project-current)))
+ (testfile (file-name-sans-extension
+ (file-relative-name
+ buffer-file-name (file-name-concat
+ emacs-root "test"))))
+ (cores (string-to-number
+ (shell-command-to-string "nproc --all")))
+ (options
+ `(("SELECTOR" . ,(which-function))
+ ("TEST_BACKTRACE_LINE_LENGTH" . nil)))
+ (options-list
+ (seq-map
+ (lambda (opt) (format "%s=%s" (car opt) (cdr opt)))
+ options))
+ (compile-command
+ (format "make -j%s && make -C test %s %s"
+ cores testfile (string-join options-list " "))))
+ (call-interactively 'project-compile)))
+
;;; Helper functions and miscellaneous settings.
;;;; French quick toggle.