aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Stallman2015-04-05 08:44:01 -0400
committerRichard Stallman2015-04-05 08:44:01 -0400
commit5842e489eef061766a747e26ca81e1ef6e2ece5a (patch)
treea6e85ecc7233dbc1aad578f5532e133447ee78d4
parent4e23cd0ccde4ad1e14fe2870ccf140487af649b2 (diff)
parentfdc521952e6d68fa603aac899fe4c08e0a2ed480 (diff)
downloademacs-5842e489eef061766a747e26ca81e1ef6e2ece5a.tar.gz
emacs-5842e489eef061766a747e26ca81e1ef6e2ece5a.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Conflicts: lisp/ChangeLog
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/emacs-lisp/package.el36
2 files changed, 43 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f6a79c7dea6..33e14568376 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -11,6 +11,11 @@
11 * net/browse-url.el (browse-url-firefox-program): Prefer IceCat, doc. 11 * net/browse-url.el (browse-url-firefox-program): Prefer IceCat, doc.
12 (browse-url-firefox-arguments) 12 (browse-url-firefox-arguments)
13 (browse-url-firefox-startup-arguments): Doc fix. 13 (browse-url-firefox-startup-arguments): Doc fix.
142015-04-05 Artur Malabarba <bruce.connor.am@gmail.com>
15
16 * emacs-lisp/package.el: Add package-initialize to user-init-file.
17 (package--ensure-init-file): New function.
18 (package-install, package-install-from-buffer): Use it.
14 19
152015-04-05 Pete Williamson <petewil@chromium.org> (tiny-change) 202015-04-05 Pete Williamson <petewil@chromium.org> (tiny-change)
16 21
@@ -28,6 +33,9 @@
28 `package-archives' to `package--downloads-in-progress' instead of 33 `package-archives' to `package--downloads-in-progress' instead of
29 overwriting it. 34 overwriting it.
30 (package--with-work-buffer-async): Protect macro arguments. 35 (package--with-work-buffer-async): Protect macro arguments.
36 (package--download-one-archive)
37 (package--download-and-read-archives): Prevent
38 downloads-in-progress list from becoming outdated.
31 39
322015-04-04 Michael Albinus <michael.albinus@gmx.de> 402015-04-04 Michael Albinus <michael.albinus@gmx.de>
33 41
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 32a3e015f0b..18802701a0a 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1397,8 +1397,12 @@ similar to an entry in `package-alist'. Save the cached copy to
1397 ;; If we care, check it (perhaps async) and *then* write the file. 1397 ;; If we care, check it (perhaps async) and *then* write the file.
1398 (package--check-signature 1398 (package--check-signature
1399 location file content async 1399 location file content async
1400 ;; This function will be called after signature checking.
1400 (lambda (&optional good-sigs) 1401 (lambda (&optional good-sigs)
1401 (unless (or good-sigs (eq package-check-signature 'allow-unsigned)) 1402 (unless (or good-sigs (eq package-check-signature 'allow-unsigned))
1403 ;; Even if the sig fails, this download is done, so
1404 ;; remove it from the in-progress list.
1405 (package--update-downloads-in-progress archive)
1402 (error "Unsigned archive `%s'" name)) 1406 (error "Unsigned archive `%s'" name))
1403 ;; Write out the archives file. 1407 ;; Write out the archives file.
1404 (write-region content nil local-file nil 'silent) 1408 (write-region content nil local-file nil 'silent)
@@ -1419,7 +1423,11 @@ perform the downloads asynchronously."
1419 package--downloads-in-progress)) 1423 package--downloads-in-progress))
1420 (dolist (archive package-archives) 1424 (dolist (archive package-archives)
1421 (condition-case-unless-debug nil 1425 (condition-case-unless-debug nil
1422 (package--download-one-archive archive "archive-contents" async) 1426 (package--download-one-archive
1427 archive "archive-contents"
1428 ;; Called if the async download fails
1429 (when async
1430 (lambda () (package--update-downloads-in-progress archive))))
1423 (error (message "Failed to download `%s' archive." 1431 (error (message "Failed to download `%s' archive."
1424 (car archive)))))) 1432 (car archive))))))
1425 1433
@@ -1715,6 +1723,30 @@ PACKAGES are satisfied, i.e. that PACKAGES is computed
1715using `package-compute-transaction'." 1723using `package-compute-transaction'."
1716 (mapc #'package-install-from-archive packages)) 1724 (mapc #'package-install-from-archive packages))
1717 1725
1726(defun package--ensure-init-file ()
1727 "Ensure that the user's init file calls `package-initialize'."
1728 ;; Don't mess with the init-file from "emacs -Q".
1729 (when user-init-file
1730 (let ((buffer (find-buffer-visiting user-init-file)))
1731 (with-current-buffer (or buffer (find-file-noselect user-init-file))
1732 (save-excursion
1733 (save-restriction
1734 (widen)
1735 (goto-char (point-min))
1736 (unless (search-forward "(package-initialize)" nil 'noerror)
1737 (goto-char (point-min))
1738 (insert
1739 ";; Added by Package.el. This must come before configurations of\n"
1740 ";; installed packages. Don't delete this line. If you don't want it,\n"
1741 ";; just comment it out by adding a semicolon to the start of the line.\n"
1742 "(package-initialize)\n")
1743 (unless (looking-at-p "$")
1744 (insert "\n"))
1745 (let ((file-precious-flag t))
1746 (save-buffer)))
1747 (unless buffer
1748 (kill-buffer (current-buffer)))))))))
1749
1718;;;###autoload 1750;;;###autoload
1719(defun package-install (pkg &optional dont-select) 1751(defun package-install (pkg &optional dont-select)
1720 "Install the package PKG. 1752 "Install the package PKG.
@@ -1743,6 +1775,7 @@ to install it but still mark it as selected."
1743 package-archive-contents)) 1775 package-archive-contents))
1744 nil t)) 1776 nil t))
1745 nil))) 1777 nil)))
1778 (package--ensure-init-file)
1746 (let ((name (if (package-desc-p pkg) 1779 (let ((name (if (package-desc-p pkg)
1747 (package-desc-name pkg) 1780 (package-desc-name pkg)
1748 pkg))) 1781 pkg)))
@@ -1786,6 +1819,7 @@ is derived from the main .el file in the directory.
1786 1819
1787Downloads and installs required packages as needed." 1820Downloads and installs required packages as needed."
1788 (interactive) 1821 (interactive)
1822 (package--ensure-init-file)
1789 (let* ((pkg-desc 1823 (let* ((pkg-desc
1790 (cond 1824 (cond
1791 ((derived-mode-p 'dired-mode) 1825 ((derived-mode-p 'dired-mode)