diff options
author | Yuchen Pei <id@ypei.org> | 2025-01-13 19:29:38 +1100 |
---|---|---|
committer | Yuchen Pei <id@ypei.org> | 2025-01-13 19:29:38 +1100 |
commit | 087556dfaaa23ab5604fba6b95e7c29515a07767 (patch) | |
tree | 0c74229e16605fd544a77a2f1bbe3c6b192d98bb /emacs/.emacs.d/lisp/my/my-mariadb.el | |
parent | c4edef7057f7c6cc108a8b8d73a2b0a203728567 (diff) |
[emacs] mtr and gud
compilation in mtr; convenience function in gud that inserts function
name and current source line of the source buffer
Diffstat (limited to 'emacs/.emacs.d/lisp/my/my-mariadb.el')
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-mariadb.el | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-mariadb.el b/emacs/.emacs.d/lisp/my/my-mariadb.el index bdb1c60..d790944 100644 --- a/emacs/.emacs.d/lisp/my/my-mariadb.el +++ b/emacs/.emacs.d/lisp/my/my-mariadb.el @@ -288,5 +288,30 @@ switches to the buffer." (file-name (format "/tmp/%s.wiki" term))) (my-save-text-and-switch-to-buffer source file-name))) +(defvar my-mtr-compilation-error-re + '(mtr "^mysqltest: At line \\([0-9]+\\)" nil 1)) + +;; (defun my-mtr-find-test-file (test-name &optional dir) +;; (unless dir (setq dir default-directory)) +;; ()) + +(defun my-mtr-set-compile-command () + (when (and buffer-file-name + (equal "test" (file-name-extension buffer-file-name))) + (when-let* + ((source-dir (expand-file-name (project-root (project-current)))) + (build-dir (replace-regexp-in-string "/src/$" "/build/" source-dir)) + (test-name + (progn + (when (string-match + "^.*/mysql-test/\\(.+?\\)/\\(t/\\)?\\([^/]+\\)\\.test$" + buffer-file-name) + (format "%s.%s" + (match-string 1 buffer-file-name) + (match-string 3 buffer-file-name)))))) + (setq-local + compile-command + (format "%smysql-test/mtr %s" build-dir test-name))))) + (provide 'my-mariadb) ;;; my-mariadb.el ends here |