From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/elisp/object-from-minibuffer.html | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 devdocs/elisp/object-from-minibuffer.html (limited to 'devdocs/elisp/object-from-minibuffer.html') diff --git a/devdocs/elisp/object-from-minibuffer.html b/devdocs/elisp/object-from-minibuffer.html new file mode 100644 index 00000000..64877f98 --- /dev/null +++ b/devdocs/elisp/object-from-minibuffer.html @@ -0,0 +1,46 @@ +

Reading Lisp Objects with the Minibuffer

This section describes functions for reading Lisp objects with the minibuffer.

Function: read-minibuffer prompt &optional initial +
+

This function reads a Lisp object using the minibuffer, and returns it without evaluating it. The arguments prompt and initial are used as in read-from-minibuffer.

This is a simplified interface to the read-from-minibuffer function:

(read-minibuffer prompt initial)
+≡
+(let (minibuffer-allow-text-properties)
+  (read-from-minibuffer prompt initial nil t))
+
+

Here is an example in which we supply the string "(testing)" as initial input:

(read-minibuffer
+ "Enter an expression: " (format "%s" '(testing)))
+
+;; Here is how the minibuffer is displayed:
+
+ +
---------- Buffer: Minibuffer ----------
+Enter an expression: (testing)∗
+---------- Buffer: Minibuffer ----------
+
+

The user can type RET immediately to use the initial input as a default, or can edit the input.

+
+
Function: eval-minibuffer prompt &optional initial +
+

This function reads a Lisp expression using the minibuffer, evaluates it, then returns the result. The arguments prompt and initial are used as in read-from-minibuffer.

This function simply evaluates the result of a call to read-minibuffer:

(eval-minibuffer prompt initial)
+≡
+(eval (read-minibuffer prompt initial))
+
+
+
Function: edit-and-eval-command prompt form +
+

This function reads a Lisp expression in the minibuffer, evaluates it, then returns the result. The difference between this command and eval-minibuffer is that here the initial form is not optional and it is treated as a Lisp object to be converted to printed representation rather than as a string of text. It is printed with prin1, so if it is a string, double-quote characters (‘"’) appear in the initial text. See Output Functions.

In the following example, we offer the user an expression with initial text that is already a valid form:

(edit-and-eval-command "Please edit: " '(forward-word 1))
+
+;; After evaluation of the preceding expression,
+;;   the following appears in the minibuffer:
+
+ +
---------- Buffer: Minibuffer ----------
+Please edit: (forward-word 1)∗
+---------- Buffer: Minibuffer ----------
+
+

Typing RET right away would exit the minibuffer and evaluate the expression, thus moving point forward one word.

+
+
+

+ Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
+ https://www.gnu.org/software/emacs/manual/html_node/elisp/Object-from-Minibuffer.html +

+
-- cgit v1.2.3