[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/with-simulated-input ad9eaf2252 014/134: Add info on idle
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/with-simulated-input ad9eaf2252 014/134: Add info on idle simulation to README |
Date: |
Mon, 10 Jan 2022 23:00:00 -0500 (EST) |
branch: elpa/with-simulated-input
commit ad9eaf2252ddff3f1bc43dffdcd7a555a33c569a
Author: Ryan C. Thompson <rct@thompsonclan.org>
Commit: Ryan C. Thompson <rct@thompsonclan.org>
Add info on idle simulation to README
---
README.md | 36 +++++++++++++++++++++++++++++-------
1 file changed, 29 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 08b6d2d42c..b670322549 100644
--- a/README.md
+++ b/README.md
@@ -3,13 +3,12 @@
[](https://travis-ci.org/DarwinAwardWinner/with-simulated-input)
<!-- (Not in MELPA yet) [](https://stable.melpa.org/#/with-simulated-input)
-->
-This package provides a single Emacs Lisp macro,
-`with-simulated-input`, which evaluates one or more forms while
-simulating a sequence of input events for those forms to read. The
-result is the same as if you had evaluated the forms and then manually
-typed in the same input. This macro is useful for non-interactive
-testing of normally interactive commands and functions, such as
-`completing-read`.
+This package provides an Emacs Lisp macro, `with-simulated-input`,
+which evaluates one or more forms while simulating a sequence of input
+events for those forms to read. The result is the same as if you had
+evaluated the forms and then manually typed in the same input. This
+macro is useful for non-interactive testing of normally interactive
+commands and functions, such as `completing-read`.
For example:
@@ -21,6 +20,29 @@ For example:
This would return the string `"hello world"`.
+## Simulating idleness
+
+Some interactive functions rely on idle timers to do their work, so
+you might need a way to simulate idleness. For that, there is the
+`wsi-simulate-idle-time` function. You can insert calls to this
+function in between input strings. For example, the following code
+will return `"hello world"`.
+
+```elisp
+;; Insert "world" after 500 seconds
+(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")
+ (read-string "Enter a string: "))
+```
+
+Note that this code only *pretends* to be idle for 501 seconds. It
+actually runs immediately.
+
+In fact, you can put any lisp code in between input strings
+in this way.
+
<!-- Get it from MELPA: https://stable.melpa.org/#/with-simulated-input -->
## Running the tests
- [nongnu] elpa/with-simulated-input 2a83333b6d 121/134: Update the edebug spec to include characters, (continued)
- [nongnu] elpa/with-simulated-input 2a83333b6d 121/134: Update the edebug spec to include characters, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 166a00980a 131/134: Remove some unused test code, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 6f338aeaed 003/134: Add a README, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 5a67067ae0 002/134: Initial version, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 4fec23e53b 001/134: Inital empty commit, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 9a2ba67eba 009/134: Switch to using buttercup as the test suite, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 9d7afd6e6c 007/134: Delete some extraneous whitespace, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 322dc7ed95 008/134: Add some more tests, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 4c68e02cc1 010/134: Allow evaluating lisp forms while simulating input, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 5701347987 013/134: Update the readme with new instructions for running tests, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input ad9eaf2252 014/134: Add info on idle simulation to README,
ELPA Syncer <=
- [nongnu] elpa/with-simulated-input 4932368712 016/134: Add MELPA links, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 33b40e59a1 018/134: Fix indentation, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 004218b75c 023/134: Add more info to docstring for wsi-simulated-idle-time, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 395a985348 026/134: Use gensym to generate the canary symbol, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input e66a24d067 031/134: Add Makefile and code coverage, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 1012ccbec7 033/134: Convert defadvice to advice-add, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input d0f7795942 034/134: Update buttercup, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input af9a38ce28 036/134: Add LICENSE file, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 3b847dec31 037/134: Add tests for wsi-get-unbound-key, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input a718d66c5d 039/134: Don't generate a new canary for each call, ELPA Syncer, 2022/01/10