[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20584: 25.0.50; [PATCH] (list-packages) do not fail, if no user conf

From: Artur Malabarba
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

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))
             (if buffer

reply via email to

[Prev in Thread] Current Thread [Next in Thread]