scm: implement blocking / non-blocking modes
Implement running the REPL on background thread. That way, we can _share_ the store&.
This commit is contained in:
@ -107,6 +107,7 @@ Indices
|
||||
* Starting the REPL::
|
||||
* Listening on a Unix Domain Socket::
|
||||
* Hooking up with GNU/Emacs and Geiser::
|
||||
* Hooking up with Mu4e::
|
||||
@end menu
|
||||
|
||||
This chapter walks you through the installation and basic setup.
|
||||
@ -183,19 +184,19 @@ REPL over a Unix domain socket, using the @t{--listen} flag.
|
||||
When you start @command{mu scm} with the @t{--listen} flag, it prints a
|
||||
(randomized) UNIX domain socket name and blocks after that; for instance:
|
||||
@example
|
||||
$mu scm --listen
|
||||
UNIX-CONNECT:/run/user/1000/mu-scm-socket-6ef6222e
|
||||
$ mu scm --listen
|
||||
/run/user/1000/mu-scm-15269.sock
|
||||
@end example
|
||||
|
||||
You can connect to this with exernal tools, for instance with @command{socat}:
|
||||
You can connect to this with external tools, for instance with @command{socat}:
|
||||
@example
|
||||
socat - UNIX-CONNECT:/run/user/1000/mu-scm-socket-6ef6222e
|
||||
$ socat - UNIX-CONNECT:/run/user/1000/mu-scm-15269.sock
|
||||
GNU Guile 3.0.9
|
||||
Copyright (C) 1995-2023 Free Software Foundation, Inc.
|
||||
|
||||
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
|
||||
This program is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `,show c' for details.
|
||||
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This
|
||||
program is free software, and you are welcome to redistribute it under certain
|
||||
conditions; type `,show c' for details.
|
||||
|
||||
Enter `,help' for help.
|
||||
scheme@@(guile-user)>
|
||||
@ -216,7 +217,7 @@ domain socket, as discussed in @xref{Listening on a Unix Domain Socket}.
|
||||
Assuming you have installed the @t{guile-geiser} package, the following snippet
|
||||
makes that easy:
|
||||
@lisp
|
||||
(require 'guiser-guile)
|
||||
(require 'geiser-guile)
|
||||
|
||||
(defvar mu-scm-listen-command "mu scm --listen"
|
||||
"mu command to start an scm repl listening on a socket.")
|
||||
@ -229,13 +230,32 @@ Connect to mu's scm (guile) interface through Geiser."
|
||||
:name "*mu-scm-repl*"
|
||||
:command `("sh" "-c" ,mu-scm-listen-command)
|
||||
:filter (lambda (_proc chunk)
|
||||
(when (string-match "^UNIX-CONNECT:\\(.*\\)$" chunk)
|
||||
(when (stringng-match "^\\(mu-scm.*\\.sock\\)$" chunk)
|
||||
(geiser-connect-local 'guile (match-string 1 chunk))))))
|
||||
@end lisp
|
||||
|
||||
After evaluating this, you can use @command{M-x mu-scm-geiser-connect} to start
|
||||
the REPL, with all the Geiser bells & whistles.
|
||||
|
||||
@node Hooking up with Mu4e
|
||||
@section Hooking up with Mu4e
|
||||
@cindex Mu4e
|
||||
|
||||
If you use @t{mu4e}, connecting to the SCM server is even easier than with
|
||||
``plain'' Emacs.
|
||||
|
||||
First tell @t{mu4e} to starts it server with with @t{--listen} parameter:
|
||||
@lisp
|
||||
(setq mu4e-mu-scm-server t)
|
||||
@end lisp
|
||||
After that, (re)start @t{mu4e}.
|
||||
|
||||
Now should be able to connect to the REPL using @t{M-x mu4e-mu-scm-repl}. Like
|
||||
@ref{Hooking up with GNU/Emacs and Geiser}, this depends on the @t{geiser-guile}
|
||||
package.
|
||||
|
||||
The SCM instance uses the same database/store instance that @t{mu4e} uses.
|
||||
|
||||
@node Shell
|
||||
@chapter Shell
|
||||
|
||||
|
||||
Reference in New Issue
Block a user