branch: externals/transient commit bbf81297c6e3a66aa1f4dd44eebddb4901bb1f13 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
Prevent infix commands from being added to command-history Closes #23. --- docs/transient.org | 13 ++++++------- docs/transient.texi | 13 ++++++------- lisp/transient.el | 36 ++++++++++++++++++------------------ 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/docs/transient.org b/docs/transient.org index b92c7c88a0..8dc9543e57 100644 --- a/docs/transient.org +++ b/docs/transient.org @@ -8,7 +8,7 @@ #+TEXINFO_DIR_CATEGORY: Emacs #+TEXINFO_DIR_TITLE: Transient: (transient). #+TEXINFO_DIR_DESC: Transient Commands -#+SUBTITLE: for version 0.1.0 (v0.1.0-32-g08b4778+1) +#+SUBTITLE: for version 0.1.0 (v0.1.0-39-gb1da0ca+1) #+TEXINFO_DEFFN: t #+OPTIONS: H:4 num:4 toc:2 @@ -37,7 +37,7 @@ Calling a suffix command usually causes the transient to be exited but suffix commands can also be configured to not exit the transient. #+TEXINFO: @noindent -This manual is for Transient version 0.1.0 (v0.1.0-32-g08b4778+1). +This manual is for Transient version 0.1.0 (v0.1.0-39-gb1da0ca+1). #+BEGIN_QUOTE Copyright (C) 2018-2019 Jonas Bernoulli <jo...@bernoul.li> @@ -908,11 +908,10 @@ suffixes". The function definitions is always: #+BEGIN_SRC emacs-lisp - (lambda (obj value) - (interactive - (let ((obj (transient-suffix-object))) - (list obj (transient-infix-read obj)))) - (transient-infix-set obj value) + (lambda () + (interactive) + (let ((obj (transient-suffix-object))) + (transient-infix-set obj (transient-infix-read obj))) (transient--show)) #+END_SRC diff --git a/docs/transient.texi b/docs/transient.texi index 35d93f0781..49f9fe5a2d 100644 --- a/docs/transient.texi +++ b/docs/transient.texi @@ -31,7 +31,7 @@ General Public License for more details. @finalout @titlepage @title Transient User and Developer Manual -@subtitle for version 0.1.0 (v0.1.0-32-g08b4778+1) +@subtitle for version 0.1.0 (v0.1.0-39-gb1da0ca+1) @author Jonas Bernoulli @page @vskip 0pt plus 1filll @@ -65,7 +65,7 @@ Calling a suffix command usually causes the transient to be exited but suffix commands can also be configured to not exit the transient. @noindent -This manual is for Transient version 0.1.0 (v0.1.0-32-g08b4778+1). +This manual is for Transient version 0.1.0 (v0.1.0-39-gb1da0ca+1). @quotation Copyright (C) 2018-2019 Jonas Bernoulli <jonas@@bernoul.li> @@ -1133,11 +1133,10 @@ explicitly. The function definitions is always: @lisp -(lambda (obj value) - (interactive - (let ((obj (transient-suffix-object))) - (list obj (transient-infix-read obj)))) - (transient-infix-set obj value) +(lambda () + (interactive) + (let ((obj (transient-suffix-object))) + (transient-infix-set obj (transient-infix-read obj))) (transient--show)) @end lisp diff --git a/lisp/transient.el b/lisp/transient.el index 48e4b7f21b..ea68131151 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -655,11 +655,10 @@ explicitly. The function definitions is always: - (lambda (obj value) - (interactive - (let ((obj (transient-suffix-object))) - (list obj (transient-infix-read obj)))) - (transient-infix-set obj value) + (lambda () + (interactive) + (let ((obj (transient-suffix-object))) + (transient-infix-set obj (transient-infix-read obj))) (transient--show)) `transient-infix-read' and `transient-infix-set' are generic @@ -802,11 +801,10 @@ example, sets a variable use `define-infix-command' instead. args))) (defun transient--default-infix-command () - (cons 'lambda '((obj value) - (interactive - (let ((obj (transient-suffix-object))) - (list obj (transient-infix-read obj)))) - (transient-infix-set obj value) + (cons 'lambda '(() + (interactive) + (let ((obj (transient-suffix-object))) + (transient-infix-set obj (transient-infix-read obj))) (transient--show)))) (defun transient--ensure-infix-command (obj) @@ -997,17 +995,19 @@ Each suffix commands is associated with an object, which holds additional information about the suffix, such as its value (in the case of an infix command, which is a kind of suffix command). -This function is intended to be called in the interactive form of -infix commands, whose command definition usually (at least when -defined using `define-infix-command') is this: +This function is intended to be called by infix commands, whose +command definition usually (at least when defined using +`define-infix-command') is this: - (lambda (obj value) - (interactive - (let ((obj (transient-suffix-object))) - (list obj (transient-infix-read obj)))) - (transient-infix-set obj value) + (lambda () + (interactive) + (let ((obj (transient-suffix-object))) + (transient-infix-set obj (transient-infix-read obj))) (transient--show)) +\(User input is read outside of `interactive' to prevent the +command from being added to `command-history'. See #23.) + Such commands need to be able to access their associated object to guide how `transient-infix-read' reads the new value and to store the read value. Other suffix commands (including non-infix