* bug#43983: [PATCH] Improve package install/delete button action
@ 2020-10-13 19:46 tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-10-14 4:14 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-10-13 19:46 UTC (permalink / raw)
To: 43983
[-- Attachment #1: Type: text/plain, Size: 3323 bytes --]
Hi, current package-install-button-action and package-delete-button-action have
some problems so I made a patch.
If user clicks [Install] button, the *Help* buffer is reverted and shows the package is
"available obsolete" in first line.
(steps)
1. emacs -Q
2. M-x list-packages
3. M-x package-refresh-contents
3. Click “ztree” package
4. Click [Install]
(steps end)
I think this is not good for user experience. The buffer shoud shows the package is
“installed” in first line.
And then if user clicks [Delete] button an error happens.
(steps)
1. (Install ztree like above)
2. Type q
3. Click “ztree” package which is marked as installed
4. Click [Delete]
(steps end)
(backstace)
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
string-match("\\`https?:" nil nil)
package--with-response-buffer-1(nil #f(compiled-function () #<bytecode 0x1fe0b74a2895>) :file "ztree-readme.txt" :async nil :error-function #f(compiled-function () #<bytecode 0x1fe0b589df81>) :noerror t)
describe-package-1(#s(package-desc :name ztree :version (20191108 2234) :summary "Text mode directory tree" :reqs ((cl-lib (0))) :kind nil :archive nil :dir "/(path/to)/test-home/.emacs...." :extras ((:url . "https://github.com/fourier/ztree") (:maintainer "Alexey Veretennikov" . "alexey.veretennikov@gmail.com") (:authors ("Alexey Veretennikov" . "alexey.veretennikov@gmail.com")) (:keywords "files" "tools") (:commit . "0a5b25f364490a58ef7371534a39c75d11f54132")) :signed nil))
describe-package(#s(package-desc :name ztree :version (20191108 2234) :summary "Text mode directory tree" :reqs ((cl-lib (0))) :kind nil :archive nil :dir "/(path/to)/test-home/.emacs...." :extras ((:url . "https://github.com/fourier/ztree") (:maintainer "Alexey Veretennikov" . "alexey.veretennikov@gmail.com") (:authors ("Alexey Veretennikov" . "alexey.veretennikov@gmail.com")) (:keywords "files" "tools") (:commit . "0a5b25f364490a58ef7371534a39c75d11f54132")) :signed nil))
apply(describe-package #s(package-desc :name ztree :version (20191108 2234) :summary "Text mode directory tree" :reqs ((cl-lib (0))) :kind nil :archive nil :dir "/(path/to)/test-home/.emacs...." :extras ((:url . "https://github.com/fourier/ztree") (:maintainer "Alexey Veretennikov" . "alexey.veretennikov@gmail.com") (:authors ("Alexey Veretennikov" . "alexey.veretennikov@gmail.com")) (:keywords "files" "tools") (:commit . "0a5b25f364490a58ef7371534a39c75d11f54132")) :signed nil))
help-mode-revert-buffer(nil t)
revert-buffer(nil t)
package-delete-button-action(#<marker (moves after insertion) at 483 in *Help*>)
button-activate(#<marker (moves after insertion) at 483 in *Help*> t)
push-button(94 t)
push-button((mouse-2 (#<window 99 on *Help*> 94 (452 . 42) 1086759856 nil 94 (64 . 2) nil (2 . 10) (7 . 20))))
a funcall-interactively(push-button (mouse-2 (#<window 99 on *Help*> 94 (452 . 42) 1086759856 nil 94 (64 . 2) nil (2 . 10) (7 . 20)))) call-interactively(push-button nil nil)
command-execute(push-button)
(backstace end)
This is because package-delete-button-action’s revert-buffer runs describe-package
with old package-desc which archive field is nil.
Running describe-package with just package name instead of revert-buffer fixes
these problems.
Thanks.
--
tsuucat
[-- Attachment #2: 0001-Improve-package-install-delete-button-action.patch --]
[-- Type: application/octet-stream, Size: 1599 bytes --]
From 7a663e66d4b851c28043bd79f816c735b1a9a8b4 Mon Sep 17 00:00:00 2001
From: Masahiro Nakamura <tsuucat@icloud.com>
Date: Wed, 14 Oct 2020 04:13:15 +0900
Subject: [PATCH] Improve package install/delete button action
* lisp/emacs-lisp/package.el (package-install-button-action)
(package-delete-button-action): Run describe-package instead of
revert-buffer in order to use newer package-desc.
---
lisp/emacs-lisp/package.el | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 1f81e07754..5b7735125f 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2630,8 +2630,7 @@ package-install-button-action
(when (y-or-n-p (format-message "Install package `%s'? "
(package-desc-full-name pkg-desc)))
(package-install pkg-desc nil)
- (revert-buffer nil t)
- (goto-char (point-min)))))
+ (describe-package (package-desc-name pkg-desc)))))
(defun package-delete-button-action (button)
"Run `package-delete' on the package BUTTON points to.
@@ -2641,8 +2640,7 @@ package-delete-button-action
(when (y-or-n-p (format-message "Delete package `%s'? "
(package-desc-full-name pkg-desc)))
(package-delete pkg-desc)
- (revert-buffer nil t)
- (goto-char (point-min)))))
+ (describe-package (package-desc-name pkg-desc)))))
(defun package-keyword-button-action (button)
"Show filtered \"*Packages*\" buffer for BUTTON.
--
2.28.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#43983: [PATCH] Improve package install/delete button action
2020-10-13 19:46 bug#43983: [PATCH] Improve package install/delete button action tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2020-10-14 4:14 ` Lars Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2020-10-14 4:14 UTC (permalink / raw)
To: tsuucat; +Cc: 43983
tsuucat <tsuucat@icloud.com> writes:
> Running describe-package with just package name instead of
> revert-buffer fixes these problems.
Looks good to me, so I've applied your patch to Emacs 28.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-14 4:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-13 19:46 bug#43983: [PATCH] Improve package install/delete button action tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-10-14 4:14 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).