1

Windows 10, Emacs 25.1, Dired

If I want to copy to parent's directory name to kill-ring I go to folder name and press w

Here result:

Success copy

OK. It's work.

But I wan't to move cursor and get parent's directory name. I try by command digit-argument w but I get the next result:

Not get name

As you can see Emacs copy to kill-ring files name and dirs names. But it not copy the parent's directory name.

2
  • I don't quite understand the question. Are you asking for a command that moves the cursor temporarily to the top line (where the current directory name is) and then does what w does? Can you get what you want by defining and using a keyboard macro? If so, then a recipe that details defining the macro you use would make clear just what action you want to perform. To me it's not clear yet.
    – Drew
    Commented Oct 14, 2017 at 16:11
  • I want the next: it does not matter where is cursor is position on the Dired buffer, I want to get parent name by one command. Is it possible?
    – Alex
    Commented Oct 15, 2017 at 7:14

1 Answer 1

2

It's still not very clear what you're asking, but I'm guessing this is it:

(defun copy-parent-dir-as-kill ()
  "..."
  (interactive)
  (kill-new (expand-file-name default-directory)))

If you don't want to convert ~/ to its expansion, remove the expand-file-name.

(This is unrelated to Dired+ or even to Dired in general, BTW. You can use the same command in any buffer, to copy the current directory to the kill-ring.)

0

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.