For some reason, these slipped my attention. Sorry about that.
Also:
* `nconc' is more efficient then `append' if destructive modification is not
an issue.
* Emacs 26 actually deprecated `string-as-multibyte' in favour of
`decode-coding-string' since the latter actually forces the user to
specify an encoding.
It turns out `file-directory-p' and `file-exists-p' return t when passed
the empty string. This is sort of unexpected, and leads to the logic
in `sclang-make-options' choosing to pass -d and -l with
unpredictable values (default-directory) to sclang.
A default of "" (or -1) is pretty unidiomatic for elisp, so we change
the default of user option `sclang-runtime-directory',
`sclang-library-configuration-file' and `sclang-udp-port' to
nil, and adjust `sclang-make-options' accordingly. While we're here,
we can eliminate the use of `cl-flet'.
Additionally, `sclang-eval-sync' uses `find' which is really an
alias for `cl-find' which and can be replaced with a call to the built-in
function `assoc'. This is faster, and the last dependency on the
cl package, which we can now remove (obsolete since emacs 27).
Symptom: (sclang-eval-sync "\"ö\"") evaluates to "ö"
After this patch: (sclang-eval-sync "\"ö\"") => "ö"
This was tricky to figure out, so here is a bit of background.
scel uses a so-called command FIFO to send (amongst other things) evaluation
results to Emacs. This FIFO uses a pascal-string (32bit string length
followed by character data) to send Lisp to Emacs. The command process
coding system is already set to 'no-conversion on the Emacs side
to avoid crippling the int32 at the beginning of every string.
However, the read-from-string call in sclang-command-process-filter
implicitly converts the unibyte string received from the process to
a multibyte string, without doing proper conversion.
The right function to use here is string-as-multibyte, which does
the correct conversion.
When sclang recompiled the class library, it would close its writing
end of the fifo, which in turn would trigger fifo deletion in scel.
This starts a dummy cat process with output redirected to the fifo,
so as to keep the fifo open as long as we desire.
scel is modified to support in-process library recompilation. the key
binding has slightly been changed:
C-c C-l - recompile the library
C-c C-o - restart the interpreter
Signed-off-by: Tim Blechmann <tim@klingt.org>