aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-10-13 13:49:29 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-10-13 13:49:29 -0700
commit3fb78aa6158134497c17e5288a8ee9af64d1fac0 (patch)
tree712f4c390e4e857e5db721ed5ecf894568429273
parent353a3958e42d52862a48b5871a8acedcbf04eaf6 (diff)
downloadmnpgr-3fb78aa6158134497c17e5288a8ee9af64d1fac0.tar.gz
mnpgr-3fb78aa6158134497c17e5288a8ee9af64d1fac0.tar.bz2
mnpgr-3fb78aa6158134497c17e5288a8ee9af64d1fac0.zip
Support compiling.
-rwxr-xr-xmnpgr.tl23
1 files changed, 12 insertions, 11 deletions
diff --git a/mnpgr.tl b/mnpgr.tl
index 72a87b0..b43959c 100755
--- a/mnpgr.tl
+++ b/mnpgr.tl
@@ -31,15 +31,16 @@
(@else (output-text else :norm))))
(output-text "\n" :norm)))))
-(ensure-dir mnpgr-dir)
+(compile-only ;; I.e. do not execute these forms during compilation
+ (ensure-dir mnpgr-dir)
-(match @(or `@page(@section)` ;; for "man whatever"
- `@page\\.@section`) ;; for "man -l file.1"
- (getenv "MAN_PN")
- (with-resources ((rendered-file (path-cat mnpgr-dir `@page.@section`)
- (remove-path rendered-file)))
- (with-stream (s (open-file rendered-file "w"))
- (let ((ofilt (make-overstrike-filter (lambda (str) (put-string str s)))))
- (whilet ((line (get-line)))
- [ofilt line])))
- (sh `vim +'@{vim-commands}' '@{rendered-file}' < /dev/tty`)))
+ (match @(or `@page(@section)` ;; for "man whatever"
+ `@page\\.@section`) ;; for "man -l file.1"
+ (getenv "MAN_PN")
+ (with-resources ((rendered-file (path-cat mnpgr-dir `@page.@section`)
+ (remove-path rendered-file)))
+ (with-stream (s (open-file rendered-file "w"))
+ (let ((ofilt (make-overstrike-filter (lambda (str) (put-string str s)))))
+ (whilet ((line (get-line)))
+ [ofilt line])))
+ (sh `vim +'@{vim-commands}' '@{rendered-file}' < /dev/tty`))))