emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/with-simulated-input 39dbadff0b 120/134: Update the README


From: ELPA Syncer
Subject: [nongnu] elpa/with-simulated-input 39dbadff0b 120/134: Update the README to reflect current supported syntax
Date: Mon, 10 Jan 2022 23:00:12 -0500 (EST)

branch: elpa/with-simulated-input
commit 39dbadff0bc9827e423c4d40b480a934a71f4f98
Author: Ryan C. Thompson <rct@thompsonclan.org>
Commit: Ryan C. Thompson <rct@thompsonclan.org>

    Update the README to reflect current supported syntax
---
 README.md | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index f3f95e72ff..b0e9c6928c 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ For example:
 ```elisp
 (with-simulated-input
     "hello SPC world RET"
-  (read-string "Say hello: "))
+  (read-string "Say hello to the world: "))
 ```
 
 This would return the string `"hello world"`.
@@ -30,11 +30,16 @@ simulated interaction. For example, we can use Emacs Lisp 
code to
 enter "world" after entering "hello" via key sequence:
 
 ```elisp
-(with-simulated-input
-    '("hello SPC" (insert "world") "RET")
-  (read-string "Say hello: "))
+(let ((thing-to-greet "world"))
+  (with-simulated-input
+      ("hello SPC" (insert thing-to-greet) "RET")
+    (read-string "Say hello: ")))
 ```
 
+Note that the return values of any forms in the input list are
+ignored. Only the side effects matter. In this case, the side effect
+of `insert` is to insert "world" into the minibuffer.
+
 ## Simulating idleness
 
 Some interactive functions rely on idle timers to do their work, so
@@ -47,15 +52,13 @@ will return `"hello world"`.
 (run-with-idle-timer 500 nil 'insert "world")
 (with-simulated-input
     ;; Type "hello ", then "wait" 501 seconds, then type "RET"
-    '("hello SPC" (wsi-simulate-idle-time 501) "RET")
+    ("hello SPC" (wsi-simulate-idle-time 501) "RET")
   (read-string "Enter a string: "))
 ```
 
 Note that the example code above only *pretends* to be idle for 501
 seconds. It actually runs immediately.
 
-Get it from MELPA: https://stable.melpa.org/#/with-simulated-input
-
 ## Running the tests
 
 This package comes with a test suite. If you want to run it yourself,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]