branch: externals/package-x commit 00f5b5f5a08a3fb2797f614eb084cfa3de91fa8a Author: Philip Kaludercic <phil...@posteo.net> Commit: Philip Kaludercic <phil...@posteo.net>
* package-x.el (package-install-temporarily): New function --- package-x.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/package-x.el b/package-x.el index 63329851e5..a652a8e76e 100644 --- a/package-x.el +++ b/package-x.el @@ -318,6 +318,23 @@ This should be invoked from the gnus *Summary* buffer." (with-current-buffer gnus-article-buffer (package-upload-buffer))) +(defun package-install-temporarily (pkg) + "Install and enable a package PKG non-persistently. +The package will not be loaded in future sessions, but will appear to be +so for the remaining one." + (interactive + (list (intern (completing-read + "Install package: " + (progn + ;; Initialize the package system to get the list + ;; of package symbols for completion. + (package--archives-initialize) + package-archive-contents) + nil t)))) + (let ((package-user-dir (make-temp-file "elpa" t)) + (package-alist (copy-list package-alist))) + (package-install pkg t))) + (provide 'package-x) ;;; package-x.el ends here