From 0326960d3d8b49fd31c3f4e16418bf13c86efa02 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sun, 1 Feb 2015 21:01:37 -0200 Subject: [PATCH] emacs-lisp/package.el: Many style changes --- lisp/ChangeLog | 6 ++++++ lisp/emacs-lisp/package.el | 31 ++++++++++++++++--------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5498967dba4..cba38ffb393 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -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 diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index eae75621f4c..3b22962bb29 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -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)) -- 2.39.2