summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)))