Skip to content

Commit 9392c1a

Browse files
russtokuOlical
authored andcommittedJul 11, 2023
Make snd-s7 client optional. Add help doc.
1 parent ad574db commit 9392c1a

File tree

5 files changed

+92
-45
lines changed

5 files changed

+92
-45
lines changed
 

‎doc/conjure-client-snd-s7-stdio.txt

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
2+
*conjure-client-snd-s7-stdio*
3+
4+
==============================================================================
5+
CONTENTS *conjure-client-snd-s7-stdio-contents*
6+
7+
1. Introduction ............ |conjure-client-snd-s7-stdio-introduction|
8+
2. Mappings .................... |conjure-client-snd-s7-stdio-mappings|
9+
3. Configuration .......... |conjure-client-snd-s7-stdio-configuration|
10+
11+
==============================================================================
12+
INTRODUCTION *conjure-client-snd-s7-stdio-introduction*
13+
>
14+
Snd is a sound editor created by Bill Schottstaedt <bil@ccrma.stanford.edu>
15+
of the Center for Computer Research in Music and Acoustics (CCRMA). It can
16+
be scripted or extended using the S7 Scheme interpreter built into it. In
17+
this document, snd-s7 is used to refer to the program which is named snd.
18+
19+
Conjure starts a snd-s7 REPL within Neovim when you first open a snd-s7
20+
(`.scm`) file. You can configure how the snd-s7 REPL is launched with the
21+
`g:conjure#client#snd-s7#stdio#command` configuration option.
22+
23+
You should be able to evaluate files and forms as you would with other Conjure
24+
supported languages right away.
25+
26+
Check out `:ConjureSchool` if you're unsure about what evaluation operations
27+
you can perform.
28+
29+
* https://ccrma.stanford.edu/software/snd/snd/snd.html
30+
* https://ccrma.stanford.edu/software/snd/snd/s7.html
31+
* https://ccrma.stanford.edu/
32+
33+
==============================================================================
34+
MAPPINGS *conjure-client-snd-s7-stdio-mappings*
35+
36+
These mappings are the defaults, you can change them as described in
37+
|conjure-mappings| and |conjure-configuration|.
38+
39+
See |conjure-client-snd-s7-stdio-configuration| for specific configuration
40+
options relevant to these mappings.
41+
42+
<localleader>cs Start the snd-s7 REPL if it's not running already.
43+
44+
<localleader>cS Stop any existing snd-s7 REPL.
45+
46+
<localleader>ei Interrupt running command. Same as pressing Ctrl-C
47+
in a cmdline REPL. This may actually stop the REPL.
48+
49+
==============================================================================
50+
CONFIGURATION *conjure-client-snd-s7-stdio-configuration*
51+
52+
All configuration can be set as described in |conjure-configuration|.
53+
54+
*g:conjure#client#snd-s7#stdio#mapping#start*
55+
`g:conjure#client#snd-s7#stdio#mapping#start`
56+
Start the snd-s7 REPL if it's not running already.
57+
Default: `"cs"`
58+
59+
*g:conjure#client#snd-s7#stdio#mapping#stop*
60+
`g:conjure#client#snd-s7#stdio#mapping#stop`
61+
Stop any existing snd-s7 REPL.
62+
Default: `"cS"`
63+
64+
*g:conjure#client#snd-s7#stdio#command*
65+
`g:conjure#client#snd-s7#stdio#command`
66+
Command used to start the snd-s7 REPL, you can modify this to add
67+
arguments or change the command entirely.
68+
69+
When using a different REPL you'll probably have to change the
70+
`prompt_pattern` too! Have a look at the default REPL output and
71+
write a Lua pattern that will match that prompt string as best as
72+
you can.
73+
74+
Default: `"snd"`
75+
76+
*g:conjure#client#snd-s7#stdio#prompt_pattern*
77+
`g:conjure#client#snd-s7#stdio#prompt_pattern`
78+
This is not used by this client module.
79+
Default: `"> "`
80+
81+
vim:tw=78:sw=2:ts=2:ft=help:norl:et:listchars=

‎doc/conjure.txt

+5-2
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,10 @@ configuring these values from Lua it's just `true` and `false`.
294294
`g:conjure#filetype#scheme`
295295
Client to use for `scheme` buffers. You can use Guile over a
296296
socket file instead by setting this to
297-
`"conjure.client.guile.socket"`.
298-
Help: |conjure-client-scheme-stdio|, |conjure-client-guile-socket|
297+
`"conjure.client.guile.socket"`. To edit scripts for the snd/s7
298+
sound editor, set this to `"conjure.client.snd-s7.stdio"`.
299+
Help: |conjure-client-scheme-stdio|,
300+
|conjure-client-guile-socket|, or |conjure-client-snd-s7-stdio.
299301
Default: `"conjure.client.scheme.stdio"`
300302

