From: "Simen Heggestøyl" <simenheg@gmail.com>
To: 20451@debbugs.gnu.org
Subject: bug#20451: 25.0.50; [PATCH] Add prefix argument to `pwd'
Date: Tue, 28 Apr 2015 21:50:36 +0200 [thread overview]
Message-ID: <1430250636.8717.0@smtp.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1846 bytes --]
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?= <simenheg@gmail.com>
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
[-- Attachment #2: Type: text/html, Size: 2708 bytes --]
next reply other threads:[~2015-04-28 19:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-28 19:50 Simen Heggestøyl [this message]
2015-04-30 22:37 ` bug#20451: 25.0.50; [PATCH] Add prefix argument to `pwd' Stefan Monnier
2015-05-01 21:28 ` Simen Heggestøyl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430250636.8717.0@smtp.gmail.com \
--to=simenheg@gmail.com \
--cc=20451@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).