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.
What I've done to fix this:
- add a sclang-class-list variable in sclang-language.el, which is a
list of all the classes known to sclang. this is populated when
sclang starts.
- update sclang-font-lock-class-keyword-matcher in
sclang-mode.el. since the sclang-class-name-regexp now will match
all words that start with a capital letter (see next bullet point
for that change), this function had to be updated to check to make
sure that the word starting with a capital letter is in the list of
classes. if it is, then we know it's a class and it gets
highlighted. if it's not, then it's just something the user typed
with a capital letter, so we don't highlight it.
- update sclang-update-font-lock in sclang-mode.el. instead of
generating a huge regexp from a list of all the classes in
SuperCollider, just run the normal fontification from that
function. this avoids making the regexp too big and thus prevents
fontification from failing.
Sublime Text syntax grammar does not do multi-line matching,
so all editors that use this (including Atom and its symbol matching)
cannot detect classes defined as
MyClass
{
}
This also makes all classes in the class lib consistent in style which is nice
for everybody.
`(force-mode-line-update)` updates only the mode-line of the current buffers. Providing a non-nil argument updates the mode-line of all buffers. This is particularly useful when having a split view with the server buffer and another buffer where current buffer is not the server buffer. (probably a very common use case).
This merges the Document and ScIDEDocument classes. This should improve readability and maintainability, and simplifies the implementation. As part of this:
- some duplicate methods are deprecated
- the previous Document has been copied into the scel folder to avoid breaking EmacsDocument
Signed-off-by: Scott Wilson <i@scottwilson.ca>
This library is part of Emacs. Bundling it in the same directory as
the sclang*.el libraries will put it on the load-path. The bundled
version then shadows the newer version which is part of Emacs, which
can cause hard to detect problems.
scel currently uses method overwrites to control the IDE gui. this can be
avoided by using actions, which can be set in order to override the default
behavior
Signed-off-by: Tim Blechmann <tim@klingt.org>
UI.registerForShutdown has the same semantics as ShutDown.add. we only
need one functionality like this, so this patch deprecates it.
Signed-off-by: Tim Blechmann <tim@klingt.org>