301303
*g:conjure#filetype#racket*
@@ -912,6 +914,7 @@ your dotfiles.
912914
- |conjure-client-julia-stdio|
913915
- |conjure-client-lua-stdio|
914916
- |conjure-client-python-stdio|
917+
- |conjure-client-snd-s7-stdio|
915918
- |conjure-client-sql-stdio|
916919
- |conjure-client-rust-evcxr|
917920
- |conjure-client-common-lisp-swank|

‎fnl/conjure/client/snd-s7/stdio.fnl

+4-40
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
;; Based on: fnl/conjure/client/scheme/stdio.fnl
55
;; fnl/conjure/client/sql/stdio.fnl
66
;;
7+
;; Uses fnl/conjure/remote/stdio-rt.fnl; not fnl/conjure/remote/stdio.fnl.
8+
;;
79
;; The `snd` program should be runnable on the command line.
810
;;
911
;; NOTE: Conflicts with the Scheme client due to the same filetype suffix.
10-
;; For testing the proof-of-concept, this client replaces the Scheme
12+
;; To use this instead of the default Scheme client, set
13+
;; `g:conjure#filetype#scheme` to `"conjure.client.snd-s7.stdio"`.
1114
;; client in fnl/conjure/config.fnl.
1215
;;
1316
;;------------------------------------------------------------
@@ -76,47 +79,8 @@
7679
(a.run! display-result msgs))
7780
)
7881
{:batch? false}))))
79-
8082
;;;;-------- End from client/sql/stdio.fnl ------------------
8183

