Subject: bug#20451: closed (Re: bug#20451: 25.0.50; [PATCH] Add prefix argument to `pwd')

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 01 May 2015 21:29:02 +0000

Your bug report

#20451: 25.0.50; [PATCH] Add prefix argument to `pwd'

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
20451: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20451
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#20451: 25.0.50; [PATCH] Add prefix argument to `pwd'
From: Simen Heggestøyl <[email-masked]>
To: Stefan Monnier <[email-masked]>
Cc: [email-masked]
Date: Fri, 01 May 2015 23:28:05 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

On Fri, May 1, 2015 at 12:37 AM, Stefan Monnier 
<[email-masked]> wrote:
> Looks OK, thank you,

Thanks, landed.

-- Simen

Subject: 25.0.50; [PATCH] Add prefix argument to `pwd'
From: Simen Heggestøyl <[email-masked]>
To: [email-masked]
Date: Tue, 28 Apr 2015 21:50:36 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

I often find myself doing `C-u M-x pwd RET', hoping that the current
default directory will be inserted at point, but it doesn't. `pwd'
doesn't currently act on a prefix argument, so why not let it do this?

This matches how `shell-command', and newly also `quick-calc', treat
prefix arguments.

 From 56c93aa20b19bebb5cb1afcf3894911355d23e30 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= <[email-masked]>
Date: Tue, 28 Apr 2015 21:25:20 +0200
Subject: [PATCH] * lisp/files.el (pwd):

When called with a prefix argument, insert the current default
directory at point.
---
 etc/NEWS      |  3 +++
 lisp/files.el | 12 ++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 5046d30..7497652 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -817,6 +817,9 @@ name.  The variable `system-name' is now obsolete.
 +++
 ** Function `write-region' no longer outputs "Wrote FILE" in batch 
mode.

+** If `pwd' is called with a prefix argument, insert the current 
default
+directory at point.
+
 ---
 ** New utilities in subr-x.el:
 *** New macros `if-let' and `when-let' allow defining bindings and to
diff --git a/lisp/files.el b/lisp/files.el
index 045eeaf..ef6ac7b 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -654,10 +654,14 @@ the value of `default-directory'."
 		  'file-directory-p))

-(defun pwd ()
-  "Show the current default directory."
-  (interactive nil)
-  (message "Directory %s" default-directory))
+(defun pwd (&optional insert)
+  "Show the current default directory.
+With prefix argument INSERT, insert the current default directory
+at point instead."
+  (interactive "P")
+  (if insert
+      (insert default-directory)
+    (message "Directory %s" default-directory)))

 (defvar cd-path nil
   "Value of the CDPATH environment variable, as a list.
-- 
2.1.4