From 1972e49f924dc8706aef512a0d69fd7c29a4f1f6 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 20 May 2015 14:13:22 +0100 Subject: [PATCH] * lisp/emacs-lisp/package.el: "Delete" button in Help buffer (package-delete-button-action): New function. (describe-package-1): Add Delete button. --- lisp/emacs-lisp/package.el | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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)))) -- 2.39.2