diff options
| author | Jonas Bernoulli | 2023-12-05 20:04:21 +0100 |
|---|---|---|
| committer | Jonas Bernoulli | 2023-12-05 20:04:21 +0100 |
| commit | 1f1dbfc6e8da2bad097a388fbfd8cb09a2092cac (patch) | |
| tree | f0781792146a2ec40d17854beff4a269bd41a0b4 | |
| parent | fa5f06c1251ff717d661f05fcd240b4792054aae (diff) | |
| download | emacs-1f1dbfc6e8da2bad097a388fbfd8cb09a2092cac.tar.gz emacs-1f1dbfc6e8da2bad097a388fbfd8cb09a2092cac.zip | |
; * lisp/transient.el: Revert accidental changes
| -rw-r--r-- | doc/misc/transient.texi | 62 | ||||
| -rw-r--r-- | lisp/transient.el | 6 |
2 files changed, 37 insertions, 31 deletions
diff --git a/doc/misc/transient.texi b/doc/misc/transient.texi index b6c426d7f21..ac330e09702 100644 --- a/doc/misc/transient.texi +++ b/doc/misc/transient.texi | |||
| @@ -25,7 +25,7 @@ General Public License for more details. | |||
| 25 | 25 | ||
| 26 | @dircategory Emacs misc features | 26 | @dircategory Emacs misc features |
| 27 | @direntry | 27 | @direntry |
| 28 | * Transient: (transient). Transient Commands. | 28 | * Transient: (transient). Transient Commands. |
| 29 | @end direntry | 29 | @end direntry |
| 30 | 30 | ||
| 31 | @finalout | 31 | @finalout |
| @@ -359,7 +359,7 @@ than outlined above and even customizable.} | |||
| 359 | If the user does not save the value and just exits using a regular | 359 | If the user does not save the value and just exits using a regular |
| 360 | suffix command, then the value is merely saved to the transient's | 360 | suffix command, then the value is merely saved to the transient's |
| 361 | history. That value won't be used when the transient is next invoked, | 361 | history. That value won't be used when the transient is next invoked, |
| 362 | but it is easily accessible (see @ref{Using History}). | 362 | but it is easily accessible (@pxref{Using History}). |
| 363 | 363 | ||
| 364 | @table @asis | 364 | @table @asis |
| 365 | @item @kbd{C-x s} (@code{transient-set}) | 365 | @item @kbd{C-x s} (@code{transient-set}) |
| @@ -420,8 +420,8 @@ to cycle through previously used values. Usually the same keys as | |||
| 420 | those mentioned above are bound to those commands. | 420 | those mentioned above are bound to those commands. |
| 421 | 421 | ||
| 422 | Authors of transients should arrange for different infix commands that | 422 | Authors of transients should arrange for different infix commands that |
| 423 | read the same kind of value to also use the same history key (see | 423 | read the same kind of value to also use the same history key |
| 424 | @ref{Suffix Slots}). | 424 | (@pxref{Suffix Slots}). |
| 425 | 425 | ||
| 426 | Both kinds of history are saved to a file when Emacs is exited. | 426 | Both kinds of history are saved to a file when Emacs is exited. |
| 427 | 427 | ||
| @@ -635,7 +635,7 @@ buffer. The transient popup buffer is displayed in a window using | |||
| 635 | The value of this option has the form @code{(@var{FUNCTION} . @var{ALIST})}, | 635 | The value of this option has the form @code{(@var{FUNCTION} . @var{ALIST})}, |
| 636 | where @var{FUNCTION} is a function or a list of functions. Each such | 636 | where @var{FUNCTION} is a function or a list of functions. Each such |
| 637 | function should accept two arguments: a buffer to display and an | 637 | function should accept two arguments: a buffer to display and an |
| 638 | alist of the same form as @var{ALIST}. See @ref{Choosing Window,,,elisp,}, | 638 | alist of the same form as @var{ALIST}. @xref{Choosing Window,,,elisp,}, |
| 639 | for details. | 639 | for details. |
| 640 | 640 | ||
| 641 | The default is: | 641 | The default is: |
| @@ -650,7 +650,8 @@ The default is: | |||
| 650 | This displays the window at the bottom of the selected frame. | 650 | This displays the window at the bottom of the selected frame. |
| 651 | Another useful @var{FUNCTION} is @code{display-buffer-below-selected}, which | 651 | Another useful @var{FUNCTION} is @code{display-buffer-below-selected}, which |
| 652 | is what @code{magit-popup} used by default. For more alternatives see | 652 | is what @code{magit-popup} used by default. For more alternatives see |
| 653 | @ref{Buffer Display Action Functions,,,elisp,}, and @ref{Buffer Display Action Alists,,,elisp,}. | 653 | @ref{Buffer Display Action Functions,,,elisp,}, and see @ref{Buffer Display |
| 654 | Action Alists,,,elisp,}. | ||
| 654 | 655 | ||
| 655 | Note that the buffer that was current before the transient buffer | 656 | Note that the buffer that was current before the transient buffer |
| 656 | is shown should remain the current buffer. Many suffix commands | 657 | is shown should remain the current buffer. Many suffix commands |
| @@ -702,7 +703,8 @@ color of @code{transient-key-noop} (if non-suffix are disallowed), | |||
| 702 | @code{transient-key-exit} (if allowed and they exit the transient) is | 703 | @code{transient-key-exit} (if allowed and they exit the transient) is |
| 703 | used to draw the line. | 704 | used to draw the line. |
| 704 | 705 | ||
| 705 | Otherwise this can be any mode-line format. See @ref{Mode Line Format,,,elisp,}, for details. | 706 | Otherwise this can be any mode-line format. @xref{Mode Line |
| 707 | Format,,,elisp,}, for details. | ||
| 706 | @end defopt | 708 | @end defopt |
| 707 | 709 | ||
| 708 | @defopt transient-semantic-coloring | 710 | @defopt transient-semantic-coloring |
| @@ -851,10 +853,10 @@ The following functions share a few arguments: | |||
| 851 | as expected by @code{transient-define-prefix}. Note that an infix is a | 853 | as expected by @code{transient-define-prefix}. Note that an infix is a |
| 852 | special kind of suffix. Depending on context ``suffixes'' means | 854 | special kind of suffix. Depending on context ``suffixes'' means |
| 853 | ``suffixes (including infixes)'' or ``non-infix suffixes''. Here it | 855 | ``suffixes (including infixes)'' or ``non-infix suffixes''. Here it |
| 854 | means the former. See @ref{Suffix Specifications}. | 856 | means the former. @xref{Suffix Specifications}. |
| 855 | 857 | ||
| 856 | @var{SUFFIX} may also be a group in the same form as expected by | 858 | @var{SUFFIX} may also be a group in the same form as expected by |
| 857 | @code{transient-define-prefix}. See @ref{Group Specifications}. | 859 | @code{transient-define-prefix}. @xref{Group Specifications}. |
| 858 | 860 | ||
| 859 | @item | 861 | @item |
| 860 | @var{LOC} is a command, a key vector, a key description (a string as | 862 | @var{LOC} is a command, a key vector, a key description (a string as |
| @@ -1034,7 +1036,7 @@ binds the transient's infix and suffix commands. In other words, it | |||
| 1034 | defines the complete transient, not just the transient prefix command | 1036 | defines the complete transient, not just the transient prefix command |
| 1035 | that is used to invoke that transient. | 1037 | that is used to invoke that transient. |
| 1036 | 1038 | ||
| 1037 | @defmac transient-define-prefix name arglist [docstring] [keyword value]... group... [body...] | 1039 | @defmac transient-define-prefix name arglist [docstring] [keyword value]@dots{} group@dots{} [body@dots{}] |
| 1038 | This macro defines @var{NAME} as a transient prefix command and binds the | 1040 | This macro defines @var{NAME} as a transient prefix command and binds the |
| 1039 | transient's infix and suffix commands. | 1041 | transient's infix and suffix commands. |
| 1040 | 1042 | ||
| @@ -1049,7 +1051,7 @@ explicitly. | |||
| 1049 | 1051 | ||
| 1050 | @var{GROUP}s add key bindings for infix and suffix commands and specify | 1052 | @var{GROUP}s add key bindings for infix and suffix commands and specify |
| 1051 | how these bindings are presented in the popup buffer. At least one | 1053 | how these bindings are presented in the popup buffer. At least one |
| 1052 | @var{GROUP} has to be specified. See @ref{Binding Suffix and Infix Commands}. | 1054 | @var{GROUP} has to be specified. @xref{Binding Suffix and Infix Commands}. |
| 1053 | 1055 | ||
| 1054 | The @var{BODY} is optional. If it is omitted, then @var{ARGLIST} is ignored and | 1056 | The @var{BODY} is optional. If it is omitted, then @var{ARGLIST} is ignored and |
| 1055 | the function definition becomes: | 1057 | the function definition becomes: |
| @@ -1084,11 +1086,12 @@ the branch whose variables are being configured. | |||
| 1084 | @section Binding Suffix and Infix Commands | 1086 | @section Binding Suffix and Infix Commands |
| 1085 | 1087 | ||
| 1086 | The macro @code{transient-define-prefix} is used to define a transient. | 1088 | The macro @code{transient-define-prefix} is used to define a transient. |
| 1087 | This defines the actual transient prefix command (see @ref{Defining Transients}) and adds the transient's infix and suffix bindings, as | 1089 | This defines the actual transient prefix command (@pxref{Defining |
| 1090 | Transients}) and adds the transient's infix and suffix bindings, as | ||
| 1088 | described below. | 1091 | described below. |
| 1089 | 1092 | ||
| 1090 | Users and third-party packages can add additional bindings using | 1093 | Users and third-party packages can add additional bindings using |
| 1091 | functions such as @code{transient-insert-suffix} (see @ref{Modifying Existing Transients}). These functions take a ``suffix specification'' as one of | 1094 | functions such as @code{transient-insert-suffix} (@pxref{Modifying Existing Transients}). These functions take a ``suffix specification'' as one of |
| 1092 | their arguments, which has the same form as the specifications used in | 1095 | their arguments, which has the same form as the specifications used in |
| 1093 | @code{transient-define-prefix}. | 1096 | @code{transient-define-prefix}. |
| 1094 | 1097 | ||
| @@ -1119,10 +1122,13 @@ brackets to do the latter. | |||
| 1119 | Group specifications then have this form: | 1122 | Group specifications then have this form: |
| 1120 | 1123 | ||
| 1121 | @lisp | 1124 | @lisp |
| 1122 | [@{LEVEL@} @{DESCRIPTION@} @{KEYWORD VALUE@}... ELEMENT...] | 1125 | [@{@var{LEVEL}@} @{@var{DESCRIPTION}@} |
| 1126 | @{@var{KEYWORD} @var{VALUE}@}... | ||
| 1127 | @var{ELEMENT}...] | ||
| 1123 | @end lisp | 1128 | @end lisp |
| 1124 | 1129 | ||
| 1125 | The @var{LEVEL} is optional and defaults to 4. See @ref{Enabling and Disabling Suffixes}. | 1130 | The @var{LEVEL} is optional and defaults to 4. @xref{Enabling and |
| 1131 | Disabling Suffixes}. | ||
| 1126 | 1132 | ||
| 1127 | The @var{DESCRIPTION} is optional. If present, it is used as the heading of | 1133 | The @var{DESCRIPTION} is optional. If present, it is used as the heading of |
| 1128 | the group. | 1134 | the group. |
| @@ -1227,7 +1233,9 @@ suffixes''. Here it means the former. | |||
| 1227 | Suffix specifications have this form: | 1233 | Suffix specifications have this form: |
| 1228 | 1234 | ||
| 1229 | @lisp | 1235 | @lisp |
| 1230 | ([LEVEL] [KEY [DESCRIPTION]] COMMAND|ARGUMENT [KEYWORD VALUE]...) | 1236 | ([@var{LEVEL}] |
| 1237 | [@var{KEY} [@var{DESCRIPTION}]] | ||
| 1238 | @var{COMMAND}|@var{ARGUMENT} [@var{KEYWORD} @var{VALUE}]...) | ||
| 1231 | @end lisp | 1239 | @end lisp |
| 1232 | 1240 | ||
| 1233 | @var{LEVEL}, @var{KEY} and @var{DESCRIPTION} can also be specified using the @var{KEYWORD}s | 1241 | @var{LEVEL}, @var{KEY} and @var{DESCRIPTION} can also be specified using the @var{KEYWORD}s |
| @@ -1238,8 +1246,8 @@ the object's values just for the binding inside this transient. | |||
| 1238 | 1246 | ||
| 1239 | @itemize | 1247 | @itemize |
| 1240 | @item | 1248 | @item |
| 1241 | @var{LEVEL} is the suffix level, an integer between 1 and 7. See | 1249 | @var{LEVEL} is the suffix level, an integer between 1 and 7. |
| 1242 | @ref{Enabling and Disabling Suffixes}. | 1250 | @xref{Enabling and Disabling Suffixes}. |
| 1243 | 1251 | ||
| 1244 | @item | 1252 | @item |
| 1245 | @var{KEY} is the key binding, either a vector or key description string. | 1253 | @var{KEY} is the key binding, either a vector or key description string. |
| @@ -1317,7 +1325,7 @@ Note that an infix is a special kind of suffix. Depending on context | |||
| 1317 | ``suffixes'' means ``suffixes (including infixes)'' or ``non-infix | 1325 | ``suffixes'' means ``suffixes (including infixes)'' or ``non-infix |
| 1318 | suffixes''. | 1326 | suffixes''. |
| 1319 | 1327 | ||
| 1320 | @defmac transient-define-suffix name arglist [docstring] [keyword value]... body... | 1328 | @defmac transient-define-suffix name arglist [docstring] [keyword value]@dots{} body@dots{} |
| 1321 | This macro defines @var{NAME} as a transient suffix command. | 1329 | This macro defines @var{NAME} as a transient suffix command. |
| 1322 | 1330 | ||
| 1323 | @var{ARGLIST} are the arguments that the command takes. | 1331 | @var{ARGLIST} are the arguments that the command takes. |
| @@ -1334,7 +1342,7 @@ The infix arguments are usually accessed by using @code{transient-args} | |||
| 1334 | inside @code{interactive}. | 1342 | inside @code{interactive}. |
| 1335 | @end defmac | 1343 | @end defmac |
| 1336 | 1344 | ||
| 1337 | @defmac transient-define-infix name arglist [docstring] [keyword value]... | 1345 | @defmac transient-define-infix name arglist [docstring] [keyword value]@dots{} |
| 1338 | This macro defines @var{NAME} as a transient infix command. | 1346 | This macro defines @var{NAME} as a transient infix command. |
| 1339 | 1347 | ||
| 1340 | @var{ARGLIST} is always ignored (but mandatory never-the-less) and | 1348 | @var{ARGLIST} is always ignored (but mandatory never-the-less) and |
| @@ -1371,7 +1379,7 @@ define your own infix command class. In that case you have to use | |||
| 1371 | value of the @code{:transient} keyword. | 1379 | value of the @code{:transient} keyword. |
| 1372 | @end defmac | 1380 | @end defmac |
| 1373 | 1381 | ||
| 1374 | @defmac transient-define-argument name arglist [docstring] [keyword value]... | 1382 | @defmac transient-define-argument name arglist [docstring] [keyword value]@dots{} |
| 1375 | This macro defines @var{NAME} as a transient infix command. | 1383 | This macro defines @var{NAME} as a transient infix command. |
| 1376 | 1384 | ||
| 1377 | This is an alias for @code{transient-define-infix}. Only use this alias | 1385 | This is an alias for @code{transient-define-infix}. Only use this alias |
| @@ -1848,7 +1856,7 @@ object should not affect later invocations. | |||
| 1848 | @item | 1856 | @item |
| 1849 | All suffix and infix classes derive from @code{transient-suffix}, which in | 1857 | All suffix and infix classes derive from @code{transient-suffix}, which in |
| 1850 | turn derives from @code{transient-child}, from which @code{transient-group} also | 1858 | turn derives from @code{transient-child}, from which @code{transient-group} also |
| 1851 | derives (see @ref{Group Classes}). | 1859 | derives (@pxref{Group Classes}). |
| 1852 | 1860 | ||
| 1853 | @item | 1861 | @item |
| 1854 | All infix classes derive from the abstract @code{transient-infix} class, | 1862 | All infix classes derive from the abstract @code{transient-infix} class, |
| @@ -1862,7 +1870,7 @@ that does not do so. If you do that then you get to implement many | |||
| 1862 | methods. | 1870 | methods. |
| 1863 | 1871 | ||
| 1864 | Also, infixes and non-infix suffixes are usually defined using | 1872 | Also, infixes and non-infix suffixes are usually defined using |
| 1865 | different macros (see @ref{Defining Suffix and Infix Commands}). | 1873 | different macros (@pxref{Defining Suffix and Infix Commands}). |
| 1866 | 1874 | ||
| 1867 | @item | 1875 | @item |
| 1868 | Classes used for infix commands that represent arguments should | 1876 | Classes used for infix commands that represent arguments should |
| @@ -2055,7 +2063,7 @@ probably don't want that. | |||
| 2055 | @code{transient-suffix} and @code{transient-non-suffix} play a part when | 2063 | @code{transient-suffix} and @code{transient-non-suffix} play a part when |
| 2056 | determining whether the currently active transient prefix command | 2064 | determining whether the currently active transient prefix command |
| 2057 | remains active/transient when a suffix or arbitrary non-suffix | 2065 | remains active/transient when a suffix or arbitrary non-suffix |
| 2058 | command is invoked. See @ref{Transient State}. | 2066 | command is invoked. @xref{Transient State}. |
| 2059 | 2067 | ||
| 2060 | @item | 2068 | @item |
| 2061 | @code{refresh-suffixes} Normally suffix objects and keymaps are only setup | 2069 | @code{refresh-suffixes} Normally suffix objects and keymaps are only setup |
| @@ -2101,7 +2109,7 @@ of the same symbol. | |||
| 2101 | 2109 | ||
| 2102 | @item | 2110 | @item |
| 2103 | @code{level} The level of the prefix commands. The suffix commands whose | 2111 | @code{level} The level of the prefix commands. The suffix commands whose |
| 2104 | layer is equal or lower are displayed. See @ref{Enabling and Disabling Suffixes}. | 2112 | layer is equal or lower are displayed. @pxref{Enabling and Disabling Suffixes}. |
| 2105 | 2113 | ||
| 2106 | @item | 2114 | @item |
| 2107 | @code{value} The likely outdated value of the prefix. Instead of accessing | 2115 | @code{value} The likely outdated value of the prefix. Instead of accessing |
| @@ -2134,7 +2142,7 @@ Also see @ref{Suffix Classes}. | |||
| 2134 | @code{command} The command, a symbol. | 2142 | @code{command} The command, a symbol. |
| 2135 | 2143 | ||
| 2136 | @item | 2144 | @item |
| 2137 | @code{transient} Whether to stay transient. See @ref{Transient State}. | 2145 | @code{transient} Whether to stay transient. @xref{Transient State}. |
| 2138 | 2146 | ||
| 2139 | @item | 2147 | @item |
| 2140 | @code{format} The format used to display the suffix in the popup buffer. | 2148 | @code{format} The format used to display the suffix in the popup buffer. |
| @@ -2309,7 +2317,7 @@ the slots documented above, it is a predicate, but it is used for a | |||
| 2309 | different purpose. The value has to be an integer between 1 | 2317 | different purpose. The value has to be an integer between 1 |
| 2310 | and 7. @code{level} controls whether a suffix or a group should be | 2318 | and 7. @code{level} controls whether a suffix or a group should be |
| 2311 | available depending on user preference. | 2319 | available depending on user preference. |
| 2312 | See @ref{Enabling and Disabling Suffixes}. | 2320 | @xref{Enabling and Disabling Suffixes}. |
| 2313 | 2321 | ||
| 2314 | @node FAQ | 2322 | @node FAQ |
| 2315 | @appendix FAQ | 2323 | @appendix FAQ |
diff --git a/lisp/transient.el b/lisp/transient.el index 6f686afd16d..94f7700ddaf 100644 --- a/lisp/transient.el +++ b/lisp/transient.el | |||
| @@ -3,11 +3,9 @@ | |||
| 3 | ;; Copyright (C) 2018-2023 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2018-2023 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Jonas Bernoulli <jonas@bernoul.li> | 5 | ;; Author: Jonas Bernoulli <jonas@bernoul.li> |
| 6 | ;; Homepage: https://github.com/magit/transient | 6 | ;; URL: https://github.com/magit/transient |
| 7 | ;; Keywords: extensions | 7 | ;; Keywords: extensions |
| 8 | |||
| 9 | ;; Version: 0.5.2 | 8 | ;; Version: 0.5.2 |
| 10 | ;; Package-Requires: ((emacs "26.1") (compat "29.1.4.4") (seq "2.24")) | ||
| 11 | 9 | ||
| 12 | ;; SPDX-License-Identifier: GPL-3.0-or-later | 10 | ;; SPDX-License-Identifier: GPL-3.0-or-later |
| 13 | 11 | ||
| @@ -35,7 +33,6 @@ | |||
| 35 | ;;; Code: | 33 | ;;; Code: |
| 36 | 34 | ||
| 37 | (require 'cl-lib) | 35 | (require 'cl-lib) |
| 38 | (require 'compat) | ||
| 39 | (require 'eieio) | 36 | (require 'eieio) |
| 40 | (require 'edmacro) | 37 | (require 'edmacro) |
| 41 | (require 'format-spec) | 38 | (require 'format-spec) |
| @@ -858,6 +855,7 @@ elements themselves.") | |||
| 858 | 855 | ||
| 859 | ;;; Define | 856 | ;;; Define |
| 860 | 857 | ||
| 858 | ;;;###autoload | ||
| 861 | (defmacro transient-define-prefix (name arglist &rest args) | 859 | (defmacro transient-define-prefix (name arglist &rest args) |
| 862 | "Define NAME as a transient prefix command. | 860 | "Define NAME as a transient prefix command. |
| 863 | 861 | ||