-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
;;; cppsm --- summary | ||
|
||
;;; commentary: | ||
|
||
;;; code: | ||
|
||
(require 'ansi-color) | ||
(require 'comint) | ||
(require 'subr-x) | ||
|
||
(defun cppsm-project-directory-from (candidate) | ||
"Determine current project directory." | ||
(if (file-exists-p (concat candidate ".cppsm")) | ||
candidate | ||
(let ((parent (file-name-directory (directory-file-name candidate)))) | ||
(unless (equal parent candidate) | ||
(cppsm-project-directory-from parent))))) | ||
|
||
(defconst cppsm-buffer-name "*cppsm*") | ||
|
||
(defun cppsm-run-command ()) | ||
|
||
(defun cppsm-test () | ||
"Run `cppsm test` in the current project." | ||
(interactive) | ||
(if-let (default-directory (cppsm-project-directory-from default-directory)) | ||
(progn | ||
(when-let ((buffer (get-buffer cppsm-buffer-name))) | ||
(kill-buffer buffer)) | ||
(when-let ((process (start-process-shell-command | ||
"cppsm-test" | ||
(let ((buffer (get-buffer-create cppsm-buffer-name))) | ||
(with-current-buffer buffer | ||
(comint-mode)) | ||
buffer) | ||
"cppsm test"))) | ||
(set-process-filter process 'comint-output-filter) | ||
(set-process-sentinel | ||
process | ||
(function (lambda (process event) | ||
(message (string-trim event)) | ||
(when-let ((buffer (get-buffer "*cppsm*"))) | ||
(with-current-buffer buffer | ||
(compilation-mode)))))))) | ||
(message "Couldn't determine cppsm project directory."))) | ||
|
||
(provide 'cppsm) | ||
;;; cppsm ends here | ||
|
||
(function (lambda () )) |