diff options
author | Eli Zaretskii <eliz@gnu.org> | 2023-05-29 16:44:48 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2023-05-29 16:44:48 +0300 |
commit | afc1f329356da167902d86b610023a32943f6cee (patch) | |
tree | b1ec8616048a31f827ecbbf140a3b873c2008fd4 /lisp/emacs-lisp | |
parent | 08104c01504f73d1c2fa7df413cad4e988dd5119 (diff) | |
download | emacs-afc1f329356da167902d86b610023a32943f6cee.tar.gz emacs-afc1f329356da167902d86b610023a32943f6cee.tar.bz2 emacs-afc1f329356da167902d86b610023a32943f6cee.zip |
Allow to disable the DWIMish behavior of 'x' in package menu
* lisp/emacs-lisp/package.el
(package-menu-use-current-if-no-marks): New defcustom.
(package-menu-execute): Use it. (Bug#62563)
* etc/NEWS: Announce the new option.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/package.el | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 340ca9400fa..202aca36f24 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -3313,6 +3313,18 @@ Values can be interactively added to this list by typing :version "25.1" :type '(repeat (regexp :tag "Hide packages with name matching"))) +(defcustom package-menu-use-current-if-no-marks t + "Whether \\<package-menu-mode-map>\\[package-menu-execute] in package menu operates on current package if none are marked. + +If non-nil, and no packages are marked for installation or +deletion, \\<package-menu-mode-map>\\[package-menu-execute] will operate on the current package at point, +see `package-menu-execute' for details. +The default is t. Set to nil to get back the original behavior +of having `package-menu-execute' signal an error when no packages +are marked for installation or deletion." + :version "29.1" + :type 'boolean) + (defun package-menu--refresh (&optional packages keywords) "Re-populate the `tabulated-list-entries'. PACKAGES should be nil or t, which means to display all known packages. @@ -3943,7 +3955,8 @@ invocations." ;; Nothing marked. (unless (or delete-list install-list) ;; Not on a package line. - (unless (tabulated-list-get-id) + (unless (and (tabulated-list-get-id) + package-menu-use-current-if-no-marks) (user-error "No operations specified")) (let* ((id (tabulated-list-get-id)) (status (package-menu-get-status))) |