diff options
| author | Jonas Bernoulli | 2021-10-25 20:19:52 +0200 |
|---|---|---|
| committer | Jonas Bernoulli | 2021-10-25 20:19:52 +0200 |
| commit | 284c77eeb60bf21d8811f011902cd56f4aeaddca (patch) | |
| tree | 3cacf31b3b55f1fd2a0fd8f3b16809e58af78e73 | |
| parent | 40400e69771eb955c80d64092256bd65466a7b14 (diff) | |
| download | emacs-284c77eeb60bf21d8811f011902cd56f4aeaddca.tar.gz emacs-284c77eeb60bf21d8811f011902cd56f4aeaddca.zip | |
* lisp/transient.el: Update to package version 0.3.7.
| -rw-r--r-- | lisp/transient.el | 340 |
1 files changed, 195 insertions, 145 deletions
diff --git a/lisp/transient.el b/lisp/transient.el index c1b82377f68..d0ba854dd5a 100644 --- a/lisp/transient.el +++ b/lisp/transient.el | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | ;; Keywords: bindings | 7 | ;; Keywords: bindings |
| 8 | 8 | ||
| 9 | ;; Package-Requires: ((emacs "25.1")) | 9 | ;; Package-Requires: ((emacs "25.1")) |
| 10 | ;; Package-Version: 0.3.6 | 10 | ;; Package-Version: 0.3.7 |
| 11 | 11 | ||
| 12 | ;; SPDX-License-Identifier: GPL-3.0-or-later | 12 | ;; SPDX-License-Identifier: GPL-3.0-or-later |
| 13 | 13 | ||
| @@ -54,6 +54,7 @@ | |||
| 54 | 54 | ||
| 55 | (require 'cl-lib) | 55 | (require 'cl-lib) |
| 56 | (require 'eieio) | 56 | (require 'eieio) |
| 57 | (require 'edmacro) | ||
| 57 | (require 'format-spec) | 58 | (require 'format-spec) |
| 58 | (require 'seq) | 59 | (require 'seq) |
| 59 | 60 | ||
| @@ -74,7 +75,7 @@ | |||
| 74 | (define-obsolete-function-alias 'define-infix-command | 75 | (define-obsolete-function-alias 'define-infix-command |
| 75 | 'transient-define-infix "Transient 0.3.0") | 76 | 'transient-define-infix "Transient 0.3.0") |
| 76 | (define-obsolete-function-alias 'define-infix-argument | 77 | (define-obsolete-function-alias 'define-infix-argument |
| 77 | 'transient-define-argument "Transient 0.3.0") | 78 | #'transient-define-argument "Transient 0.3.0") |
| 78 | 79 | ||
| 79 | (define-obsolete-variable-alias 'current-transient-prefix | 80 | (define-obsolete-variable-alias 'current-transient-prefix |
| 80 | 'transient-current-prefix "Transient 0.3.0") | 81 | 'transient-current-prefix "Transient 0.3.0") |
| @@ -148,34 +149,46 @@ features are available: | |||
| 148 | (defcustom transient-display-buffer-action | 149 | (defcustom transient-display-buffer-action |
| 149 | '(display-buffer-in-side-window | 150 | '(display-buffer-in-side-window |
| 150 | (side . bottom) | 151 | (side . bottom) |
| 151 | (inhibit-same-window . t)) | 152 | (dedicated . t) |
| 153 | (inhibit-same-window . t) | ||
| 154 | (window-parameters (no-other-window . t))) | ||
| 152 | "The action used to display the transient popup buffer. | 155 | "The action used to display the transient popup buffer. |
| 153 | 156 | ||
| 154 | The transient popup buffer is displayed in a window using | 157 | The transient popup buffer is displayed in a window using |
| 155 | 158 | ||
| 156 | \(display-buffer buf transient-display-buffer-action) | 159 | (display-buffer BUFFER transient-display-buffer-action) |
| 157 | 160 | ||
| 158 | The value of this option has the form (FUNCTION . ALIST), | 161 | The value of this option has the form (FUNCTION . ALIST), |
| 159 | where FUNCTION is a function or a list of functions. Each such | 162 | where FUNCTION is a function or a list of functions. Each such |
| 160 | function should accept two arguments: a buffer to display and | 163 | function should accept two arguments: a buffer to display and an |
| 161 | an alist of the same form as ALIST. See `display-buffer' for | 164 | alist of the same form as ALIST. See info node `(elisp)Choosing |
| 162 | details. | 165 | Window' for details. |
| 163 | 166 | ||
| 164 | The default is: | 167 | The default is: |
| 165 | 168 | ||
| 166 | (display-buffer-in-side-window | 169 | (display-buffer-in-side-window |
| 167 | (side . bottom) | 170 | (side . bottom) |
| 168 | (inhibit-same-window . t)) | 171 | (dedicated . t) |
| 172 | (inhibit-same-window . t) | ||
| 173 | (window-parameters (no-other-window . t))) | ||
| 169 | 174 | ||
| 170 | This displays the window at the bottom of the selected frame. | 175 | This displays the window at the bottom of the selected frame. |
| 171 | Another useful value is (display-buffer-below-selected). This | 176 | Another useful FUNCTION is `display-buffer-below-selected', which |
| 172 | is what `magit-popup' used by default. For more alternatives | 177 | is what `magit-popup' used by default. For more alternatives see |
| 173 | see info node `(elisp)Display Action Functions'. | 178 | info node `(elisp)Display Action Functions' and info node |
| 179 | `(elisp)Buffer Display Action Alists'. | ||
| 180 | |||
| 181 | Note that the buffer that was current before the transient buffer | ||
| 182 | is shown should remain the current buffer. Many suffix commands | ||
| 183 | act on the thing at point, if appropriate, and if the transient | ||
| 184 | buffer became the current buffer, then that would change what is | ||
| 185 | at point. To that effect `inhibit-same-window' ensures that the | ||
| 186 | selected window is not used to show the transient buffer. | ||
| 174 | 187 | ||
| 175 | It may be possible to display the window in another frame, but | 188 | It may be possible to display the window in another frame, but |
| 176 | whether that works in practice depends on the window-manager. | 189 | whether that works in practice depends on the window-manager. |
| 177 | If the window manager selects the new window (Emacs frame), | 190 | If the window manager selects the new window (Emacs frame), |
| 178 | then it doesn't work. | 191 | then that unfortunately changes which buffer is current. |
| 179 | 192 | ||
| 180 | If you change the value of this option, then you might also | 193 | If you change the value of this option, then you might also |
| 181 | want to change the value of `transient-mode-line-format'." | 194 | want to change the value of `transient-mode-line-format'." |
| @@ -569,7 +582,7 @@ If `transient-save-history' is nil, then do nothing." | |||
| 569 | (transient-save-history))) | 582 | (transient-save-history))) |
| 570 | 583 | ||
| 571 | (unless noninteractive | 584 | (unless noninteractive |
| 572 | (add-hook 'kill-emacs-hook 'transient-maybe-save-history)) | 585 | (add-hook 'kill-emacs-hook #'transient-maybe-save-history)) |
| 573 | 586 | ||
| 574 | ;;; Classes | 587 | ;;; Classes |
| 575 | ;;;; Prefix | 588 | ;;;; Prefix |
| @@ -910,7 +923,7 @@ keyword. | |||
| 910 | (put ',name 'transient--suffix | 923 | (put ',name 'transient--suffix |
| 911 | (,(or class 'transient-switch) :command ',name ,@slots))))) | 924 | (,(or class 'transient-switch) :command ',name ,@slots))))) |
| 912 | 925 | ||
| 913 | (defalias 'transient-define-argument 'define-infix-command | 926 | (defalias 'transient-define-argument #'transient-define-infix |
| 914 | "Define NAME as a transient infix command. | 927 | "Define NAME as a transient infix command. |
| 915 | 928 | ||
| 916 | Only use this alias to define an infix command that actually | 929 | Only use this alias to define an infix command that actually |
| @@ -1061,7 +1074,8 @@ example, sets a variable use `transient-define-infix' instead. | |||
| 1061 | (put cmd 'transient--infix-command | 1074 | (put cmd 'transient--infix-command |
| 1062 | (transient--default-infix-command)) | 1075 | (transient--default-infix-command)) |
| 1063 | ;; This is not an anonymous infix argument. | 1076 | ;; This is not an anonymous infix argument. |
| 1064 | (error "Suffix %s is not defined or autoloaded as a command" cmd))))) | 1077 | (when (transient--use-suffix-p obj) |
| 1078 | (error "Suffix %s is not defined or autoloaded as a command" cmd)))))) | ||
| 1065 | 1079 | ||
| 1066 | (defun transient--derive-shortarg (arg) | 1080 | (defun transient--derive-shortarg (arg) |
| 1067 | (save-match-data | 1081 | (save-match-data |
| @@ -1415,14 +1429,14 @@ then just return it. Otherwise return the symbol whose | |||
| 1415 | 1429 | ||
| 1416 | (defvar transient-base-map | 1430 | (defvar transient-base-map |
| 1417 | (let ((map (make-sparse-keymap))) | 1431 | (let ((map (make-sparse-keymap))) |
| 1418 | (define-key map (kbd "ESC ESC ESC") 'transient-quit-all) | 1432 | (define-key map (kbd "ESC ESC ESC") #'transient-quit-all) |
| 1419 | (define-key map (kbd "C-g") 'transient-quit-one) | 1433 | (define-key map (kbd "C-g") #'transient-quit-one) |
| 1420 | (define-key map (kbd "C-q") 'transient-quit-all) | 1434 | (define-key map (kbd "C-q") #'transient-quit-all) |
| 1421 | (define-key map (kbd "C-z") 'transient-suspend) | 1435 | (define-key map (kbd "C-z") #'transient-suspend) |
| 1422 | (define-key map (kbd "C-v") 'transient-scroll-up) | 1436 | (define-key map (kbd "C-v") #'transient-scroll-up) |
| 1423 | (define-key map (kbd "C-M-v") 'transient-scroll-down) | 1437 | (define-key map (kbd "C-M-v") #'transient-scroll-down) |
| 1424 | (define-key map [next] 'transient-scroll-up) | 1438 | (define-key map [next] #'transient-scroll-up) |
| 1425 | (define-key map [prior] 'transient-scroll-down) | 1439 | (define-key map [prior] #'transient-scroll-down) |
| 1426 | map) | 1440 | map) |
| 1427 | "Parent of other keymaps used by Transient. | 1441 | "Parent of other keymaps used by Transient. |
| 1428 | 1442 | ||
| @@ -1442,14 +1456,14 @@ to `transient-predicate-map'.") | |||
| 1442 | (defvar transient-map | 1456 | (defvar transient-map |
| 1443 | (let ((map (make-sparse-keymap))) | 1457 | (let ((map (make-sparse-keymap))) |
| 1444 | (set-keymap-parent map transient-base-map) | 1458 | (set-keymap-parent map transient-base-map) |
| 1445 | (define-key map (kbd "C-p") 'universal-argument) | 1459 | (define-key map (kbd "C-u") #'universal-argument) |
| 1446 | (define-key map (kbd "C--") 'negative-argument) | 1460 | (define-key map (kbd "C--") #'negative-argument) |
| 1447 | (define-key map (kbd "C-t") 'transient-show) | 1461 | (define-key map (kbd "C-t") #'transient-show) |
| 1448 | (define-key map (kbd "?") 'transient-help) | 1462 | (define-key map (kbd "?") #'transient-help) |
| 1449 | (define-key map (kbd "C-h") 'transient-help) | 1463 | (define-key map (kbd "C-h") #'transient-help) |
| 1450 | ;; Also bound to "C-x p" and "C-x n" in transient-common-commands. | 1464 | ;; Also bound to "C-x p" and "C-x n" in transient-common-commands. |
| 1451 | (define-key map (kbd "C-M-p") 'transient-history-prev) | 1465 | (define-key map (kbd "C-M-p") #'transient-history-prev) |
| 1452 | (define-key map (kbd "C-M-n") 'transient-history-next) | 1466 | (define-key map (kbd "C-M-n") #'transient-history-next) |
| 1453 | map) | 1467 | map) |
| 1454 | "Top-level keymap used by all transients. | 1468 | "Top-level keymap used by all transients. |
| 1455 | 1469 | ||
| @@ -1459,16 +1473,16 @@ to `transient-predicate-map'. Also see `transient-base-map'.") | |||
| 1459 | (defvar transient-edit-map | 1473 | (defvar transient-edit-map |
| 1460 | (let ((map (make-sparse-keymap))) | 1474 | (let ((map (make-sparse-keymap))) |
| 1461 | (set-keymap-parent map transient-base-map) | 1475 | (set-keymap-parent map transient-base-map) |
| 1462 | (define-key map (kbd "?") 'transient-help) | 1476 | (define-key map (kbd "?") #'transient-help) |
| 1463 | (define-key map (kbd "C-h") 'transient-help) | 1477 | (define-key map (kbd "C-h") #'transient-help) |
| 1464 | (define-key map (kbd "C-x l") 'transient-set-level) | 1478 | (define-key map (kbd "C-x l") #'transient-set-level) |
| 1465 | map) | 1479 | map) |
| 1466 | "Keymap that is active while a transient in is in \"edit mode\".") | 1480 | "Keymap that is active while a transient in is in \"edit mode\".") |
| 1467 | 1481 | ||
| 1468 | (defvar transient-sticky-map | 1482 | (defvar transient-sticky-map |
| 1469 | (let ((map (make-sparse-keymap))) | 1483 | (let ((map (make-sparse-keymap))) |
| 1470 | (set-keymap-parent map transient-base-map) | 1484 | (set-keymap-parent map transient-base-map) |
| 1471 | (define-key map (kbd "C-g") 'transient-quit-seq) | 1485 | (define-key map (kbd "C-g") #'transient-quit-seq) |
| 1472 | map) | 1486 | map) |
| 1473 | "Keymap that is active while an incomplete key sequence is active.") | 1487 | "Keymap that is active while an incomplete key sequence is active.") |
| 1474 | 1488 | ||
| @@ -1503,36 +1517,36 @@ to `transient-predicate-map'. Also see `transient-base-map'.") | |||
| 1503 | 1517 | ||
| 1504 | (defvar transient-predicate-map | 1518 | (defvar transient-predicate-map |
| 1505 | (let ((map (make-sparse-keymap))) | 1519 | (let ((map (make-sparse-keymap))) |
| 1506 | (define-key map [handle-switch-frame] 'transient--do-suspend) | 1520 | (define-key map [handle-switch-frame] #'transient--do-suspend) |
| 1507 | (define-key map [transient-suspend] 'transient--do-suspend) | 1521 | (define-key map [transient-suspend] #'transient--do-suspend) |
| 1508 | (define-key map [transient-help] 'transient--do-stay) | 1522 | (define-key map [transient-help] #'transient--do-stay) |
| 1509 | (define-key map [transient-set-level] 'transient--do-stay) | 1523 | (define-key map [transient-set-level] #'transient--do-stay) |
| 1510 | (define-key map [transient-history-prev] 'transient--do-stay) | 1524 | (define-key map [transient-history-prev] #'transient--do-stay) |
| 1511 | (define-key map [transient-history-next] 'transient--do-stay) | 1525 | (define-key map [transient-history-next] #'transient--do-stay) |
| 1512 | (define-key map [universal-argument] 'transient--do-stay) | 1526 | (define-key map [universal-argument] #'transient--do-stay) |
| 1513 | (define-key map [negative-argument] 'transient--do-stay) | 1527 | (define-key map [negative-argument] #'transient--do-stay) |
| 1514 | (define-key map [digit-argument] 'transient--do-stay) | 1528 | (define-key map [digit-argument] #'transient--do-stay) |
| 1515 | (define-key map [transient-quit-all] 'transient--do-quit-all) | 1529 | (define-key map [transient-quit-all] #'transient--do-quit-all) |
| 1516 | (define-key map [transient-quit-one] 'transient--do-quit-one) | 1530 | (define-key map [transient-quit-one] #'transient--do-quit-one) |
| 1517 | (define-key map [transient-quit-seq] 'transient--do-stay) | 1531 | (define-key map [transient-quit-seq] #'transient--do-stay) |
| 1518 | (define-key map [transient-show] 'transient--do-stay) | 1532 | (define-key map [transient-show] #'transient--do-stay) |
| 1519 | (define-key map [transient-update] 'transient--do-stay) | 1533 | (define-key map [transient-update] #'transient--do-stay) |
| 1520 | (define-key map [transient-toggle-common] 'transient--do-stay) | 1534 | (define-key map [transient-toggle-common] #'transient--do-stay) |
| 1521 | (define-key map [transient-set] 'transient--do-call) | 1535 | (define-key map [transient-set] #'transient--do-call) |
| 1522 | (define-key map [transient-save] 'transient--do-call) | 1536 | (define-key map [transient-save] #'transient--do-call) |
| 1523 | (define-key map [describe-key-briefly] 'transient--do-stay) | 1537 | (define-key map [describe-key-briefly] #'transient--do-stay) |
| 1524 | (define-key map [describe-key] 'transient--do-stay) | 1538 | (define-key map [describe-key] #'transient--do-stay) |
| 1525 | (define-key map [transient-scroll-up] 'transient--do-stay) | 1539 | (define-key map [transient-scroll-up] #'transient--do-stay) |
| 1526 | (define-key map [transient-scroll-down] 'transient--do-stay) | 1540 | (define-key map [transient-scroll-down] #'transient--do-stay) |
| 1527 | (define-key map [mwheel-scroll] 'transient--do-stay) | 1541 | (define-key map [mwheel-scroll] #'transient--do-stay) |
| 1528 | (define-key map [scroll-bar-toolkit-scroll] 'transient--do-stay) | 1542 | (define-key map [scroll-bar-toolkit-scroll] #'transient--do-stay) |
| 1529 | (define-key map [transient-noop] 'transient--do-noop) | 1543 | (define-key map [transient-noop] #'transient--do-noop) |
| 1530 | (define-key map [transient-mouse-push-button] 'transient--do-move) | 1544 | (define-key map [transient-mouse-push-button] #'transient--do-move) |
| 1531 | (define-key map [transient-push-button] 'transient--do-move) | 1545 | (define-key map [transient-push-button] #'transient--do-move) |
| 1532 | (define-key map [transient-backward-button] 'transient--do-move) | 1546 | (define-key map [transient-backward-button] #'transient--do-move) |
| 1533 | (define-key map [transient-forward-button] 'transient--do-move) | 1547 | (define-key map [transient-forward-button] #'transient--do-move) |
| 1534 | (define-key map [transient-isearch-backward] 'transient--do-move) | 1548 | (define-key map [transient-isearch-backward] #'transient--do-move) |
| 1535 | (define-key map [transient-isearch-forward] 'transient--do-move) | 1549 | (define-key map [transient-isearch-forward] #'transient--do-move) |
| 1536 | map) | 1550 | map) |
| 1537 | "Base keymap used to map common commands to their transient behavior. | 1551 | "Base keymap used to map common commands to their transient behavior. |
| 1538 | 1552 | ||
| @@ -1606,22 +1620,23 @@ of the corresponding object.") | |||
| 1606 | (sym (transient--suffix-symbol cmd))) | 1620 | (sym (transient--suffix-symbol cmd))) |
| 1607 | (cond | 1621 | (cond |
| 1608 | ((oref obj inapt) | 1622 | ((oref obj inapt) |
| 1609 | (define-key map (vector sym) 'transient--do-warn-inapt)) | 1623 | (define-key map (vector sym) #'transient--do-warn-inapt)) |
| 1610 | ((slot-boundp obj 'transient) | 1624 | ((slot-boundp obj 'transient) |
| 1611 | (define-key map (vector sym) | 1625 | (define-key map (vector sym) |
| 1612 | (let ((do (oref obj transient))) | 1626 | (let ((do (oref obj transient))) |
| 1613 | (pcase do | 1627 | (pcase do |
| 1614 | (`t (if sub-prefix | 1628 | (`t (cond (sub-prefix #'transient--do-replace) |
| 1615 | 'transient--do-replace | 1629 | ((cl-typep obj 'transient-infix) |
| 1616 | 'transient--do-stay)) | 1630 | #'transient--do-stay) |
| 1631 | (t #'transient--do-call))) | ||
| 1617 | (`nil 'transient--do-exit) | 1632 | (`nil 'transient--do-exit) |
| 1618 | (_ do))))) | 1633 | (_ do))))) |
| 1619 | ((not (lookup-key transient-predicate-map (vector sym))) | 1634 | ((not (lookup-key transient-predicate-map (vector sym))) |
| 1620 | (define-key map (vector sym) | 1635 | (define-key map (vector sym) |
| 1621 | (if sub-prefix | 1636 | (if sub-prefix |
| 1622 | 'transient--do-replace | 1637 | #'transient--do-replace |
| 1623 | (or (oref transient--prefix transient-suffix) | 1638 | (or (oref transient--prefix transient-suffix) |
| 1624 | 'transient--do-exit))))))) | 1639 | #'transient--do-exit))))))) |
| 1625 | map)) | 1640 | map)) |
| 1626 | 1641 | ||
| 1627 | (defun transient--make-redisplay-map () | 1642 | (defun transient--make-redisplay-map () |
| @@ -1649,7 +1664,7 @@ of the corresponding object.") | |||
| 1649 | (listp def) | 1664 | (listp def) |
| 1650 | (keymapp def)) | 1665 | (keymapp def)) |
| 1651 | (define-key topmap (vconcat transient--redisplay-key (list key)) | 1666 | (define-key topmap (vconcat transient--redisplay-key (list key)) |
| 1652 | 'transient-update))) | 1667 | #'transient-update))) |
| 1653 | (if transient--redisplay-key | 1668 | (if transient--redisplay-key |
| 1654 | (lookup-key transient--transient-map (vconcat transient--redisplay-key)) | 1669 | (lookup-key transient--transient-map (vconcat transient--redisplay-key)) |
| 1655 | transient--transient-map)) | 1670 | transient--transient-map)) |
| @@ -1678,7 +1693,7 @@ EDIT may be non-nil." | |||
| 1678 | (transient--pop-keymap 'transient--redisplay-map) | 1693 | (transient--pop-keymap 'transient--redisplay-map) |
| 1679 | (setq name (oref transient--prefix command)) | 1694 | (setq name (oref transient--prefix command)) |
| 1680 | (setq params (list :scope (oref transient--prefix scope)))) | 1695 | (setq params (list :scope (oref transient--prefix scope)))) |
| 1681 | (transient--transient-map | 1696 | (transient--prefix |
| 1682 | ;; Invoked as a ":transient-non-suffix 'transient--do-{stay,call}" | 1697 | ;; Invoked as a ":transient-non-suffix 'transient--do-{stay,call}" |
| 1683 | ;; of an outer prefix. Unlike the usual `transient--do-replace', | 1698 | ;; of an outer prefix. Unlike the usual `transient--do-replace', |
| 1684 | ;; these predicates fail to clean up after the outer prefix. | 1699 | ;; these predicates fail to clean up after the outer prefix. |
| @@ -1953,8 +1968,10 @@ value. Otherwise return CHILDREN as is." | |||
| 1953 | (defun transient--delete-window () | 1968 | (defun transient--delete-window () |
| 1954 | (when (window-live-p transient--window) | 1969 | (when (window-live-p transient--window) |
| 1955 | (let ((buf (window-buffer transient--window))) | 1970 | (let ((buf (window-buffer transient--window))) |
| 1956 | (with-demoted-errors "Error while exiting transient: %S" | 1971 | ;; Only delete the window if it never showed another buffer. |
| 1957 | (delete-window transient--window)) | 1972 | (unless (eq (car (window-parameter transient--window 'quit-restore)) 'other) |
| 1973 | (with-demoted-errors "Error while exiting transient: %S" | ||
| 1974 | (delete-window transient--window))) | ||
| 1958 | (kill-buffer buf)))) | 1975 | (kill-buffer buf)))) |
| 1959 | 1976 | ||
| 1960 | (defun transient--export () | 1977 | (defun transient--export () |
| @@ -2093,8 +2110,8 @@ value. Otherwise return CHILDREN as is." | |||
| 2093 | 2110 | ||
| 2094 | (defun transient--emergency-exit () | 2111 | (defun transient--emergency-exit () |
| 2095 | "Exit the current transient command after an error occurred. | 2112 | "Exit the current transient command after an error occurred. |
| 2096 | When no transient is active (i.e. when `transient--prefix') is | 2113 | When no transient is active (i.e. when `transient--prefix' is |
| 2097 | nil, then do nothing." | 2114 | nil) then do nothing." |
| 2098 | (transient--debug 'emergency-exit) | 2115 | (transient--debug 'emergency-exit) |
| 2099 | (when transient--prefix | 2116 | (when transient--prefix |
| 2100 | (setq transient--stack nil) | 2117 | (setq transient--stack nil) |
| @@ -2171,17 +2188,17 @@ to `transient--do-warn'." | |||
| 2171 | (setq this-command 'transient-popup-navigation-help)) | 2188 | (setq this-command 'transient-popup-navigation-help)) |
| 2172 | transient--stay) | 2189 | transient--stay) |
| 2173 | 2190 | ||
| 2174 | (put 'transient--do-stay 'transient-color 'transient-blue) | 2191 | (put 'transient--do-stay 'transient-color 'transient-red) |
| 2175 | (put 'transient--do-noop 'transient-color 'transient-blue) | 2192 | (put 'transient--do-noop 'transient-color 'transient-red) |
| 2176 | (put 'transient--do-warn 'transient-color 'transient-blue) | 2193 | (put 'transient--do-warn 'transient-color 'transient-red) |
| 2177 | (put 'transient--do-warn-inapt 'transient-color 'transient-blue) | 2194 | (put 'transient--do-warn-inapt 'transient-color 'transient-red) |
| 2178 | (put 'transient--do-call 'transient-color 'transient-blue) | 2195 | (put 'transient--do-call 'transient-color 'transient-red) |
| 2179 | (put 'transient--do-exit 'transient-color 'transient-red) | 2196 | (put 'transient--do-exit 'transient-color 'transient-blue) |
| 2180 | (put 'transient--do-replace 'transient-color 'transient-red) | 2197 | (put 'transient--do-replace 'transient-color 'transient-blue) |
| 2181 | (put 'transient--do-suspend 'transient-color 'transient-red) | 2198 | (put 'transient--do-suspend 'transient-color 'transient-blue) |
| 2182 | (put 'transient--do-quit-one 'transient-color 'transient-red) | 2199 | (put 'transient--do-quit-one 'transient-color 'transient-blue) |
| 2183 | (put 'transient--do-quit-all 'transient-color 'transient-red) | 2200 | (put 'transient--do-quit-all 'transient-color 'transient-blue) |
| 2184 | (put 'transient--do-move 'transient-color 'transient-blue) | 2201 | (put 'transient--do-move 'transient-color 'transient-red) |
| 2185 | 2202 | ||
| 2186 | ;;; Commands | 2203 | ;;; Commands |
| 2187 | 2204 | ||
| @@ -2209,7 +2226,18 @@ to `transient--do-warn'." | |||
| 2209 | (propertize "?" 'face 'transient-key) | 2226 | (propertize "?" 'face 'transient-key) |
| 2210 | (propertize (symbol-name (transient--suffix-symbol | 2227 | (propertize (symbol-name (transient--suffix-symbol |
| 2211 | this-original-command)) | 2228 | this-original-command)) |
| 2212 | 'face 'font-lock-warning-face))) | 2229 | 'face 'font-lock-warning-face)) |
| 2230 | (unless (and transient--transient-map | ||
| 2231 | (memq transient--transient-map overriding-terminal-local-map)) | ||
| 2232 | (let ((transient--prefix (or transient--prefix 'sic))) | ||
| 2233 | (transient--emergency-exit)) | ||
| 2234 | (view-lossage) | ||
| 2235 | (other-window 1) | ||
| 2236 | (display-warning 'transient "Inconsistent transient state detected. | ||
| 2237 | This should never happen. | ||
| 2238 | Please open an issue and post the shown command log. | ||
| 2239 | This is a heisenbug, so any additional details might help. | ||
| 2240 | Thanks!" :error))) | ||
| 2213 | 2241 | ||
| 2214 | (defun transient-toggle-common () | 2242 | (defun transient-toggle-common () |
| 2215 | "Toggle whether common commands are always shown." | 2243 | "Toggle whether common commands are always shown." |
| @@ -2407,14 +2435,14 @@ Non-infix suffix commands usually don't have a value." | |||
| 2407 | 2435 | ||
| 2408 | (cl-defmethod transient-init-value :around ((obj transient-prefix)) | 2436 | (cl-defmethod transient-init-value :around ((obj transient-prefix)) |
| 2409 | "If bound, then call OBJ's `init-value' function. | 2437 | "If bound, then call OBJ's `init-value' function. |
| 2410 | Otherwise call the primary method according to objects class." | 2438 | Otherwise call the primary method according to object's class." |
| 2411 | (if (slot-boundp obj 'init-value) | 2439 | (if (slot-boundp obj 'init-value) |
| 2412 | (funcall (oref obj init-value) obj) | 2440 | (funcall (oref obj init-value) obj) |
| 2413 | (cl-call-next-method obj))) | 2441 | (cl-call-next-method obj))) |
| 2414 | 2442 | ||
| 2415 | (cl-defmethod transient-init-value :around ((obj transient-infix)) | 2443 | (cl-defmethod transient-init-value :around ((obj transient-infix)) |
| 2416 | "If bound, then call OBJ's `init-value' function. | 2444 | "If bound, then call OBJ's `init-value' function. |
| 2417 | Otherwise call the primary method according to objects class." | 2445 | Otherwise call the primary method according to object's class." |
| 2418 | (if (slot-boundp obj 'init-value) | 2446 | (if (slot-boundp obj 'init-value) |
| 2419 | (funcall (oref obj init-value) obj) | 2447 | (funcall (oref obj init-value) obj) |
| 2420 | (cl-call-next-method obj))) | 2448 | (cl-call-next-method obj))) |
| @@ -2595,13 +2623,12 @@ stand-alone command." | |||
| 2595 | (cl-block nil | 2623 | (cl-block nil |
| 2596 | (while t | 2624 | (while t |
| 2597 | (let ((str (read-from-minibuffer prompt initial-input nil nil history))) | 2625 | (let ((str (read-from-minibuffer prompt initial-input nil nil history))) |
| 2598 | (cond ((string-equal str "") | 2626 | (when (or (string-equal str "") |
| 2599 | (cl-return nil)) | 2627 | (string-match-p (if include-zero |
| 2600 | ((string-match-p (if include-zero | 2628 | "\\`\\(0\\|[1-9][0-9]*\\)\\'" |
| 2601 | "\\`\\(0\\|[1-9][0-9]*\\)\\'" | 2629 | "\\`[1-9][0-9]*\\'") |
| 2602 | "\\`[1-9][0-9]*\\'") | 2630 | str)) |
| 2603 | str) | 2631 | (cl-return str))) |
| 2604 | (cl-return str)))) | ||
| 2605 | (message "Please enter a natural number (%s zero)." | 2632 | (message "Please enter a natural number (%s zero)." |
| 2606 | (if include-zero "including" "excluding")) | 2633 | (if include-zero "including" "excluding")) |
| 2607 | (sit-for 1))))) | 2634 | (sit-for 1))))) |
| @@ -2670,7 +2697,10 @@ prompt." | |||
| 2670 | (oref obj argument-regexp)))) | 2697 | (oref obj argument-regexp)))) |
| 2671 | (if-let ((sic (and value arg transient--unset-incompatible)) | 2698 | (if-let ((sic (and value arg transient--unset-incompatible)) |
| 2672 | (spec (oref transient--prefix incompatible)) | 2699 | (spec (oref transient--prefix incompatible)) |
| 2673 | (incomp (remove arg (cl-find-if (lambda (elt) (member arg elt)) spec)))) | 2700 | (incomp (cl-mapcan (lambda (rule) |
| 2701 | (and (member arg rule) | ||
| 2702 | (remove arg rule))) | ||
| 2703 | spec))) | ||
| 2674 | (progn | 2704 | (progn |
| 2675 | (cl-call-next-method obj value) | 2705 | (cl-call-next-method obj value) |
| 2676 | (dolist (arg incomp) | 2706 | (dolist (arg incomp) |
| @@ -2703,7 +2733,7 @@ If the current command was invoked from the transient prefix | |||
| 2703 | command PREFIX, then return the active infix arguments. If | 2733 | command PREFIX, then return the active infix arguments. If |
| 2704 | the current command was not invoked from PREFIX, then return | 2734 | the current command was not invoked from PREFIX, then return |
| 2705 | the set, saved or default value for PREFIX." | 2735 | the set, saved or default value for PREFIX." |
| 2706 | (delq nil (mapcar 'transient-infix-value (transient-suffixes prefix)))) | 2736 | (delq nil (mapcar #'transient-infix-value (transient-suffixes prefix)))) |
| 2707 | 2737 | ||
| 2708 | (defun transient-suffixes (prefix) | 2738 | (defun transient-suffixes (prefix) |
| 2709 | "Return the suffix objects of the transient prefix command PREFIX." | 2739 | "Return the suffix objects of the transient prefix command PREFIX." |
| @@ -2714,11 +2744,12 @@ the set, saved or default value for PREFIX." | |||
| 2714 | (transient--init-suffixes prefix))))) | 2744 | (transient--init-suffixes prefix))))) |
| 2715 | 2745 | ||
| 2716 | (defun transient-get-value () | 2746 | (defun transient-get-value () |
| 2717 | (delq nil (mapcar (lambda (obj) | 2747 | (transient--with-emergency-exit |
| 2718 | (and (or (not (slot-exists-p obj 'unsavable)) | 2748 | (delq nil (mapcar (lambda (obj) |
| 2719 | (not (oref obj unsavable))) | 2749 | (and (or (not (slot-exists-p obj 'unsavable)) |
| 2720 | (transient-infix-value obj))) | 2750 | (not (oref obj unsavable))) |
| 2721 | transient-current-suffixes))) | 2751 | (transient-infix-value obj))) |
| 2752 | transient-current-suffixes)))) | ||
| 2722 | 2753 | ||
| 2723 | (cl-defgeneric transient-infix-value (obj) | 2754 | (cl-defgeneric transient-infix-value (obj) |
| 2724 | "Return the value of the suffix object OBJ. | 2755 | "Return the value of the suffix object OBJ. |
| @@ -2860,16 +2891,11 @@ have a history of their own.") | |||
| 2860 | (setq transient--showp t) | 2891 | (setq transient--showp t) |
| 2861 | (let ((buf (get-buffer-create transient--buffer-name)) | 2892 | (let ((buf (get-buffer-create transient--buffer-name)) |
| 2862 | (focus nil)) | 2893 | (focus nil)) |
| 2863 | (unless (window-live-p transient--window) | 2894 | (with-current-buffer buf |
| 2864 | (setq transient--window | ||
| 2865 | (display-buffer buf transient-display-buffer-action))) | ||
| 2866 | (with-selected-window transient--window | ||
| 2867 | (when transient-enable-popup-navigation | 2895 | (when transient-enable-popup-navigation |
| 2868 | (setq focus (button-get (point) 'command))) | 2896 | (setq focus (or (button-get (point) 'command) |
| 2897 | (transient--heading-at-point)))) | ||
| 2869 | (erase-buffer) | 2898 | (erase-buffer) |
| 2870 | (set-window-hscroll transient--window 0) | ||
| 2871 | (set-window-dedicated-p transient--window t) | ||
| 2872 | (set-window-parameter transient--window 'no-other-window t) | ||
| 2873 | (setq window-size-fixed t) | 2899 | (setq window-size-fixed t) |
| 2874 | (when (bound-and-true-p tab-line-format) | 2900 | (when (bound-and-true-p tab-line-format) |
| 2875 | (setq tab-line-format nil)) | 2901 | (setq tab-line-format nil)) |
| @@ -2896,14 +2922,26 @@ have a history of their own.") | |||
| 2896 | 'transient-separator))) | 2922 | 'transient-separator))) |
| 2897 | (insert (propertize "__" 'face face 'display '(space :height (1)))) | 2923 | (insert (propertize "__" 'face face 'display '(space :height (1)))) |
| 2898 | (insert (propertize "\n" 'face face 'line-height t)))) | 2924 | (insert (propertize "\n" 'face face 'line-height t)))) |
| 2899 | (let ((window-resize-pixelwise t) | ||
| 2900 | (window-size-fixed nil)) | ||
| 2901 | (fit-window-to-buffer nil nil 1)) | ||
| 2902 | (goto-char (point-min)) | 2925 | (goto-char (point-min)) |
| 2903 | (when transient-force-fixed-pitch | 2926 | (when transient-force-fixed-pitch |
| 2904 | (transient--force-fixed-pitch)) | 2927 | (transient--force-fixed-pitch)) |
| 2905 | (when transient-enable-popup-navigation | 2928 | (when transient-enable-popup-navigation |
| 2906 | (transient--goto-button focus))))) | 2929 | (transient--goto-button focus))) |
| 2930 | (unless (window-live-p transient--window) | ||
| 2931 | (setq transient--window | ||
| 2932 | (display-buffer buf transient-display-buffer-action))) | ||
| 2933 | (when (window-live-p transient--window) | ||
| 2934 | (with-selected-window transient--window | ||
| 2935 | (magit--fit-window-to-buffer transient--window))))) | ||
| 2936 | |||
| 2937 | (defun magit--fit-window-to-buffer (window) | ||
| 2938 | (let ((window-resize-pixelwise t) | ||
| 2939 | (window-size-fixed nil)) | ||
| 2940 | (if (eq (car (window-parameter window 'quit-restore)) 'other) | ||
| 2941 | ;; Grow but never shrink window that previously displayed | ||
| 2942 | ;; another buffer and is going to display that again. | ||
| 2943 | (fit-window-to-buffer window nil (window-height window)) | ||
| 2944 | (fit-window-to-buffer window nil 1)))) | ||
| 2907 | 2945 | ||
| 2908 | (defun transient--insert-groups () | 2946 | (defun transient--insert-groups () |
| 2909 | (let ((groups (cl-mapcan (lambda (group) | 2947 | (let ((groups (cl-mapcan (lambda (group) |
| @@ -2946,7 +2984,7 @@ have a history of their own.") | |||
| 2946 | (mapcar | 2984 | (mapcar |
| 2947 | (lambda (column) | 2985 | (lambda (column) |
| 2948 | (transient--maybe-pad-keys column group) | 2986 | (transient--maybe-pad-keys column group) |
| 2949 | (let ((rows (mapcar 'transient-format (oref column suffixes)))) | 2987 | (let ((rows (mapcar #'transient-format (oref column suffixes)))) |
| 2950 | (when-let ((desc (transient-format-description column))) | 2988 | (when-let ((desc (transient-format-description column))) |
| 2951 | (push desc rows)) | 2989 | (push desc rows)) |
| 2952 | rows)) | 2990 | rows)) |
| @@ -3249,12 +3287,13 @@ Show the first one that is specified." | |||
| 3249 | 3287 | ||
| 3250 | (cl-defmethod transient-show-help ((obj transient-suffix)) | 3288 | (cl-defmethod transient-show-help ((obj transient-suffix)) |
| 3251 | "Show the command doc-string." | 3289 | "Show the command doc-string." |
| 3252 | (if (eq this-original-command 'transient-help) | 3290 | (if (eq this-command 'transient-help) |
| 3253 | (if-let ((manpage (oref transient--prefix man-page))) | 3291 | (if-let ((manpage (oref transient--prefix man-page))) |
| 3254 | (transient--show-manpage manpage) | 3292 | (transient--show-manpage manpage) |
| 3255 | (transient--describe-function (oref transient--prefix command))) | 3293 | (transient--describe-function (oref transient--prefix command))) |
| 3256 | (if-let ((prefix (get (transient--suffix-command obj) 'transient--prefix)) | 3294 | (if-let ((prefix (get (transient--suffix-command obj) 'transient--prefix)) |
| 3257 | (manpage (oref prefix man-page))) | 3295 | (manpage (oref prefix man-page)) |
| 3296 | (- (not (eq this-command (oref transient--prefix command))))) | ||
| 3258 | (transient--show-manpage manpage) | 3297 | (transient--show-manpage manpage) |
| 3259 | (transient--describe-function this-original-command)))) | 3298 | (transient--describe-function this-original-command)))) |
| 3260 | 3299 | ||
| @@ -3366,9 +3405,9 @@ Suffixes on levels %s and %s are unavailable.\n" | |||
| 3366 | 3405 | ||
| 3367 | (defvar transient-resume-mode-map | 3406 | (defvar transient-resume-mode-map |
| 3368 | (let ((map (make-sparse-keymap))) | 3407 | (let ((map (make-sparse-keymap))) |
| 3369 | (define-key map [remap Man-quit] 'transient-resume) | 3408 | (define-key map [remap Man-quit] #'transient-resume) |
| 3370 | (define-key map [remap Info-exit] 'transient-resume) | 3409 | (define-key map [remap Info-exit] #'transient-resume) |
| 3371 | (define-key map [remap quit-window] 'transient-resume) | 3410 | (define-key map [remap quit-window] #'transient-resume) |
| 3372 | map) | 3411 | map) |
| 3373 | "Keymap for `transient-resume-mode'. | 3412 | "Keymap for `transient-resume-mode'. |
| 3374 | 3413 | ||
| @@ -3395,19 +3434,20 @@ resumes the suspended transient.") | |||
| 3395 | ;; Yes, I know that this is wrong(tm). | 3434 | ;; Yes, I know that this is wrong(tm). |
| 3396 | ;; Unfortunately it is also necessary. | 3435 | ;; Unfortunately it is also necessary. |
| 3397 | (setq this-original-command command) | 3436 | (setq this-original-command command) |
| 3437 | (transient--pre-command) | ||
| 3398 | (call-interactively command)))) | 3438 | (call-interactively command)))) |
| 3399 | 3439 | ||
| 3400 | (defvar transient-popup-navigation-map | 3440 | (defvar transient-popup-navigation-map |
| 3401 | (let ((map (make-sparse-keymap))) | 3441 | (let ((map (make-sparse-keymap))) |
| 3402 | (define-key map (kbd "<down-mouse-1>") 'transient-noop) | 3442 | (define-key map (kbd "<down-mouse-1>") #'transient-noop) |
| 3403 | (define-key map (kbd "<mouse-1>") 'transient-mouse-push-button) | 3443 | (define-key map (kbd "<mouse-1>") #'transient-mouse-push-button) |
| 3404 | (define-key map (kbd "RET") 'transient-push-button) | 3444 | (define-key map (kbd "RET") #'transient-push-button) |
| 3405 | (define-key map (kbd "<up>") 'transient-backward-button) | 3445 | (define-key map (kbd "<up>") #'transient-backward-button) |
| 3406 | (define-key map (kbd "C-p") 'transient-backward-button) | 3446 | (define-key map (kbd "C-p") #'transient-backward-button) |
| 3407 | (define-key map (kbd "<down>") 'transient-forward-button) | 3447 | (define-key map (kbd "<down>") #'transient-forward-button) |
| 3408 | (define-key map (kbd "C-n") 'transient-forward-button) | 3448 | (define-key map (kbd "C-n") #'transient-forward-button) |
| 3409 | (define-key map (kbd "C-r") 'transient-isearch-backward) | 3449 | (define-key map (kbd "C-r") #'transient-isearch-backward) |
| 3410 | (define-key map (kbd "C-s") 'transient-isearch-forward) | 3450 | (define-key map (kbd "C-s") #'transient-isearch-forward) |
| 3411 | map)) | 3451 | map)) |
| 3412 | 3452 | ||
| 3413 | (defun transient-mouse-push-button (&optional pos) | 3453 | (defun transient-mouse-push-button (&optional pos) |
| @@ -3436,22 +3476,32 @@ See `forward-button' for information about N." | |||
| 3436 | (forward-button n t))) | 3476 | (forward-button n t))) |
| 3437 | 3477 | ||
| 3438 | (defun transient--goto-button (command) | 3478 | (defun transient--goto-button (command) |
| 3439 | (if (not command) | 3479 | (cond |
| 3440 | (forward-button 1) | 3480 | ((stringp command) |
| 3481 | (when (re-search-forward (concat "^" (regexp-quote command)) nil t) | ||
| 3482 | (goto-char (match-beginning 0)))) | ||
| 3483 | (command | ||
| 3441 | (while (and (ignore-errors (forward-button 1)) | 3484 | (while (and (ignore-errors (forward-button 1)) |
| 3442 | (not (eq (button-get (button-at (point)) 'command) command)))) | 3485 | (not (eq (button-get (button-at (point)) 'command) command)))) |
| 3443 | (unless (eq (button-get (button-at (point)) 'command) command) | 3486 | (unless (eq (button-get (button-at (point)) 'command) command) |
| 3444 | (goto-char (point-min)) | 3487 | (goto-char (point-min)) |
| 3445 | (forward-button 1)))) | 3488 | (forward-button 1))))) |
| 3489 | |||
| 3490 | (defun transient--heading-at-point () | ||
| 3491 | (and (eq (get-text-property (point) 'face) 'transient-heading) | ||
| 3492 | (let ((beg (line-beginning-position))) | ||
| 3493 | (buffer-substring-no-properties | ||
| 3494 | beg (next-single-property-change | ||
| 3495 | beg 'face nil (line-end-position)))))) | ||
| 3446 | 3496 | ||
| 3447 | ;;;; Popup Isearch | 3497 | ;;;; Popup Isearch |
| 3448 | 3498 | ||
| 3449 | (defvar transient--isearch-mode-map | 3499 | (defvar transient--isearch-mode-map |
| 3450 | (let ((map (make-sparse-keymap))) | 3500 | (let ((map (make-sparse-keymap))) |
| 3451 | (set-keymap-parent map isearch-mode-map) | 3501 | (set-keymap-parent map isearch-mode-map) |
| 3452 | (define-key map [remap isearch-exit] 'transient-isearch-exit) | 3502 | (define-key map [remap isearch-exit] #'transient-isearch-exit) |
| 3453 | (define-key map [remap isearch-cancel] 'transient-isearch-cancel) | 3503 | (define-key map [remap isearch-cancel] #'transient-isearch-cancel) |
| 3454 | (define-key map [remap isearch-abort] 'transient-isearch-abort) | 3504 | (define-key map [remap isearch-abort] #'transient-isearch-abort) |
| 3455 | map)) | 3505 | map)) |
| 3456 | 3506 | ||
| 3457 | (defun transient-isearch-backward (&optional regexp-p) | 3507 | (defun transient-isearch-backward (&optional regexp-p) |
| @@ -3537,14 +3587,14 @@ search instead." | |||
| 3537 | (funcall fn arg-mode) | 3587 | (funcall fn arg-mode) |
| 3538 | (transient--resume-override t))) | 3588 | (transient--resume-override t))) |
| 3539 | 3589 | ||
| 3540 | (advice-add 'edebug--recursive-edit :around 'transient--edebug--recursive-edit) | 3590 | (advice-add 'edebug--recursive-edit :around #'transient--edebug--recursive-edit) |
| 3541 | 3591 | ||
| 3542 | (defun transient--abort-edebug () | 3592 | (defun transient--abort-edebug () |
| 3543 | (when (bound-and-true-p edebug-active) | 3593 | (when (bound-and-true-p edebug-active) |
| 3544 | (transient--emergency-exit))) | 3594 | (transient--emergency-exit))) |
| 3545 | 3595 | ||
| 3546 | (advice-add 'abort-recursive-edit :before 'transient--abort-edebug) | 3596 | (advice-add 'abort-recursive-edit :before #'transient--abort-edebug) |
| 3547 | (advice-add 'top-level :before 'transient--abort-edebug) | 3597 | (advice-add 'top-level :before #'transient--abort-edebug) |
| 3548 | 3598 | ||
| 3549 | (defun transient--edebug-command-p () | 3599 | (defun transient--edebug-command-p () |
| 3550 | (and (bound-and-true-p edebug-active) | 3600 | (and (bound-and-true-p edebug-active) |
| @@ -3558,12 +3608,12 @@ search instead." | |||
| 3558 | (defun transient--suspend-which-key-mode () | 3608 | (defun transient--suspend-which-key-mode () |
| 3559 | (when (bound-and-true-p which-key-mode) | 3609 | (when (bound-and-true-p which-key-mode) |
| 3560 | (which-key-mode -1) | 3610 | (which-key-mode -1) |
| 3561 | (add-hook 'transient-exit-hook 'transient--resume-which-key-mode))) | 3611 | (add-hook 'transient-exit-hook #'transient--resume-which-key-mode))) |
| 3562 | 3612 | ||
| 3563 | (defun transient--resume-which-key-mode () | 3613 | (defun transient--resume-which-key-mode () |
| 3564 | (unless transient--prefix | 3614 | (unless transient--prefix |
| 3565 | (which-key-mode 1) | 3615 | (which-key-mode 1) |
| 3566 | (remove-hook 'transient-exit-hook 'transient--resume-which-key-mode))) | 3616 | (remove-hook 'transient-exit-hook #'transient--resume-which-key-mode))) |
| 3567 | 3617 | ||
| 3568 | (defun transient-bind-q-to-quit () | 3618 | (defun transient-bind-q-to-quit () |
| 3569 | "Modify some keymaps to bind \"q\" to the appropriate quit command. | 3619 | "Modify some keymaps to bind \"q\" to the appropriate quit command. |
| @@ -3583,10 +3633,10 @@ that does that. Of course \"Q\" may already be bound to something | |||
| 3583 | else, so that function binds \"M-q\" to that command instead. | 3633 | else, so that function binds \"M-q\" to that command instead. |
| 3584 | Of course \"M-q\" may already be bound to something else, but | 3634 | Of course \"M-q\" may already be bound to something else, but |
| 3585 | we stop there." | 3635 | we stop there." |
| 3586 | (define-key transient-base-map "q" 'transient-quit-one) | 3636 | (define-key transient-base-map "q" #'transient-quit-one) |
| 3587 | (define-key transient-sticky-map "q" 'transient-quit-seq) | 3637 | (define-key transient-sticky-map "q" #'transient-quit-seq) |
| 3588 | (setq transient-substitute-key-function | 3638 | (setq transient-substitute-key-function |
| 3589 | 'transient-rebind-quit-commands)) | 3639 | #'transient-rebind-quit-commands)) |
| 3590 | 3640 | ||
| 3591 | (defun transient-rebind-quit-commands (obj) | 3641 | (defun transient-rebind-quit-commands (obj) |
| 3592 | "See `transient-bind-q-to-quit'." | 3642 | "See `transient-bind-q-to-quit'." |