summaryrefslogtreecommitdiff
path: root/z.scm
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-05-12 16:39:19 -0700
committerBen Sima <ben@bsima.me>2020-05-12 16:39:19 -0700
commit1ff73c7c6b1c0e30c6076663f6b771f9b5bd9009 (patch)
tree493d5c0dec7bfac1bbcf9a33b4e62a5979eae793 /z.scm
parent500017f2aa6ec1b4679a6878a7624eb7beaf1ee2 (diff)
Formatting etc whatever
Diffstat (limited to 'z.scm')
-rw-r--r--z.scm15
1 files changed, 10 insertions, 5 deletions
diff --git a/z.scm b/z.scm
index 6cec0dd..b24ded8 100644
--- a/z.scm
+++ b/z.scm
@@ -69,9 +69,7 @@
(define (id->path id)
"Given an id, return the absolute path to the file."
- (fmt "~a/~a.md"
- *zdir*
- (id->string id)))
+ (fmt "~a/~a.md" *zdir* (id->string id)))
;; Manipulating nodes
@@ -106,8 +104,8 @@
#:slot-ref (lambda (self)
(id->path (id self)))))
-(define-generic save-node!)
-(define-method (save-node! (node <node>))
+(define-generic save!)
+(define-method (save! (node <node>))
(call-with-output-file (path node)
(fn [file]
(format file "title: ~a\n" (title node))
@@ -116,6 +114,9 @@
(display "---\n" file)
(format file "~a" (content node)))))
+(define-generic render-li)
+(define-generic render-full)
+
(define (parse-title node-data)
(-> node-data
(re.match "title: ([^\n]*)")
@@ -277,12 +278,16 @@ usage: z [command]
where 'command' is:
<none> create new note
ls list all notes
+ tags list all tags
tagged [tag] list notes tagged with 'tag'
web [port] start the webserver"))
(define (main args)
(match (rest args)
['()
+ ;; TODO: create a tmp file with template, open that in editor,
+ ;; write and save. then load-node and save! proper. I can't pipe,
+ ;; because emacs doesn't pipe to buffer
(let ([node (make <node>)]
[editor (os.getenv "EDITOR")])
(subprocess.call (list editor (path node)))