File tree 1 file changed +50
-0
lines changed
1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ ; ;; cppsm --- summary
2
+
3
+ ; ;; commentary:
4
+
5
+ ; ;; code:
6
+
7
+ (require 'ansi-color )
8
+ (require 'comint )
9
+ (require 'subr-x )
10
+
11
+ (defun cppsm-project-directory-from (candidate )
12
+ " Determine current project directory."
13
+ (if (file-exists-p (concat candidate " .cppsm" ))
14
+ candidate
15
+ (let ((parent (file-name-directory (directory-file-name candidate))))
16
+ (unless (equal parent candidate)
17
+ (cppsm-project-directory-from parent)))))
18
+
19
+ (defconst cppsm-buffer-name " *cppsm*" )
20
+
21
+ (defun cppsm-run-command ())
22
+
23
+ (defun cppsm-test ()
24
+ " Run `cppsm test` in the current project."
25
+ (interactive )
26
+ (if-let (default-directory (cppsm-project-directory-from default-directory))
27
+ (progn
28
+ (when-let ((buffer (get-buffer cppsm-buffer-name)))
29
+ (kill-buffer buffer))
30
+ (when-let ((process (start-process-shell-command
31
+ " cppsm-test"
32
+ (let ((buffer (get-buffer-create cppsm-buffer-name)))
33
+ (with-current-buffer buffer
34
+ (comint-mode ))
35
+ buffer)
36
+ " cppsm test" )))
37
+ (set-process-filter process 'comint-output-filter )
38
+ (set-process-sentinel
39
+ process
40
+ (function (lambda (process event)
41
+ (message (string-trim event))
42
+ (when-let ((buffer (get-buffer " *cppsm*" )))
43
+ (with-current-buffer buffer
44
+ (compilation-mode ))))))))
45
+ (message " Couldn't determine cppsm project directory. " )))
46
+
47
+ (provide 'cppsm )
48
+ ; ;; cppsm ends here
49
+
50
+ (function (lambda () ))
You can’t perform that action at this time.
0 commit comments