From 92d64cb116dace79bc9680423ffe4786aaac9f75 Mon Sep 17 00:00:00 2001 From: bth Date: Wed, 21 Aug 2024 14:15:37 -0700 Subject: [PATCH] fail to make embark-dwim recurse into project dirs --- elisp/um.el | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/elisp/um.el b/elisp/um.el index bf74c5a..cad6f2a 100644 --- a/elisp/um.el +++ b/elisp/um.el @@ -107,6 +107,23 @@ ;; `embark-target-finders', since I'd have to remove the file finder and put my ;; function in the same place in the list anyway. +(defalias 'project-find-file-future-enter (kmacro "C-x p f M-n RET")) + +(defun find-file-in-project (&optional dir) + ;; (interactive) + (when-let* ((project (project-current nil dir)) + (default-directory (project-root project))) + (project-find-file-in nil nil project))) + +(defun project-search-nointeractive () + (fileloop-initialize-search + (thing-at-point 'filename t) + ;; XXX: See the comment in project-query-replace-regexp. + (cl-delete-if-not #'file-regular-p (project-files (project-current))) + 'default) + (fileloop-continue) +) + ;;;###autoload (defun um-file-at-point-advice (origfunc) "Like find-file-at-point, but checks all known project paths. @@ -122,9 +139,19 @@ TODO: Use a special directory name for potentials/ or the like, in case it's not in the root dir. " (or + ;; current project (funcall origfunc) + ;; TODO: Trying to recurse down into current project directories. + ;; project-find-file does it fine, just don't want interactive + ;; completing-read call. + + ;; none of these work: + ;; (find-file-in-project) + ;; (project-search-nointeractive) + ;; (project-find-file-future-enter) + ;; all other projects (let ((result)) (cl-loop for project-path in