]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/package.el: "Delete" button in Help buffer
authorArtur Malabarba <bruce.connor.am@gmail.com>
Wed, 20 May 2015 13:13:22 +0000 (14:13 +0100)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Wed, 20 May 2015 13:14:52 +0000 (14:14 +0100)
(package-delete-button-action): New function.
(describe-package-1): Add Delete button.

lisp/emacs-lisp/package.el

index 9e849d5e2ff0c1a849627f093eabda91b7ff7d68..1ab1b4bb12794975d192666c7b82a5a3848f7e0d 100644 (file)
@@ -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))))