emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A patch for `pwd' - copying the current directory to the kill ring


From: Yuri Khan
Subject: Re: A patch for `pwd' - copying the current directory to the kill ring
Date: Thu, 25 Jan 2018 22:47:32 +0700

On Thu, Jan 25, 2018 at 8:13 PM, Marcin Borkowski <address@hidden> wrote:

> from time to time I have a need to insert the current directory name
> somewhere.  Some time ago, I submitted a bug report suggesting that C-u
> M-x pwd could insert the current dir at point.  Someone made that patch
> a few years ago, and that is great.  However, it is not enough:
> sometimes I want to be able to yank this dir to some other application
> (usually the terminal - I want to cd to that dir).  I made a simple
> patch that makes `pwd' copy the current dir to the kill ring (and - by
> default - to the system clipboard) if prefixed with C-u C-u.  I attach
> the patch.  WDYT?

Long ago, on a different OS, I used a file manager that had a
relatively easy key to copy the full path to the currently selected
file(s) to clipboard.

It was crazy efficient, to the point that I hated programs that used
the system-provided “select a directory” dialog box without letting me
paste a path in there.

In that file manager, if I were editing a file and needed its
containing directory’s path, I’d press Ctrl+F10 (to jump to its
directory in a file panel), then Backspace (go to parent directory),
then Alt+Shift+Ins (to copy the full path of the selected file, which
now happens to be the original file’s containing directory).

In Emacs, this translates to two ‘dired-jump’s (which I have bound to
M-S-up) followed by ‘dired-copy-filename-as-kill’ with a zero argument
(easily accessible with 0 w). Alternatively, dired-jump
beginning-of-buffer dired-copy-filename-as-kill (M-S-up M-< w) also
works.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]