commit - 5b6aa68ca958e97270918091fe97d79509e0dbf0
commit + 77abbd7c60f1b86567878155667ad2806ff24d1c
blob - a49a799b818e2bc6cc27a688512f776ab95f4faa
blob + e5bb910dee32022ed917f75383a5771c5e2704ec
--- Makefile
+++ Makefile
fmt:
sh tools/fmt.sh src/pisol/core.sls src/pisol/tui.sls bin/pisol.ss test/test.ss tools/build.ss
-install:
- ninja install
+install: build
+ @prefix="$${PREFIX:-/usr/local}"; \
+ bindir="$${BINDIR:-$$prefix/bin}"; \
+ libexecdir="$${LIBEXECDIR:-$$prefix/libexec/pisol}"; \
+ mandir="$${MANDIR:-$$prefix/share/man}"; \
+ destdir="$${DESTDIR:-}"; \
+ can_create() { d="$$1"; while [ -n "$$d" ] && [ ! -e "$$d" ]; do d=$$(dirname "$$d"); done; [ -d "$$d" ] && [ -w "$$d" ]; }; \
+ s=; if ! can_create "$$destdir$$bindir"; then s=sudo; fi; \
+ $$s install -d "$$destdir$$bindir" "$$destdir$$libexecdir/lib/pisol" "$$destdir$$mandir/man1" && \
+ $$s install -m 755 bin/pisol "$$destdir$$bindir/pisol" && \
+ $$s install -m 755 build/runtime/pisol.so "$$destdir$$libexecdir/pisol.so" && \
+ $$s install -m 644 build/runtime/lib/pisol/core.so build/runtime/lib/pisol/tui.so "$$destdir$$libexecdir/lib/pisol/" && \
+ $$s install -m 644 doc/pisol.1 "$$destdir$$mandir/man1/pisol.1"
uninstall:
- ninja uninstall
+ @prefix="$${PREFIX:-/usr/local}"; \
+ bindir="$${BINDIR:-$$prefix/bin}"; \
+ libexecdir="$${LIBEXECDIR:-$$prefix/libexec/pisol}"; \
+ mandir="$${MANDIR:-$$prefix/share/man}"; \
+ destdir="$${DESTDIR:-}"; \
+ can_create() { d="$$1"; while [ -n "$$d" ] && [ ! -e "$$d" ]; do d=$$(dirname "$$d"); done; [ -d "$$d" ] && [ -w "$$d" ]; }; \
+ s=; if ! can_create "$$destdir$$bindir"; then s=sudo; fi; \
+ $$s rm -f "$$destdir$$bindir/pisol" "$$destdir$$libexecdir/pisol.so" "$$destdir$$libexecdir/lib/pisol/core.so" "$$destdir$$libexecdir/lib/pisol/tui.so" "$$destdir$$mandir/man1/pisol.1"
help:
@printf '%s\n' \
blob - 1e7587d8448b2bbc68475e989dca12bf24eb03f3
blob + ea1eb8902b18e4e1e8e1880e09dcef553b61fd1e
--- README.md
+++ README.md
## Run
You need Bash, [Landrun](https://github.com/Zouuup/landrun), Chez Scheme 10.4 or
-newer, and Ninja. Install `fzf` for fuzzy directory selection. Without it, the
-editor uses direct path entry. Install `emacs` to run `ninja fmt`.
+newer, and Make. Install `fzf` for fuzzy directory selection. Without it, the
+editor uses direct path entry. Install `emacs` to run `make fmt`.
```sh
-ninja tui
-ninja test
+make tui
+make test
```
After installation, open the editor in the working directory:
## Build and install
```sh
-ninja build
-ninja test
-ninja fmt
-ninja install
-ninja copy-config
+make build
+make test
+make fmt
+make install
+make copy-config
```
-`ninja fmt` reindents the Scheme sources in place with `emacs` scheme-mode. Run
+`make fmt` reindents the Scheme sources in place with `emacs` scheme-mode. Run
it after editing Scheme files; it is a no-op on already-formatted files.
-`ninja install` defaults to `/usr/local` and asks for `sudo` only when needed.
+`make install` defaults to `/usr/local` and asks for `sudo` only when needed.
Set `PREFIX`, `DESTDIR`, `BINDIR`, `LIBEXECDIR`, `MANDIR`, or `SCHEME` to
override the defaults. See `pisol(1)` after installation.
blob - 4d9c7939c5a158d67ec69b06eb25da179a2c1c45 (mode 644)
blob + /dev/null
--- build.ninja
+++ /dev/null
-ninja_required_version = 1.5
-
-libdir = src
-
-rule compile
- command = mkdir -p build/runtime/lib/pisol && $${SCHEME:-scheme} --libdirs $libdir --compile-imported-libraries --program tools/build.ss && cp src/pisol/core.so src/pisol/tui.so build/runtime/lib/pisol/
- description = compiling pisol
-
-build build/runtime/pisol.so: compile bin/pisol.ss src/pisol/core.sls src/pisol/tui.sls tools/build.ss
-
-build build: phony build/runtime/pisol.so
-default build
-
-rule install
- command = prefix=$${PREFIX:-/usr/local}; bindir=$${BINDIR:-$$prefix/bin}; libexecdir=$${LIBEXECDIR:-$$prefix/libexec/pisol}; mandir=$${MANDIR:-$$prefix/share/man}; destdir=$${DESTDIR:-}; can_create() { d="$$1"; while [ -n "$$d" ] && [ ! -e "$$d" ]; do d=$$(dirname "$$d"); done; [ -d "$$d" ] && [ -w "$$d" ]; }; s=; if ! can_create "$$destdir$$bindir"; then s=sudo; fi; $$s install -d "$$destdir$$bindir" "$$destdir$$libexecdir/lib/pisol" "$$destdir$$mandir/man1" && $$s install -m 755 bin/pisol "$$destdir$$bindir/pisol" && $$s install -m 755 build/runtime/pisol.so "$$destdir$$libexecdir/pisol.so" && $$s install -m 644 build/runtime/lib/pisol/core.so build/runtime/lib/pisol/tui.so "$$destdir$$libexecdir/lib/pisol/" && $$s install -m 644 doc/pisol.1 "$$destdir$$mandir/man1/pisol.1"
- pool = console
- description = installing pisol
-
-build install: install build/runtime/pisol.so
-
-rule uninstall
- command = prefix=$${PREFIX:-/usr/local}; bindir=$${BINDIR:-$$prefix/bin}; libexecdir=$${LIBEXECDIR:-$$prefix/libexec/pisol}; mandir=$${MANDIR:-$$prefix/share/man}; destdir=$${DESTDIR:-}; can_create() { d="$$1"; while [ -n "$$d" ] && [ ! -e "$$d" ]; do d=$$(dirname "$$d"); done; [ -d "$$d" ] && [ -w "$$d" ]; }; s=; if ! can_create "$$destdir$$bindir"; then s=sudo; fi; $$s rm -f "$$destdir$$bindir/pisol" "$$destdir$$libexecdir/pisol.so" "$$destdir$$libexecdir/lib/pisol/core.so" "$$destdir$$libexecdir/lib/pisol/tui.so" "$$destdir$$mandir/man1/pisol.1"
- pool = console
- description = uninstalling pisol
-
-build uninstall: uninstall
-
-rule help
- command = printf '%s\n' 'ninja install Install pisol and its manual (escalates to sudo if needed)' 'ninja uninstall Remove installed pisol files' '' 'Variables: PREFIX=/usr/local DESTDIR=' ' BINDIR=PREFIX/bin LIBEXECDIR=PREFIX/libexec/pisol MANDIR=PREFIX/share/man' ' NO_COLOR=1'
- pool = console
-
-build help: help
blob - 0a4d232664c0dfe294cc8d6e9f4dfa101340b9da
blob + 161ad5841e7f4e40759a089851e13603e0ad5d23
--- src/pisol/core.sls
+++ src/pisol/core.sls
(string-prefix? "args=(\n" text))))
(define (temporary-path stem)
- (format "~a.pisol.~a" stem (time-nanosecond (current-time))))
+ (let ([now (current-time)])
+ (format "~a.pisol.~a.~a"
+ stem
+ (time-second now)
+ (time-nanosecond now))))
(define (bytevector->nul-strings bytes)
(let loop ([at 0] [current '()] [result '()])
(trim (read-text errors))
"configuration evaluation failed")
path))
- (let ([port (open-file-input-port output)])
- (let ([bytes (get-bytevector-all port)])
- (close-port port)
- (if (eof-object? bytes)
- '()
- (bytevector->nul-strings bytes))))))
+ (let ([bytes (call-with-port (open-file-input-port output)
+ get-bytevector-all)])
+ (if (eof-object? bytes)
+ '()
+ (bytevector->nul-strings bytes)))))
(lambda ()
(when (file-exists? output) (delete-file output))
(when (file-exists? errors) (delete-file errors))))))
(raise condition)))
(call-with-output-file temporary
(lambda (port) (display (config->shell configuration) port))
- 'replace)
+ '())
(chmod temporary #o600)
(rename-file temporary path)
(configuration-source-style-set! configuration 'canonical)
blob - e0c2d19202e9d0d7e6b2e814e3a9bbf5a726ca3e
blob + 7c7c5257a49403faff5405a3ccb1398047305fb1
--- src/pisol/tui.sls
+++ src/pisol/tui.sls
(zero? (system "test -t 0")))
(define (temporary-path)
- (string-append (or (getenv "TMPDIR") "/tmp")
- "/pisol-fzf-"
- (number->string (time-nanosecond (current-time)))))
+ (let ([now (current-time)])
+ (format "~a/pisol-fzf-~a.~a"
+ (or (getenv "TMPDIR") "/tmp")
+ (time-second now)
+ (time-nanosecond now))))
- (define (read-first-line path)
- (and (file-exists? path)
- (call-with-input-file path
- (lambda (port)
- (let ([line (get-line port)])
- (and (not (eof-object? line)) line))))))
-
(define (read-output-lines path)
(and (file-exists? path)
(call-with-input-file path
(for-all char-numeric? (string->list text))
(string->number text)))
- (define (items-not-in items excluded)
- (filter (lambda (item) (not (member item excluded))) items))
-
(define (show-config-files configuration)
(clear-screen)
(display (intense "pisol configuration files"))