From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba 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 10:21:39 +0100 Message-ID: References: <87h9re2rus.fsf@pusto.de> Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1431681746 31407 80.91.229.3 (15 May 2015 09:22:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 May 2015 09:22:26 +0000 (UTC) To: 20584-done@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 15 11:22:11 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 1YtBoo-00016Y-LR for geb-bug-gnu-emacs@m.gmane.org; Fri, 15 May 2015 11:22:10 +0200 Original-Received: from localhost ([::1]:58704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtBon-0003hz-VY for geb-bug-gnu-emacs@m.gmane.org; Fri, 15 May 2015 05:22:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtBok-0003gV-56 for bug-gnu-emacs@gnu.org; Fri, 15 May 2015 05:22:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YtBog-00029U-U5 for bug-gnu-emacs@gnu.org; Fri, 15 May 2015 05:22:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtBog-00029K-RB for bug-gnu-emacs@gnu.org; Fri, 15 May 2015 05:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YtBog-0006BH-G3 for bug-gnu-emacs@gnu.org; Fri, 15 May 2015 05:22:02 -0400 Resent-From: Artur Malabarba Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 May 2015 09:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 20584 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Mail-Followup-To: 20584@debbugs.gnu.org, bruce.connor.am@gmail.com, usenet@pusto.de Original-Received: via spool by 20584-done@debbugs.gnu.org id=D20584.143168170823731 (code D ref 20584); Fri, 15 May 2015 09:22:01 +0000 Original-Received: (at 20584-done) by debbugs.gnu.org; 15 May 2015 09:21:48 +0000 Original-Received: from localhost ([127.0.0.1]:45769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YtBoR-0006Ah-C9 for submit@debbugs.gnu.org; Fri, 15 May 2015 05:21:47 -0400 Original-Received: from mail-la0-f41.google.com ([209.85.215.41]:33278) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YtBoP-0006AQ-3m for 20584-done@debbugs.gnu.org; Fri, 15 May 2015 05:21:45 -0400 Original-Received: by lagr1 with SMTP id r1so28683549lag.0 for <20584-done@debbugs.gnu.org>; Fri, 15 May 2015 02:21:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=NU/7kZ7SuqSBLeM3djTLg6pM66nmgU5NtdqdR5EpqZI=; b=tSxENBN76ep34qHlS/ZWVV6e8MB7ewrnVDpIb24zrq2Ak6NVj0+soleeFQPn/DGNc/ wKgnbqGpZIPvydTNWqpH5SmLQ7R9Ok2JpwG2wDPcqQY+KM+GtVRXJSyT3P5qRCIrmP8E GuXMOST9FfFpf8FD6V8nH8Gwl3fktbFyui9m/0dTNCT6mZbzQsvOJMOOB0BbMwadw4Vd uax15m/LXPhGgIpQJHjpAXIboU/UY9Z8v9OIhwdItZ/6GXi/oA+YrrRsjAmVrTr773GP UOv+QrfvH89H7Wodtby6ca24pCkwHZM9TOy3wdmjhKJcuBy5Cj+8YYvm28BNWrYoyHbf Ti5g== X-Received: by 10.152.87.204 with SMTP id ba12mr6595572lab.35.1431681699232; Fri, 15 May 2015 02:21:39 -0700 (PDT) Original-Received: by 10.25.150.1 with HTTP; Fri, 15 May 2015 02:21:39 -0700 (PDT) In-Reply-To: <87h9re2rus.fsf@pusto.de> X-Google-Sender-Auth: bZymDXAFuQDgecvQL94WDrTnW6Q 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:102827 Archived-At: Thanks for catching this, Eduard. I think I'd rather not create a possibly-unwanted init file, so I've applied the following patch instead. 1 file changed, 7 insertions(+), 2 deletions(-) lisp/emacs-lisp/package.el | 9 +++++++-- modified lisp/emacs-lisp/package.el @@ -1796,9 +1796,14 @@ using `package-compute-transaction'." (callback (funcall callback)))) (defun package--ensure-init-file () - "Ensure that the user's init file calls `package-initialize'." + "Ensure that the user's init file has `package-initialize'. +`package-initialize' doesn't have to be called, as long as it is +present somewhere in the file, even as a comment. If it is not, +add a call to it along with some explanatory comments." ;; Don't mess with the init-file from "emacs -Q". - (when user-init-file + (when (and (stringp user-init-file) + (file-readable-p user-init-file) + (file-writable-p user-init-file)) (let* ((buffer (find-buffer-visiting user-init-file)) (contains-init (if buffer