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/inhibiting-interaction.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 devdocs/elisp/inhibiting-interaction.html (limited to 'devdocs/elisp/inhibiting-interaction.html') diff --git a/devdocs/elisp/inhibiting-interaction.html b/devdocs/elisp/inhibiting-interaction.html new file mode 100644 index 00000000..e5f23a15 --- /dev/null +++ b/devdocs/elisp/inhibiting-interaction.html @@ -0,0 +1,12 @@ +

Inhibiting Interaction

It’s sometimes useful to be able to run Emacs as a headless server process that responds to commands given over a network connection. However, Emacs is primarily a platform for interactive usage, so many commands prompt the user for feedback in certain anomalous situations. This makes this use case more difficult, since the server process will just hang waiting for user input.

Binding the inhibit-interaction variable to something non-nil makes Emacs signal a inhibited-interaction error instead of prompting, which can then be used by the server process to handle these situations.

Here’s a typical use case:

(let ((inhibit-interaction t))
+  (respond-to-client
+   (condition-case err
+       (my-client-handling-function)
+     (inhibited-interaction err))))
+
+

If my-client-handling-function ends up calling something that asks the user for something (via y-or-n-p or read-from-minibuffer or the like), an inhibited-interaction error is signalled instead. The server code then catches that error and reports it to the client.

+

+ 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/Inhibiting-Interaction.html +

+
-- cgit v1.2.3