Skip to content

Commit 43ef19b

Browse files
committed
docs: Replace turtles-send-keys etc. with :keys etc. in the docs.
1 parent 7dd77fc commit 43ef19b

File tree

3 files changed

+92
-135
lines changed

3 files changed

+92
-135
lines changed

docs/source/reference.rst

Lines changed: 23 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -271,64 +271,42 @@ Minibuffer
271271
- calls to :code:`turtles-with-grab-buffer` to test the content of
272272
the minibuffer or any other window.
273273

274-
- keys passed to the minibuffer, with :code:`turtles-input-keys`
274+
- keys passed to the minibuffer, with :keys, see below.
275275

276276
- commands that manipulate the minibuffer, either called directly
277-
or using :code:`turtles-input-command`
277+
or using :command, see below.
278278

279279
At the end of BODY, the minibuffer is closed, if needed, and
280280
control returns to READ, which checks the result of running BODY.
281281

282-
See the :ref:`tut_minibuffer` and :ref:`tut_isearch` sections of
283-
the tutorial for usage examples.
284-
285-
.. _input:
286-
287-
Input Events
288-
------------
289-
290-
.. index::
291-
pair: function; turtles-input-keys
292-
pair: function; turtles-input-events
293-
pair: function; turtles-input-command
282+
Special forms are available within BODY to simulate the user inputing
283+
events using the command loop. In contrast to :code:`execute-kbd-macro`,
284+
:code:`ert-simulate-commands` and :code:`ert-simulate-keys`, these
285+
function use the real event loop, triggered by real, external events
286+
(terminal keys). This isn't as simulation.
294287

295-
The following functions send events to the Emacs instance to be
296-
processed using the normal event loop.
288+
:keys keys
289+
This expression provides KEYS as user input to the minibuffer.
297290

298-
In contrast to :code:`execute-kbd-macro`,
299-
:code:`ert-simulate-commands` and :code:`ert-simulate-keys`, these
300-
function use the real event loop, triggered by real, external events
301-
(terminal keys). This isn't as simulation. In most cases, the
302-
difference doesn't matter, of course.
291+
KEYS is in the same format as passed to :code:`kbd`.
303292

304-
These functions all use :code:`recursive-edit` to make it possible to
305-
handle events directly from ERT tests.
293+
:events events
294+
This expression provides a vector of events as the user input
295+
to the minibuffer.
306296

307-
(turtles-input-keys keys) : function
308-
This function provides KEYS as user input to the current instance.
297+
This is more general than the previous function as the events
298+
can be any kind of UI events.
309299

310-
KEYS is in the same format as passed to :code:`kbd`.
300+
:command command
301+
This expression runs the given interactive command in the event
302+
loop, triggered by a key stroke.
311303

312-
(turtles-input-events events) : function
313-
This function provides a vector of events as the user input to the
314-
current instance.
304+
:command-with-keybinding keybinding command
305+
This expression works as above, but makes sure that the command
306+
will find in :code:`(this-command-keys)`, if it asks.
315307

316-
This is more general than the previous function as the events can
317-
be any kind of UI events.
318-
319-
(turtles-input-command command &optional keybinding) : function
320-
This function runs the given interactive command in the event
321-
loop, triggered by a key stroke.
322-
323-
If provided, keybinding is what what the command will find in
324-
:code:`(this-command-keys)`, if it asks.
325-
326-
This is implemented using a transient map, so the key binding is
327-
only available for one call.
328-
329-
Note that in the majority of cases, calling the command directly,
330-
outside of the event loop, works just fine in tests and is more
331-
convenient.
308+
See the :ref:`tut_minibuffer` and :ref:`tut_isearch` sections of
309+
the tutorial for usage examples.
332310

333311
.. _instances:
334312

docs/source/tutorial.rst

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ This second example illustrates the use of
178178
(turtles-with-grab-buffer (:name "initial prompt" :point "<>")
179179
(should (equal "Choose: <>" (buffer-string))))
180180
181-
(turtles-input-keys "Ch TAB")
181+
:keys "Ch TAB"
182182
(turtles-with-grab-buffer (:name "completion" :point "<>")
183183
(should (equal "Choose: Choice <>" (buffer-string))))
184184
185-
(turtles-input-keys "B")))))
185+
:keys "B"))))
186186
187187
188188
:code:`turtles-with-minibuffer` takes as argument two separate sections, as shown below:
@@ -226,15 +226,16 @@ that manually; it's just convenient to see the content and the
226226
position of the point in the same string.
227227

228228
This test interacts with :code:`completing-read` by simulating the
229-
user typing some text and pressing :kbd:`TAB`. It uses
230-
:ref:`turtles-input-keys <input>` for that, which simulates the user
231-
typing some keys.
229+
user typing some text and pressing :kbd:`TAB`. It uses :ref:`:keys
230+
<minibuffer>` for that, which instructs the macro
231+
:code:`turtles-with-minibuffer` to simulates the user typing some
232+
keys.
232233

233234
The test could have called the command :kbd:`TAB` corresponds to directly:
234235

235236
.. code-block:: elisp
236237
237-
(turtles-input-keys "Ch")
238+
:keys "Ch"
238239
(minibuffer-complete)
239240
(turtles-with-grab-buffer (:name "completion" :point "<>")
240241
(should (equal "Choose: Choice <>" (buffer-string))))
@@ -244,13 +245,13 @@ clearer than going through key bindings, and in most cases, it works well.
244245

245246
Some commands that rely on the specific environment provided by the
246247
command loop won't work if called directly.
247-
:ref:`turtles-input-command <input>` can help with such commands,
248-
though it's just overkill here:
248+
:ref:`:command <minibuffer>` can help with such commands,
249+
though it might be considered overkill here:
249250

250251
.. code-block:: elisp
251252
252-
(turtles-input-keys "Ch")
253-
(turtles-input-command #'minibuffer-complete)
253+
:keys "Ch"
254+
:command #'minibuffer-complete
254255
(turtles-with-grab-buffer (:name "completion" :point "<>")
255256
(should (equal "Choose: Choice <>" (buffer-string))))
256257
@@ -277,16 +278,16 @@ isearch still works with :code:`turtles-with-minibuffer`.
277278
(goto-char (point-min))
278279
279280
(turtles-with-minibuffer
280-
(isearch-forward nil 'no-recursive-edit)
281+
(isearch-forward)
281282
282-
(turtles-input-keys "baa")
283+
:keys "baa"
283284
(turtles-with-grab-buffer (:minibuffer t)
284285
(should (equal "I-search: baa" (buffer-string))))
285286
(turtles-with-grab-buffer (:buf testbuf :name "match 1" :faces '((isearch "[]")))
286287
(should (equal "[Baa], baa, black sheep, have you any wool?"
287288
(buffer-string))))
288289
289-
(turtles-input-keys "\C-s")
290+
:keys "\C-s"
290291
(turtles-with-grab-buffer (:buf testbuf :name "match 2" :faces '((isearch "[]")))
291292
(should (equal "Baa, [baa], black sheep, have you any wool?"
292293
(buffer-string))))

0 commit comments

Comments
 (0)