Commit 1972e49f authored by Artur Malabarba's avatar Artur Malabarba

* lisp/emacs-lisp/package.el: "Delete" button in Help buffer

(package-delete-button-action): New function.
(describe-package-1): Add Delete button.
parent 578f0067
...@@ -2173,7 +2173,14 @@ will be deleted." ...@@ -2173,7 +2173,14 @@ will be deleted."
(insert "'")) (insert "'"))
(if signed (if signed
(insert ".") (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 (incompatible-reason
(insert (propertize "Incompatible" 'face font-lock-warning-face) (insert (propertize "Incompatible" 'face font-lock-warning-face)
" because it depends on ") " because it depends on ")
...@@ -2317,6 +2324,14 @@ will be deleted." ...@@ -2317,6 +2324,14 @@ will be deleted."
(revert-buffer nil t) (revert-buffer nil t)
(goto-char (point-min))))) (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) (defun package-keyword-button-action (button)
(let ((pkg-keyword (button-get button 'package-keyword))) (let ((pkg-keyword (button-get button 'package-keyword)))
(package-show-package-list t (list pkg-keyword)))) (package-show-package-list t (list pkg-keyword))))
......
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