git.fiddlerwoaroof.com
Browse code

feat(emacs,project,helm): Add helm action to create file in project

Edward Langley authored on 22/12/2022 07:53:48
Showing 1 changed files
... ...
@@ -80,11 +80,21 @@
80 80
                            (fwoar::helm-find-file-in-project)))
81 81
                 (project-switch-project it)))))
82 82
 
83
+(defun fwoar::project-find-file (fn)
84
+  (when-let* ((fwoar::project (project-current))
85
+              (default-directory (project-root fwoar::project)))
86
+    (find-file fn)))
87
+
83 88
 (defun fwoar::helm-find-file-in-project ()
84 89
   (interactive)
85
-  (helm '(fwoar::*helm-project-files-source*
86
-          fwoar::*helm-project-buffers-source*
87
-          fwoar::*helm-project-known-projects*)))
90
+  (helm (list 'fwoar::*helm-project-files-source*
91
+              'fwoar::*helm-project-buffers-source*
92
+              'fwoar::*helm-project-known-projects*
93
+              (helm-build-dummy-source
94
+                  "Create Project File"
95
+                :action (helm-make-actions
96
+                         "Make file" #'fwoar::project-find-file)
97
+                ))))
88 98
 
89 99
 (defun fwoar::initialize-fwoar-helm-project ()
90 100
   (message "initializing fwoar-helm-project %s" project-switch-commands)