From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eduard Wiebe Newsgroups: gmane.emacs.bugs Subject: bug#20584: 25.0.50; [PATCH] (list-packages) do not fail, if no user config file present Date: Fri, 15 May 2015 09:59:55 +0200 Message-ID: <87h9re2rus.fsf@pusto.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1431676887 7276 80.91.229.3 (15 May 2015 08:01:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 May 2015 08:01:27 +0000 (UTC) To: 20584@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 15 10:01:17 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 1YtAYV-0003lB-16 for geb-bug-gnu-emacs@m.gmane.org; Fri, 15 May 2015 10:01:15 +0200 Original-Received: from localhost ([::1]:58309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtAYU-0004VI-C3 for geb-bug-gnu-emacs@m.gmane.org; Fri, 15 May 2015 04:01:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtAYM-0004Lt-JT for bug-gnu-emacs@gnu.org; Fri, 15 May 2015 04:01:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YtAYJ-0003ai-72 for bug-gnu-emacs@gnu.org; Fri, 15 May 2015 04:01:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35754) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtAYJ-0003ae-4q for bug-gnu-emacs@gnu.org; Fri, 15 May 2015 04:01:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YtAYI-0004Dm-RG for bug-gnu-emacs@gnu.org; Fri, 15 May 2015 04:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eduard Wiebe Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 May 2015 08:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20584 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.143167682816171 (code B ref -1); Fri, 15 May 2015 08:01:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 May 2015 08:00:28 +0000 Original-Received: from localhost ([127.0.0.1]:45729 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YtAXj-0004Ck-Ja for submit@debbugs.gnu.org; Fri, 15 May 2015 04:00:28 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47900) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YtAXg-0004C4-Tp for submit@debbugs.gnu.org; Fri, 15 May 2015 04:00:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YtAXY-0003GA-51 for submit@debbugs.gnu.org; Fri, 15 May 2015 04:00:19 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:47624) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtAXY-0003G6-2u for submit@debbugs.gnu.org; Fri, 15 May 2015 04:00:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtAXS-0003zB-2s for bug-gnu-emacs@gnu.org; Fri, 15 May 2015 04:00:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YtAXO-00039W-Jx for bug-gnu-emacs@gnu.org; Fri, 15 May 2015 04:00:10 -0400 Original-Received: from hadar.uberspace.de ([185.26.156.13]:45196) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtAXO-00032Y-BI for bug-gnu-emacs@gnu.org; Fri, 15 May 2015 04:00:06 -0400 Original-Received: (qmail 25999 invoked from network); 15 May 2015 08:00:03 -0000 Original-Received: from localhost (HELO nirvana) (127.0.0.1) by hadar.uberspace.de with SMTP; 15 May 2015 08:00:03 -0000 Original-Received: from ew by nirvana with local (Exim 4.84) (envelope-from ) id 1YtAXD-0000o8-Fj for bug-gnu-emacs@gnu.org; Fri, 15 May 2015 09:59:55 +0200 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:102825 Archived-At: * lisp/emacs-lisp/package.el (package--ensure-init-file) Ensure user-init-file exists. --- lisp/emacs-lisp/package.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 6156313..55901f5 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1810,9 +1810,10 @@ using `package-compute-transaction'." (search-forward "(package-initialize)" nil 'noerror)))) ;; Don't visit the file if we don't have to. (with-temp-buffer - (insert-file-contents user-init-file) - (goto-char (point-min)) - (search-forward "(package-initialize)" nil 'noerror))))) + (when (file-exists-p user-init-file) + (insert-file-contents user-init-file) + (goto-char (point-min)) + (search-forward "(package-initialize)" nil 'noerror)))))) (unless contains-init (with-current-buffer (or buffer (let ((delay-mode-hooks t)) -- Eduard Wiebe