From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Newsgroups: gmane.emacs.bugs Subject: bug#20451: 25.0.50; [PATCH] Add prefix argument to `pwd' Date: Tue, 28 Apr 2015 21:50:36 +0200 Message-ID: <1430250636.8717.0@smtp.gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=-SkPIuoFIubtzw3DAtZjo" X-Trace: ger.gmane.org 1430250683 17947 80.91.229.3 (28 Apr 2015 19:51:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Apr 2015 19:51:23 +0000 (UTC) To: 20451@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 28 21:51:13 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YnBXD-0000ct-VD for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Apr 2015 21:51:12 +0200 Original-Received: from localhost ([::1]:35653 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnBXD-0003uk-ET for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Apr 2015 15:51:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35775) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnBX9-0003uf-Ra for bug-gnu-emacs@gnu.org; Tue, 28 Apr 2015 15:51:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YnBX6-0002xx-Df for bug-gnu-emacs@gnu.org; Tue, 28 Apr 2015 15:51:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53239) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnBX6-0002xr-81 for bug-gnu-emacs@gnu.org; Tue, 28 Apr 2015 15:51:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YnBX5-0003DN-JL for bug-gnu-emacs@gnu.org; Tue, 28 Apr 2015 15:51:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Apr 2015 19:51:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20451 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.143025065612342 (code B ref -1); Tue, 28 Apr 2015 19:51:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Apr 2015 19:50:56 +0000 Original-Received: from localhost ([127.0.0.1]:43015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YnBWw-0003Cx-D1 for submit@debbugs.gnu.org; Tue, 28 Apr 2015 15:50:55 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50403) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YnBWt-0003Cl-Ur for submit@debbugs.gnu.org; Tue, 28 Apr 2015 15:50:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YnBWn-0002sv-MH for submit@debbugs.gnu.org; Tue, 28 Apr 2015 15:50:46 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:36645) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnBWn-0002sr-J2 for submit@debbugs.gnu.org; Tue, 28 Apr 2015 15:50:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnBWm-0003tK-2u for bug-gnu-emacs@gnu.org; Tue, 28 Apr 2015 15:50:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YnBWi-0002rH-T7 for bug-gnu-emacs@gnu.org; Tue, 28 Apr 2015 15:50:44 -0400 Original-Received: from mail-la0-x230.google.com ([2a00:1450:4010:c03::230]:36356) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnBWi-0002r3-Ca for bug-gnu-emacs@gnu.org; Tue, 28 Apr 2015 15:50:40 -0400 Original-Received: by lagv1 with SMTP id v1so4327848lag.3 for ; Tue, 28 Apr 2015 12:50:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:message-id:mime-version:content-type; bh=xT7yzugESOOPepfiVahTt2gd/fdQ9GPyQmBYw0XyI3k=; b=oCU4WvOEBc7PmF2TYABfWrF6SthYtB10FtukcDLfiZppH7yzw6HVIxDYuHerta7WGh azB0agYuc9A7BmO1vw05KI5kumGyr4b0afrkZ9JOMSDX8HyqVKl95+e0Ie8JBYEj2R/i NKqzgXDFv09AgHqCngxABKl+N1LzyzNTHY1jWbaWXUJqaOoJlqPgb3DmLOqP0VGEQK6q tYiXT3BG/8r81gahtJSMC7UWSlFz4qfMO3O9068dMAakXA6m/18yrXxEtK3nqJomsK/x aMcTeNBvPI3YlPIzIpL0NGQEauXVWWD+pjVMRZebXzoRXJO//c+rXz+N+MAjZZy6yqLP DH7g== X-Received: by 10.112.145.136 with SMTP id su8mr15924008lbb.61.1430250639081; Tue, 28 Apr 2015 12:50:39 -0700 (PDT) Original-Received: from [192.168.1.114] (cm-84.215.44.110.getinternet.no. [84.215.44.110]) by mx.google.com with ESMTPSA id oy3sm5810139lbb.1.2015.04.28.12.50.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2015 12:50:38 -0700 (PDT) X-Mailer: geary/0.8.3 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:102183 Archived-At: --=-SkPIuoFIubtzw3DAtZjo Content-Type: text/plain; charset=utf-8; format=flowed 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?= 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 --=-SkPIuoFIubtzw3DAtZjo Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
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.

<= div>
From 56c93aa20b19bebb5cb1afcf3894911355d23e30 Mon S= ep 17 00:00:00 2001
From: =3D?UTF-8?q?Simen=3D20Heggest=3DC3=3DB8= yl?=3D <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   &nbs= p;  |  3 +++
 lisp/files.el | 12 ++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 5046d30..74976= 52 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -8= 17,6 +817,9 @@ name.  The variable `system-name' is now obsolete.
 +++
 ** Function `write-region' no longer output= s "Wrote FILE" in batch mode.
 
+** If `pwd' is ca= lled with a prefix argument, insert the current default
+director= y at point.
+
 ---
 ** New utilitie= s in subr-x.el:
 *** New macros `if-let' and `when-let' allo= w defining bindings and to
diff --git a/lisp/files.el b/lisp/file= s.el
index 045eeaf..ef6ac7b 100644
--- a/lisp/files.el<= /div>
+++ b/lisp/files.el
@@ -654,10 +654,14 @@ the value of = `default-directory'."
   'file-directory-p))
 
 =0C
-(defun pwd ()
-  "Show the cur= rent default directory."
-  (interactive nil)
- &n= bsp;(message "Directory %s" default-directory))
+(defun pwd (&= ;optional insert)
+  "Show the current default directory.
+With prefix argument INSERT, insert the current default directory<= /div>
+at point instead."
+  (interactive "P")
+  (if insert
+      (insert default-directo= ry)
+    (message "Directory %s" default-directory)))
 
 (defvar cd-path nil
   = "Value of the CDPATH environment variable, as a list.
-- 
2.1.4
= --=-SkPIuoFIubtzw3DAtZjo--