diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2026-03-05 22:44:49 +0100 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2026-03-05 22:44:49 +0100 |
| commit | 0e65f5dae7fca40a49eaf3c1cf0ee66c440e11b2 (patch) | |
| tree | 5cb2d1ac8670e12d485f8b72fc7634431980f34d /lisp/transient.el | |
| parent | ecb2005d2e6c0584c864429879f641034fbc7be5 (diff) | |
transient-read-string-from-buffer: New function
Diffstat (limited to 'lisp/transient.el')
| -rw-r--r-- | lisp/transient.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/transient.el b/lisp/transient.el index b3b6646..e791fb4 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) |
