Send the results back to Emacs in a dired/grep buffer #21
Replies: 3 comments 1 reply
-
Hello, @maxecharel Starting eee.el in Emacs, which in turn launches a third-party terminal emulator. Inside the terminal emulator, it runs a command similar to ripgrep or find, then sends the command output back to Emacs, displaying the results in a buffer. I think this is achievable. It would likely require defining a custom callback function. In the callback, Emacs could create a buffer and insert the command output from eee.el into that buffer: Lines 194 to 206 in dce7135 |
Beta Was this translation helpful? Give feedback.
-
Yes, for example: ;; write a custom callback function to create a buffer in Emacs, and write something into the buffer:
(defun ee-export-to-buffer (destination-file)
"Export the contents of DESTINATION-FILE to a new buffer."
(let* ((destination (shell-command-to-string
(format "cat %s" destination-file)))
(destination (string-trim destination)))
;; Create a new buffer and insert the content
(with-current-buffer (get-buffer-create "*Export Output*")
(erase-buffer)
(insert destination)
(goto-char (point-min))
(display-buffer (current-buffer)))))
;; then use ee-define to create a new "ee" command:
(ee-define "ee-rg-and-export-to-buffer" default-directory (ee-script-path "eee-rg.sh") nil ee-export-to-buffer) Note: I weite above code by hand, not tested it. you may need to test it. Thank you. |
Beta Was this translation helpful? Give feedback.
-
Waouw, thanks for the reactivity! I tested the code (just added a call to |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi @eval-exec! Thanks a lot (again) for this package; as previously mentioned on Reddit and in a previous issue, it is super useful for externalizing some demanding find/grep tasks that would possibly put too much burden on Emacs thread (hello ripgrep-all).
If I may, I would like to kindly ask for an additional functionality: being able to send back to Emacs the results of a search, as a dired/grep buffer. Do you think that something you could (and want to) implement?
Beta Was this translation helpful? Give feedback.
All reactions