git.fiddlerwoaroof.com
Browse code

fix: make fwoar-helm-project work

Edward Langley authored on 05/12/2023 08:01:20
Showing 1 changed files
... ...
@@ -47,8 +47,8 @@
47 47
 (defvar fwoar::*helm-project-files-source*
48 48
   `((name . "Project Files")
49 49
     (candidates . (lambda ()
50
-                    (when-let* ((fwoar::project (project-current))
51
-                                (fwoar::root (project-root fwoar::project)))
50
+                    (when-let* ((fwoar::project fwoar-helm-project::*current-project*)
51
+                                (fwoar::root (project-root fwoar-helm-project::*current-project*)))
52 52
                       (mapcar (lambda (it)
53 53
                                 (cons (f-relative it fwoar::root)
54 54
                                       it))
... ...
@@ -58,7 +58,7 @@
58 58
 (defvar fwoar::*helm-project-buffers-source*
59 59
   `((name . "Project Buffers")
60 60
     (candidates . (lambda ()
61
-                    (when-let* ((fwoar::project (project-current)))
61
+                    (when-let* ((fwoar::project fwoar-helm-project::*current-project*))
62 62
                       (funcall (-compose (fwoar/over (lambda (it)
63 63
                                                        (cons (buffer-name it)
64 64
                                                              it)))
... ...
@@ -85,16 +85,17 @@
85 85
               (default-directory (project-root fwoar::project)))
86 86
     (find-file fn)))
87 87
 
88
+(defvar fwoar-helm-project::*current-project*)
88 89
 (defun fwoar::helm-find-file-in-project ()
89 90
   (interactive)
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
-                ))))
91
+  (let ((fwoar-helm-project::*current-project* (project-current nil)))
92
+    (helm (list 'fwoar::*helm-project-files-source*
93
+                'fwoar::*helm-project-buffers-source*
94
+                'fwoar::*helm-project-known-projects*
95
+                (helm-build-dummy-source
96
+                    "Create Project File"
97
+                  :action (helm-make-actions
98
+                           "Make file" #'fwoar::project-find-file))))))
98 99
 
99 100
 (defun fwoar::spotlight-validate-or-make-dummy-process (input)
100 101
   (cond
... ...
@@ -141,9 +142,11 @@ Make a dummy process if the input is empty with a clear message to the user."
141 142
 (defun fwoar::initialize-fwoar-helm-project ()
142 143
   (message "initializing fwoar-helm-project %s" project-switch-commands)
143 144
   (define-key project-prefix-map
144
-    "f" 'fwoar::helm-find-file-in-project)
145
+              "f"
146
+              'fwoar::helm-find-file-in-project)
145 147
 
146
-  (let ((it (assoc 'project-find-file project-switch-commands)))
148
+  (let ((it (assoc 'project-find-file
149
+                   project-switch-commands)))
147 150
     (when it
148 151
       (rplaca it
149 152
               'fwoar::helm-find-file-in-project)))