edward

An extensible POSIX-compatible implementation of the ed(1) text editor

git clone https://git.8pit.net/edward.git

 1;;> Library for defining custom ed editor commands through provided
 2;;> macros. For each command, a parser and an executor needs to be defined.
 3;;> The parser is defined using edward [parser combinators][edward parse].
 4;;> The executor receives an [editor object][editor object] as well as the
 5;;> return value of the parser combinator as procedure arguments and modifies
 6;;> the editor state accordingly. Additionally, this library defines several
 7;;> utility procedures that are useful for defining [executor procedures][executor util]
 8;;> and ed [parser combinators][parser util].
 9;;>
10;;> [edward parse]: edward.parse.html
11;;> [editor object]: edward.ed.editor.html#section-text-editor-object
12;;> [executor util]: #section-executor-utilities
13;;> [parser util]: #section-parser-utilities
14
15(define-library (edward.ed.cmd)
16  (import (scheme base)
17          (scheme file)
18          (scheme lazy)
19
20          (srfi 1)
21          (srfi 14)
22
23          (only (chicken process) call-with-input-pipe call-with-output-pipe)
24
25          (edward util)
26          (edward parse)
27          (edward ed addr)
28          (edward ed editor))
29
30  ;; Utility procedures to define custom editor commands.
31  (export define-edit-cmd define-input-cmd define-print-cmd define-file-cmd
32          parse-cmd-char parse-cmd parse-re parse-re-pair unwrap-command-list
33          exec-command-list parse-filename parse-file-cmd write-lines
34          read-from call-when-confirmed subst-nomatch-handler
35          filename-cmd? register-command exec-command-list-interactive)
36
37  ;; Editor command executors mandated by POSIX.
38  (include "cmd.scm"))