82-
;;;;-------- from client/scheme/stdio.fnl -------------------
83-
; (defn unbatch [msgs]
84-
; {:out (->> msgs
85-
; (a.map #(or (a.get $1 :out) (a.get $1 :err)))
86-
; (str.join ""))})
87-
;
88-
; (defn format-msg [msg]
89-
; (->> (-> msg
90-
; (a.get :out)
91-
; (string.gsub "^%s*" "")
92-
; (string.gsub "%s+%d+%s*$" "")
93-
; (str.split "\n"))
94-
; (a.map
95-
; (fn [line]
96-
; (if
97-
; (not (cfg [:value_prefix_pattern]))
98-
; line
99-
;
100-
; (string.match line (cfg [:value_prefix_pattern]))
101-
; (string.gsub line (cfg [:value_prefix_pattern]) "")
102-
;
103-
; (.. comment-prefix "(out) " line))))
104-
; (a.filter #(not (str.blank? $1)))))
105-
;
106-
;
107-
; (defn eval-str [opts]
108-
; (with-repl-or-warn
109-
; (fn [repl]
110-
; (repl.send
111-
; (.. opts.code "\n")
112-
; (fn [msgs]
113-
; (let [msgs (-> msgs unbatch format-msg)]
114-
; (opts.on-result (a.last msgs))
115-
; (log.append msgs)))
116-
; {:batch? true}))))
117-
;
118-
;;;;-------- End from client/scheme/stdio.fnl ---------------
119-
12084
(defn eval-file [opts]
12185
(eval-str (a.assoc opts :code (.. "(load \"" opts.file-path "\")"))))
12286

‎fnl/conjure/config.fnl

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@
6060
:hy :conjure.client.hy.stdio
6161
:julia :conjure.client.julia.stdio
6262
:racket :conjure.client.racket.stdio
63-
;;:scheme :conjure.client.scheme.stdio
64-
:scheme :conjure.client.snd-s7.stdio
63+
:scheme :conjure.client.scheme.stdio
6564
:lua :conjure.client.lua.neovim
6665
:lisp :conjure.client.common-lisp.swank
6766
:python :conjure.client.python.stdio

‎lua/conjure/config.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,5 @@ local function merge(tbl, opts, ks)
6868
return nil
6969
end
7070
_2amodule_2a["merge"] = merge
71-
merge({relative_file_root = nil, path_subs = nil, client_on_load = true, filetypes = {"clojure", "fennel", "janet", "hy", "julia", "racket", "scheme", "lua", "lisp", "python", "rust", "sql"}, filetype = {clojure = "conjure.client.clojure.nrepl", fennel = "conjure.client.fennel.aniseed", janet = "conjure.client.janet.netrepl", hy = "conjure.client.hy.stdio", julia = "conjure.client.julia.stdio", racket = "conjure.client.racket.stdio", scheme = "conjure.client.snd-s7.stdio", lua = "conjure.client.lua.neovim", lisp = "conjure.client.common-lisp.swank", python = "conjure.client.python.stdio", rust = "conjure.client.rust.evcxr", sql = "conjure.client.sql.stdio"}, filetype_suffixes = {racket = {"rkt"}, scheme = {"scm", "ss"}}, eval = {result_register = "c", inline_results = true, inline = {highlight = "comment", prefix = "=> "}, comment_prefix = nil, gsubs = {}}, mapping = {prefix = "<localleader>", log_split = "ls", log_vsplit = "lv", log_tab = "lt", log_buf = "le", log_toggle = "lg", log_close_visible = "lq", log_reset_soft = "lr", log_reset_hard = "lR", log_jump_to_latest = "ll", eval_current_form = "ee", eval_comment_current_form = "ece", eval_root_form = "er", eval_comment_root_form = "ecr", eval_word = "ew", eval_comment_word = "ecw", eval_replace_form = "e!", eval_marked_form = "em", eval_file = "ef", eval_buf = "eb", eval_visual = "E", eval_motion = "E", def_word = "gd", doc_word = {"K"}, enable_ft_mappings = true}, completion = {omnifunc = "ConjureOmnifunc", fallback = "syntaxcomplete#Complete"}, highlight = {group = "IncSearch", timeout = 500, enabled = false}, log = {hud = {width = 0.42, height = 0.3, enabled = true, passive_close_delay = 0, minimum_lifetime_ms = 20, overlap_padding = 0.1, border = "single", anchor = "NE", ignore_low_priority = false}, jump_to_latest = {cursor_scroll_position = "top", enabled = false}, break_length = 80, trim = {at = 10000, to = 6000}, strip_ansi_escape_sequences_line_limit = 1000, fold = {lines = 10, marker = {start = "~~~%{", ["end"] = "}%~~~"}, enabled = false}, wrap = false, botright = false}, extract = {context_header_lines = 24, form_pairs = {{"(", ")"}, {"{", "}"}, {"[", "]", true}}, tree_sitter = {enabled = true}}, preview = {sample_limit = 0.3}, debug = false})
71+
merge({relative_file_root = nil, path_subs = nil, client_on_load = true, filetypes = {"clojure", "fennel", "janet", "hy", "julia", "racket", "scheme", "lua", "lisp", "python", "rust", "sql"}, filetype = {clojure = "conjure.client.clojure.nrepl", fennel = "conjure.client.fennel.aniseed", janet = "conjure.client.janet.netrepl", hy = "conjure.client.hy.stdio", julia = "conjure.client.julia.stdio", racket = "conjure.client.racket.stdio", scheme = "conjure.client.scheme.stdio", lua = "conjure.client.lua.neovim", lisp = "conjure.client.common-lisp.swank", python = "conjure.client.python.stdio", rust = "conjure.client.rust.evcxr", sql = "conjure.client.sql.stdio"}, filetype_suffixes = {racket = {"rkt"}, scheme = {"scm", "ss"}}, eval = {result_register = "c", inline_results = true, inline = {highlight = "comment", prefix = "=> "}, comment_prefix = nil, gsubs = {}}, mapping = {prefix = "<localleader>", log_split = "ls", log_vsplit = "lv", log_tab = "lt", log_buf = "le", log_toggle = "lg", log_close_visible = "lq", log_reset_soft = "lr", log_reset_hard = "lR", log_jump_to_latest = "ll", eval_current_form = "ee", eval_comment_current_form = "ece", eval_root_form = "er", eval_comment_root_form = "ecr", eval_word = "ew", eval_comment_word = "ecw", eval_replace_form = "e!", eval_marked_form = "em", eval_file = "ef", eval_buf = "eb", eval_visual = "E", eval_motion = "E", def_word = "gd", doc_word = {"K"}, enable_ft_mappings = true}, completion = {omnifunc = "ConjureOmnifunc", fallback = "syntaxcomplete#Complete"}, highlight = {group = "IncSearch", timeout = 500, enabled = false}, log = {hud = {width = 0.42, height = 0.3, enabled = true, passive_close_delay = 0, minimum_lifetime_ms = 20, overlap_padding = 0.1, border = "single", anchor = "NE", ignore_low_priority = false}, jump_to_latest = {cursor_scroll_position = "top", enabled = false}, break_length = 80, trim = {at = 10000, to = 6000}, strip_ansi_escape_sequences_line_limit = 1000, fold = {lines = 10, marker = {start = "~~~%{", ["end"] = "}%~~~"}, enabled = false}, botright = false, wrap = false}, extract = {context_header_lines = 24, form_pairs = {{"(", ")"}, {"{", "}"}, {"[", "]", true}}, tree_sitter = {enabled = true}}, preview = {sample_limit = 0.3}, debug = false})
7272
return _2amodule_2a

0 commit comments

Comments
 (0)
Please sign in to comment.