0

I have this function

(defun my/dired-copy-dirname-as-kill ()
  "Copy the current directory into the kill ring."
  (interactive)
  (kill-new default-directory))

, but this only copies the linked path, not the physical path.

If I use that function I get ~/, instead of /home/quux/

I only want to copy the directory part of the whole path to the filename.

1
  • 2
    This question (or at least your function, save for its name) has nothing to do with dired.
    – phils
    Jul 23, 2023 at 15:15

1 Answer 1

0

See:

  • C-hf expand-file-name
  • C-hf file-truename (if you also want to chase symlinks)

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.