On Thu, Jan 25, 2018 at 8:13 AM Marcin Borkowski wrote: > Hi all, > > 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? > I wouldn't even mind copying the default-directory to kill ring by default. Then you don't need C-u C-u. - M-x pwd would show the pwd and *also copy it to kill-ring*. - C-u M-x pwd will only insert the pwd at point (as before). If someone did M-x pwd to know the current directory, most likely they would consider it harmless to save that kill-ring too. And if they didn't intend to do that, it doesn't hurt.. you always have M-y by your side :) What do you and others think of this? As a side, in your patch: > + "Show the current default directory. With \\[universal-argument], insert > +the current default directory at point instead. With \\[universal-argument] \\[universal-argument], M-x checkdoc would fail there.. the first visual line in a doc-string must be a complete sentence and end in a full-stop. In your patch, the first visual line is incomplete (ends in ", insert"). The older version, the one your patch is based on, did it correctly: > - "Show the current default directory. > -With prefix argument INSERT, insert the current default directory -- Kaushal Modi