From 1ff73c7c6b1c0e30c6076663f6b771f9b5bd9009 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Tue, 12 May 2020 16:39:19 -0700 Subject: Formatting etc whatever --- z.scm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'z.scm') 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 )) +(define-generic save!) +(define-method (save! (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: 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 )] [editor (os.getenv "EDITOR")]) (subprocess.call (list editor (path node))) -- cgit v1.2.3