From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bastien Newsgroups: gmane.emacs.devel Subject: Re: /srv/bzr/emacs/trunk r111746: * files.el (basic-save-buffer): Offer to create a non-existing directory. Date: Wed, 13 Feb 2013 12:05:31 +0100 Message-ID: <878v6swk1w.fsf@bzg.ath.cx> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1360753551 32296 80.91.229.3 (13 Feb 2013 11:05:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Feb 2013 11:05:51 +0000 (UTC) Cc: emacs-devel@gnu.org To: Glenn Morris Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 13 12:06:13 2013 Return-path: Envelope-to: ged-emacs-devel@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 1U5aAB-0005rW-DT for ged-emacs-devel@m.gmane.org; Wed, 13 Feb 2013 12:06:07 +0100 Original-Received: from localhost ([::1]:44370 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5a9r-0000Q6-RF for ged-emacs-devel@m.gmane.org; Wed, 13 Feb 2013 06:05:47 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47628) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5a9l-0000Et-Mg for emacs-devel@gnu.org; Wed, 13 Feb 2013 06:05:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U5a9g-0002sV-Ft for emacs-devel@gnu.org; Wed, 13 Feb 2013 06:05:41 -0500 Original-Received: from mail-wg0-f54.google.com ([74.125.82.54]:50448) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5a9g-0002sR-9L; Wed, 13 Feb 2013 06:05:36 -0500 Original-Received: by mail-wg0-f54.google.com with SMTP id fm10so838027wgb.33 for ; Wed, 13 Feb 2013 03:05:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type; bh=bXXA+w9eLiTj+XmIr1+0zKFSscNdS6wWtEjELPqXmys=; b=P15Df//pVOH7ofiRm6AP+jB69qal/9aBR1QvMEvdQgs6EiBHylhjiVni2UH6JPZd/f S57NJwKyXjp5BGvAVnm4x2HuSFQWRpTPpaebBL3WGeU2NvYG1jLtj0E8aKtnmONa3J4k fLlqu16ZjgPuf/PwPsHkYehuoVCnu5w12f7LAe1dwp/NWedxGuK4gFUGMdtGgmbhaEAz 1/y69TC68IJyK1GLVHh7qEc5QwHrLX/3MTuREIbFbCI1YIolQpn+F7db/Mib2Q6/uZq/ 7ie476sGFctMJR6AmKe4RHk8d9tF/TyWlseiSTZv9QM+KbU4S77XyDzbFq9WKQRpxLXn DFeg== X-Received: by 10.180.109.82 with SMTP id hq18mr9235930wib.0.1360753534972; Wed, 13 Feb 2013 03:05:34 -0800 (PST) Original-Received: from bzg.localdomain (mar75-2-81-56-68-112.fbx.proxad.net. [81.56.68.112]) by mx.google.com with ESMTPS id bj9sm13011440wib.4.2013.02.13.03.05.32 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Feb 2013 03:05:33 -0800 (PST) Original-Received: by bzg.localdomain (Postfix, from userid 1000) id 9B7DF1C20D18; Wed, 13 Feb 2013 12:05:31 +0100 (CET) In-Reply-To: (Glenn Morris's message of "Tue, 12 Feb 2013 00:36:09 -0800") User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 74.125.82.54 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:157002 Archived-At: --=-=-= Content-Type: text/plain Hi Glenn, Glenn Morris writes: > * files.el (basic-save-buffer): Offer to create a non-existing > directory. The attached patch implements the same change for `find-file'. Let me know if it's okay to apply this. Thanks! --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=files.el.patch === modified file 'lisp/files.el' --- lisp/files.el 2013-02-12 08:36:09 +0000 +++ lisp/files.el 2013-02-13 11:04:03 +0000 @@ -2077,6 +2077,7 @@ (if noninteractive nil (let* (not-serious + (dir (file-name-directory buffer-file-name)) (msg (cond ((not warn) nil) @@ -2105,11 +2106,14 @@ "Note: file is write protected") ((file-attributes (directory-file-name default-directory)) "File not found and directory write-protected") - ((file-exists-p (file-name-directory buffer-file-name)) + ((file-exists-p dir) (setq buffer-read-only nil)) (t (setq buffer-read-only nil) - "Use M-x make-directory RET RET to create the directory and its parents")))) + (if (not (y-or-n-p (format "Directory `%s' does not exist; create? " dir))) + "Use M-x make-directory RET RET to create the directory and its parents" + (make-directory dir t) + (format "Directory %s has been created" dir)))))) (when msg (message "%s" msg) (or not-serious (sit-for 1 t)))) --=-=-= Content-Type: text/plain -- Bastien --=-=-=--