@@ -588,7 +588,21 @@ nil.
588588
589589Two macros are provided that fully control how the terminal frame is
590590grabbed and fully-processed: @code {turtles-with-grab-buffer } and
591- @code {turtles-to-string }:
591+ @code {turtles-to-string }, described below.
592+ 
593+ All function that grab the terminal frame must be called from within a
594+ secondary instance, that is, after below @code {(turtles-ert-test) } in
595+ an ERT test.
596+ 
597+ When grabbing the terminal frame, the content of the current buffer is
598+ replaced with a copy of the terminal data, with the point set at the
599+ position of the cursor.
600+ 
601+ In that buffer, color and similar text attributes are available as a
602+ ‘face text property. Starting with Emacs 29.1, the terminal supports
603+ 24bit colors, but older Emacs versions must do with 16 or even 8
604+ colors. This usually doesn’t matter as it’s more convenient to check
605+ for faces rather than colors, see the :faces key argument below.
592606
593607
594608@table  @asis 
@@ -818,6 +832,10 @@ trailing newlines at the end of the current buffer.
818832
819833This macro tests minibuffer or recursive-edit interactions.
820834
835+ This macro is meant to be called from within a secondary instance,
836+ that is, after below @code {(turtles-ert-test) } in an ERT
837+ test.
838+ 
821839The READ section is a single sexp that calls a function that runs
822840on the minibuffer or within a recursive-edit. When this function
823841returns, the macro ends and returns the result of evaluating READ.
@@ -924,8 +942,17 @@ instances run the same version of Emacs with the same
924942@code {load-path }, in vanilla mode, without configuration.
925943
926944The secondary Emacs instances are run within a hidden
927- @code {term-mode } buffer, which is grabbed upon request and sent to
928- the instances.
945+ @code {term-mode } buffer. Such buffers are called ”
946+ `turtles-term-<instance-name>'” (note the space). You may switch to
947+ that buffer to interact directly with the Emacs instance. To see
948+ colors, rename it; Emacs doesn’t bother processing ‘font-lock-face in
949+ hidden buffers.
950+ 
951+ While secondary instances can be interacted with from that buffer, it
952+ is awkward, as the two Emacs instances use the same keybindings. You
953+ might be happier calling @ref {1b ,,turtles-new-frame-in-instance },
954+ if you’re running in a windowing environment, or otherwise call
955+ @ref {d ,,turtles-instance-eval }.
929956
930957The main Emacs process communicates with the secondary instances using
931958socket communication described in the @ref {17 ,,next  section }. On
@@ -934,19 +961,17 @@ communicate with the server through RPCs.
934961
935962There can be multiple secondary instances, identified by a symbol,
936963their ID. Instances with different ids have different characteristics,
937- defined by @code {turtles-definstance }, described below.
938- 
939- Turtles defines one shared instance in a 80x25 terminal whose ID is
940- ‘default. This is the instance used by ERT tests unless specified
941- otherwise.
964+ defined by @code {turtles-definstance }, described below. Turtles
965+ defines one shared instance in a 80x25 terminal whose ID is ‘default.
966+ This is the instance used by ERT tests unless specified otherwise.
942967
943968Secondary instances can be started and stopped independently using
944969@code {turtles-start-instance } and @code {turtles-stop-instance }, and
945970communicated with using @code {turtles-instance-eval }.
946971
947- When developing , the versions of elisp libraries might get out of sync 
948- between the main Emacs process and secondary instances. In such a
949- case, the simplest thing to do is to restart the  instances with
972+ During development , the versions of elisp libraries might get out of
973+ sync  between the main Emacs process and secondary instances. In such a
974+ case, the simplest thing to do is to restart all live  instances with
950975@code {turtles-restart }.
951976
952977
@@ -1058,6 +1083,14 @@ This function waits for the evaluation to finish and returns the
10581083result of that evaluation. If that evaluation is likely to take
10591084time, set TIMEOUT to a value longer than the default 10s.
10601085
1086+ This function provides a convenient way to probe the internals of
1087+ an Emacs instance from the comfort of the main Emacs process.
1088+ 
1089+ For example, if you want to see what buffers are opened in the
1090+ secondary emacs instance, you can run @code {M-x  eval-expression }
1091+ and evaluate @code {(turtles-instance-eval  'default 
1092+ '(buffer-list)) }.
1093+ 
10611094@item  (turtles-start-instance inst-or-id) : command
10621095
10631096Start the given instance, unless it is already started.
0 commit comments