From: Artur Malabarba Date: Wed, 20 May 2015 13:13:22 +0000 (+0100) Subject: * lisp/emacs-lisp/package.el: "Delete" button in Help buffer X-Git-Tag: emacs-25.0.90~2040 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1972e49f924dc8706aef512a0d69fd7c29a4f1f6;p=emacs.git * lisp/emacs-lisp/package.el: "Delete" button in Help buffer (package-delete-button-action): New function. (describe-package-1): Add Delete button. --- diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 9e849d5e2ff..1ab1b4bb127 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2173,7 +2173,14 @@ will be deleted." (insert "'")) (if signed (insert ".") - (insert " (unsigned)."))) + (insert " (unsigned).")) + (when (and (package-desc-p desc) + (not required-by) + (package-installed-p desc)) + (insert " ") + (package-make-button "Delete" + 'action #'package-delete-button-action + 'package-desc desc))) (incompatible-reason (insert (propertize "Incompatible" 'face font-lock-warning-face) " because it depends on ") @@ -2317,6 +2324,14 @@ will be deleted." (revert-buffer nil t) (goto-char (point-min))))) +(defun package-delete-button-action (button) + (let ((pkg-desc (button-get button 'package-desc))) + (when (y-or-n-p (format "Delete package `%s'? " + (package-desc-full-name pkg-desc))) + (package-delete pkg-desc) + (revert-buffer nil t) + (goto-char (point-min))))) + (defun package-keyword-button-action (button) (let ((pkg-keyword (button-get button 'package-keyword))) (package-show-package-list t (list pkg-keyword))))