fix: archivist-create-note handler-case structure (C/T bugs)

- handler-case had (log-message ...) and t as malformed clauses instead of return value
- This caused the error clause to fall outside handler-case, making c undefined
- Wrapped success path in progn: write-file + log-message + return t
- Error clause (error (c) ...) now properly inside handler-case
- Both bugs fixed by same structural change
This commit is contained in:
2026-05-04 12:04:56 -04:00
parent 5ab54091c1
commit 1b4d147170
2 changed files with 36 additions and 34 deletions

View File

@@ -115,6 +115,7 @@ Returns T if note was created, nil if it already exists."
(when (uiop:file-exists-p filepath) (when (uiop:file-exists-p filepath)
(return-from archivist-create-note nil)) (return-from archivist-create-note nil))
(handler-case (handler-case
(progn
(uiop:with-output-file (s filepath :if-exists :nil) (uiop:with-output-file (s filepath :if-exists :nil)
(format s "#+TITLE: ~a~%" title) (format s "#+TITLE: ~a~%" title)
(format s "#+FILETAGS: :atomic:note:~:[~;~{~a~^:~}~]~%" tags tags) (format s "#+FILETAGS: :atomic:note:~:[~;~{~a~^:~}~]~%" tags tags)
@@ -131,7 +132,7 @@ Returns T if note was created, nil if it already exists."
t) t)
(error (c) (error (c)
(log-message "ARCHIVIST: Failed to create note ~a: ~a" filepath c) (log-message "ARCHIVIST: Failed to create note ~a: ~a" filepath c)
nil))) nil))))
(defun archivist-gardener-scan () (defun archivist-gardener-scan ()
"Scans the Memex for broken file links and orphaned memory objects. "Scans the Memex for broken file links and orphaned memory objects.

View File

@@ -167,6 +167,7 @@ Returns T if note was created, nil if it already exists."
(when (uiop:file-exists-p filepath) (when (uiop:file-exists-p filepath)
(return-from archivist-create-note nil)) (return-from archivist-create-note nil))
(handler-case (handler-case
(progn
(uiop:with-output-file (s filepath :if-exists :nil) (uiop:with-output-file (s filepath :if-exists :nil)
(format s "#+TITLE: ~a~%" title) (format s "#+TITLE: ~a~%" title)
(format s "#+FILETAGS: :atomic:note:~:[~;~{~a~^:~}~]~%" tags tags) (format s "#+FILETAGS: :atomic:note:~:[~;~{~a~^:~}~]~%" tags tags)
@@ -183,7 +184,7 @@ Returns T if note was created, nil if it already exists."
t) t)
(error (c) (error (c)
(log-message "ARCHIVIST: Failed to create note ~a: ~a" filepath c) (log-message "ARCHIVIST: Failed to create note ~a: ~a" filepath c)
nil))) nil))))
#+end_src #+end_src
#+end_src #+end_src