Function: package-review
package-review is a byte-compiled function defined in package.el.gz.
Signature
(package-review PKG-DESC PKG-DIR OLD-DESC)
Documentation
Review the package specified PKG-DESC which is about to be installed.
PKG-DIR is the directory where the downloaded source of PKG-DESC have
been downloaded. OLD-DESC is either a package-desc object of the
previous installation or nil, if there was no prior installation. If the
review fails, the function throws a symbol review-failed with PKG-DESC
attached.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/package.el.gz
(defun package-review (pkg-desc pkg-dir old-desc)
"Review the package specified PKG-DESC which is about to be installed.
PKG-DIR is the directory where the downloaded source of PKG-DESC have
been downloaded. OLD-DESC is either a `package-desc' object of the
previous installation or nil, if there was no prior installation. If the
review fails, the function throws a symbol `review-failed' with PKG-DESC
attached."
(let ((news (package-find-news-file pkg-desc))
(enable-recursive-minibuffers t)
(diff-command (car package-review-diff-command))
(switches (cl-loop for switch in (cdr package-review-diff-command)
when (stringp switch) collect switch into result
when (and (symbolp switch) (boundp switch))
append (ensure-list (symbol-value switch)) into result
finally return (delq t result))))
(while (pcase-exhaustive
(car (read-multiple-choice
(format "Install \"%s\"?" (package-desc-name pkg-desc))
`((?y "yes" "Proceed with installation")
(?n "no" "Abort installation")
,@(and old-desc '((?d "diff" "Show the installation diff")
(?m "mail" "Send an email to the maintainers")))
,@(and news '((?c "changelog" "Show the changelog")))
(?b "browse" "Browse the source"))))
(?y nil)
(?n
(delete-directory pkg-dir t)
(throw 'review-failed pkg-desc))
(?d
(display-buffer
(diff-no-select
(package-desc-dir old-desc) pkg-dir switches t
(get-buffer-create (format "*Package Review Diff: %s*"
(package-desc-full-name pkg-desc)))))
t)
(?m
(with-temp-buffer
(diff-no-select
(package-desc-dir old-desc) pkg-dir
switches t (current-buffer))
;; delete sentinel message
(goto-char (point-max))
(forward-line -2)
(narrow-to-region (point-min) (point))
;; prepare mail buffer
(let ((tmp-buf (current-buffer)))
(compose-mail (with-demoted-errors "Failed to find maintainers: %S"
(package-maintainers pkg-desc))
(concat "Emacs Package Review: "
(package-desc-full-name pkg-desc)))
(pcase mail-user-agent
('sendmail-user-agent (mail-text))
(_ (message-goto-body)))
(let ((start (point)))
(save-excursion
(insert-buffer-substring tmp-buf)
(comment-region start (point))))))
t)
(?c (view-file news) t)
(?b (dired pkg-dir) t)))))