Function: read-string-from-buffer

read-string-from-buffer is an autoloaded and byte-compiled function defined in string-edit.el.gz.

Signature

(read-string-from-buffer PROMPT STRING)

Documentation

Switch to a new buffer to edit STRING in a recursive edit.

The user finishes editing with M-x string-edit-done (string-edit-done), or aborts with M-x string-edit-abort (string-edit-abort).

Insert PROMPT at the start of the buffer. If nil, no prompt is inserted.

When the user exits recursive edit, return the contents of the buffer (without including PROMPT).

Also see string-edit.

View in manual

Probably introduced at or before Emacs version 29.1.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/string-edit.el.gz
;;;###autoload
(defun read-string-from-buffer (prompt string)
  "Switch to a new buffer to edit STRING in a recursive edit.
The user finishes editing with \\<string-edit-mode-map>\\[string-edit-done], or aborts with \\<string-edit-mode-map>\\[string-edit-abort].

Insert PROMPT at the start of the buffer.  If nil, no prompt is
inserted.

When the user exits recursive edit, return the contents of the
buffer (without including PROMPT).

Also see `string-edit'."
  (string-edit
   prompt
   string
   (lambda (edited)
     (setq string edited)
     (exit-recursive-edit))
   :abort-callback (lambda () (throw 'exit "Aborted edit")))
  (recursive-edit)
  string)