branch: externals/transient
commit 0e65f5dae7fca40a49eaf3c1cf0ee66c440e11b2
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
transient-read-string-from-buffer: New function
---
lisp/transient.el | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/lisp/transient.el b/lisp/transient.el
index b3b66464d9..e791fb4604 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -4097,6 +4097,20 @@ stand-alone command."
(when (fboundp 'org-read-date)
(org-read-date 'with-time nil nil prompt default-time)))
+(static-if (fboundp 'string-edit) ; since Emacs 29.1
+ (defun transient-read-string-from-buffer (prompt value _)
+ "Switch to a new buffer to edit STRING in a recursive edit.
+Like `read-string-from-buffer' but accept an additional argument as
+provided by `transient-infix-read' (but ignore it). Only available
+when using Emacs 29.1 or greater."
+ (string-edit prompt (or value "")
+ (lambda (edited)
+ (setq value edited)
+ (exit-recursive-edit))
+ :abort-callback #'exit-recursive-edit)
+ (recursive-edit)
+ value))
+
;;;; Prompt
(cl-defgeneric transient-prompt (obj)