0

After executing the command pwd, Emacs minibuffer successfully returns the file location, for instance: Directory /home/pedro/projects/.

I can see that information. But I would also like to copy it.

How can I copy this information (add it to the kill ring)?

2
  • 2
    C-u M-! "shell-command" RET inserts the output of the command in the current buffer. To copy it to the clipboard ring you'd have to write a custom function.
    – aadcg
    Apr 5, 2022 at 15:47
  • 1
    Additionally, the output of most (if not all) commands goes to the *Messages* buffer. If you happen to run a command and you want its output for whatever reason, you can just go to that buffer and copy it
    – Jesse
    Apr 5, 2022 at 17:52

1 Answer 1

0

Use C-h f to read the documentation:

Signature
(pwd &optional INSERT)

Documentation
Show the current default directory.

With prefix argument INSERT, insert the current default directory
at point instead.

The bit about the prefix argument means that if you run it with C-u it will insert the path into the current buffer instead.

1
  • 2
    And to get that copied to the kill-ring use...
    – Drew
    Apr 5, 2022 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.