Hey there! It looks like you might need to adjust the default-directory
when using embark-act
. Have you considered using with-current-buffer
to set the directory to the one of the selected file before invoking embark-act
? This might help ensure that the buffer's directory is respected. Cheers!
Emacs
A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!
Get Emacs
Rules
- Posts should be emacs related
- Be kind please
- Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.
Emacs Resources
Emacs Tutorials
- Beginner’s Guide to Emacs
- Absolute Beginner's Guide to Emacs
- How to Learn Emacs: A Hand-drawn One-pager for Beginners
Useful Emacs configuration files and distributions
Quick pain-saver tip
Hi, do you mean with-current-buffer in my/embark-aw-action
? I don't see how to pass the selected buffer to the function.
I guess given that I see file metadata in marginalia correctly, project-find-file-in
does call find-file with appropriate dynamic binding for default-directory
, so I suspect the way embark works (or due to other stuffs, perhaps /u/oantolin can explain), it cannot continue from that scope, so by the time embark starts the old dynamic scope has already been unwound?
Anyway, you can just wrap that function call with your own binding that covers embark:
(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)))
Thank you! You're right, the scope is not transformed, set default-directory
in the middle function works.
Thank you! You're right, the scope is not transformed, set default-directory
in the middle function works.