@@ -1212,29 +1212,29 @@ function is meant as a subroutine for creating a new file-level node.
12121212To merely visit an existing node, see `org-node-goto-id' .
12131213
12141214If the file already exists, this also attempts a `revert-buffer' ."
1215- (let* (
1216- ( dir (or (and ( plist-get plist : path)
1217- (functionp ( plist-get plist : path) )
1218- (funcall ( plist-get plist : path) ))
1219- ( plist-get plist : path)
1220- (org-node-guess-or-ask-dir " New file in which directory? "
1221- ( plist-get plist : ask-path) )))
1222- (file (file-name-concat dir (org-node-title-to-basename title)))
1223- (buf (progn (mkdir dir t )
1224- (or (find-buffer-visiting file)
1225- (find-file-noselect file)))))
1226- (pop-to-buffer-same-window buf)
1227- (cl-assert (eq (current-buffer ) buf))
1228- (cl-flet ((assert-empty ()
1229- (when (not (length= (buffer-string ) 0 ))
1230- (let ((msg (format " Resetting cache because file seems to already have contents: %s "
1231- file)))
1232- (org-mem-reset t msg)
1233- (user-error " %s" msg)))))
1234- (assert-empty)
1235- (when (file-exists-p file)
1236- (revert-buffer )
1237- (assert-empty)))))
1215+ (pcase- let ((( map :path :ask-path ) plist))
1216+ ( let* (( dir (or (and path
1217+ (functionp path)
1218+ (funcall path))
1219+ path
1220+ (org-node-guess-or-ask-dir " New file in which directory? "
1221+ ask-path)))
1222+ (file (file-name-concat dir (org-node-title-to-basename title)))
1223+ (buf (progn (mkdir dir t )
1224+ (or (find-buffer-visiting file)
1225+ (find-file-noselect file)))))
1226+ (pop-to-buffer-same-window buf)
1227+ (cl-assert (eq (current-buffer ) buf))
1228+ (cl-flet ((assert-empty ()
1229+ (when (not (length= (buffer-string ) 0 ))
1230+ (let ((msg (format " Resetting cache because file seems to already have contents: %s "
1231+ file)))
1232+ (org-mem-reset t msg)
1233+ (user-error " %s" msg)))))
1234+ (assert-empty)
1235+ (when (file-exists-p file)
1236+ (revert-buffer )
1237+ (assert-empty) )))))
12381238
12391239(defun org-node-new-via-roam-capture ()
12401240 " Call `org-roam-capture-' with predetermined arguments.
@@ -1285,7 +1285,7 @@ type the name of a node that does not exist. That enables this
12851285 ; ; template string.
12861286 (apply #'org-capture-put (org-node-capture-infer-title-etc))
12871287 (if-let* ((node (org-capture-get :existing-node )))
1288- (org-node-goto node t )
1288+ (org-node-goto node t )
12891289 (let ((parent-id (plist-get org-capture-plist :parent-id-if-new )))
12901290 (if parent-id
12911291 (if-let ((parent-node (org-mem-entry-by-id parent-id)))
0 commit comments