Commit 0326960d authored by Artur Malabarba's avatar Artur Malabarba

emacs-lisp/package.el: Many style changes

parent 8334021e
......@@ -3,6 +3,12 @@
* emacs-lisp/package.el (package-selected-packages): Fix :type
(package-install): Rename ARG to MARK-SELECTED.
(package--get-deps): Fix for indirect dependencies.
(package-used-elsewhere-p): Rename to
(package--used-elsewhere-p): New function.
(package-reinstall, package-user-selected-packages-install)
(package-autoremove): Use sharp-quote.
(package-user-selected-packages-install): Reindent and rename to
(package-install-user-selected-packages): New function.
2015-02-01 Thierry Volpiatto <thierry.volpiatto@gmail.com>
......
......@@ -1237,8 +1237,8 @@ to `package-selected-packages'."
"Reinstall package PKG."
(interactive (list (intern (completing-read
"Reinstall package: "
(mapcar 'symbol-name
(mapcar 'car package-alist))))))
(mapcar #'symbol-name
(mapcar #'car package-alist))))))
(package-delete (cadr (assq pkg package-alist)) t)
(package-install pkg))
......@@ -1438,7 +1438,7 @@ The file can either be a tar file or an Emacs Lisp file."
(t (append direct-deps indirect-deps)))))
;;;###autoload
(defun package-user-selected-packages-install ()
(defun package-install-user-selected-packages ()
"Ensure packages in `package-selected-packages' are installed.
If some packages are not installed propose to install them."
(interactive)
......@@ -1450,23 +1450,24 @@ If some packages are not installed propose to install them."
(when (y-or-n-p
(format "%s packages will be installed:\n%s, proceed?"
(length lst)
(mapconcat 'symbol-name lst ", ")))
(mapc 'package-install lst))
(message "All your packages are already installed"))))
(mapconcat #'symbol-name lst ", ")))
(mapc #'package-install lst))
(message "All your packages are already installed"))))
(defun package-used-elsewhere-p (pkg-desc &optional pkg-list)
"Check in PKG-LIST if PKG-DESC is used elsewhere as dependency.
(defun package--used-elsewhere-p (pkg-desc &optional pkg-list)
"Non-nil if PKG-DESC is a dependency of a package in PKG-LIST.
Return the first package found in PKG-LIST of which PKG is a
dependency.
When not specified, PKG-LIST default to `package-alist'
with PKG-DESC entry removed.
Returns the first package found in PKG-LIST where PKG is used as dependency."
When not specified, PKG-LIST defaults to `package-alist'
with PKG-DESC entry removed."
(unless (string= (package-desc-status pkg-desc) "obsolete")
(let ((pkg (package-desc-name pkg-desc)))
(cl-loop with alist = (or pkg-list
(remove (assq pkg package-alist)
package-alist))
for p in alist thereis
(and (memq pkg (mapcar 'car (package-desc-reqs (cadr p))))
(and (memq pkg (mapcar #'car (package-desc-reqs (cadr p))))
(car p))))))
(defun package-delete (pkg-desc &optional force)
......@@ -1488,7 +1489,7 @@ elsewhere."
(package-desc-full-name pkg-desc)))
((and (null force)
(setq pkg-used-elsewhere-by
(package-used-elsewhere-p pkg-desc)))
(package--used-elsewhere-p pkg-desc)))
;; Don't delete packages used as dependency elsewhere.
(error "Package `%s' is used by `%s' as dependency, not deleting"
(package-desc-full-name pkg-desc)
......@@ -1520,14 +1521,14 @@ will be deleted."
append (package--get-deps p) into lst
else do (push p old-direct)
finally return lst)))
(cl-loop for p in (mapcar 'car package-alist)
(cl-loop for p in (mapcar #'car package-alist)
unless (or (memq p needed)
(memq p package-selected-packages))
collect p into lst
finally (if lst
(when (y-or-n-p (format "%s packages will be deleted:\n%s, proceed? "
(length lst)
(mapconcat 'symbol-name lst ", ")))
(mapconcat #'symbol-name lst ", ")))
(mapc (lambda (p)
(package-delete (cadr (assq p package-alist)) t))
lst))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment