unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Artur Malabarba <bruce.connor.am@gmail.com>
To: 20584-done@debbugs.gnu.org
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	[thread overview]
Message-ID: <CAAdUY-+31CC3fs2k_bqaCpkEvwDD1d99RWC7uKVA5VyXqShAHQ@mail.gmail.com> (raw)
In-Reply-To: <87h9re2rus.fsf@pusto.de>

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





      reply	other threads:[~2015-05-15  9:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15  7:59 bug#20584: 25.0.50; [PATCH] (list-packages) do not fail, if no user config file present Eduard Wiebe
2015-05-15  9:21 ` Artur Malabarba [this message]

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=CAAdUY-+31CC3fs2k_bqaCpkEvwDD1d99RWC7uKVA5VyXqShAHQ@mail.gmail.com \
    --to=bruce.connor.am@gmail.com \
    --cc=20584-done@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).