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