fix: convert-to-node interactive form returns 3 values

This commit is contained in:
2026-07-17 22:03:40 -04:00
parent bab4a818b6
commit b8b984c14c
2 changed files with 49 additions and 58 deletions

View File

@@ -3405,8 +3405,8 @@ CONTEXT-TAG is the mu4e/agenda context (e.g. 'TDNDE', 'Perso')."
(interactive
(list (completing-read "Category: " '("1-Projects" "2-Areas" "3-Resources"))
(read-string "Node Name: ")
(read-string "Project tag (slug for agenda/email per project filtering): ")
(read-string "Context tag (slug for agenda/email per context filtering): ")))
(read-string "Project tag: ")
(read-string "Context tag: ")))
(let* ((category-dir (expand-file-name category gortium/exokortex-root))
(node-dir (expand-file-name node-name category-dir))
(org-file (gortium/ensure-node-structure node-dir
@@ -3421,31 +3421,28 @@ If folders are explicitly marked in Dirvish/Dired, it batch-processes all of the
Otherwise, prompts for a single directory, defaulting to the item under the cursor.
Optional PROJECT-TAG and CONTEXT-TAG can be given to create .projectile and .dir-locals.el."
(interactive
(list
(let* ((dired-elements (when (derived-mode-p 'dired-mode)
(dired-get-marked-files nil nil nil t)))
(has-explicit-marks (or (and (listp dired-elements) (> (length dired-elements) 1))
(and (consp dired-elements) (eq (car dired-elements) t))))
(marked-dirs (when has-explicit-marks
(cl-remove-if-not #'file-directory-p
(if (eq (car-safe dired-elements) t)
(cdr dired-elements)
dired-elements)))))
(if marked-dirs
(list marked-dirs
(read-string "Project tag (blank to skip): ")
(completing-read "Context tag: " (quote ("TDNDE" "Perso" "")) nil t))
(let* ((cursor-path (when (derived-mode-p 'dired-mode)
(dired-get-filename nil t)))
(initial-path (cond
((and cursor-path (file-directory-p cursor-path))
cursor-path)
(cursor-path
(file-name-directory cursor-path))
(t default-directory))))
(list (list (read-directory-name "Directory to convert: " nil initial-path t initial-path))
(read-string "Project tag (blank to skip): ")
(completing-read "Context tag: " (quote ("TDNDE" "Perso" "")) nil t)))))))
(let* ((dired-elements (when (derived-mode-p 'dired-mode)
(dired-get-marked-files nil nil nil t)))
(has-explicit-marks (or (and (listp dired-elements) (> (length dired-elements) 1))
(and (consp dired-elements) (eq (car dired-elements) t))))
(marked-dirs (when has-explicit-marks
(cl-remove-if-not #'file-directory-p
(if (eq (car-safe dired-elements) t)
(cdr dired-elements)
dired-elements))))
(dirs (or marked-dirs
(let* ((cursor-path (when (derived-mode-p 'dired-mode)
(dired-get-filename nil t)))
(initial-path (cond
((and cursor-path (file-directory-p cursor-path))
cursor-path)
(cursor-path
(file-name-directory cursor-path))
(t default-directory))))
(list (read-directory-name "Directory to convert: " nil initial-path t initial-path)))))
(tag (read-string "Project tag (blank to skip): "))
(ctx (completing-read "Context tag: " (quote ("TDNDE" "Perso" "")) nil t)))
(list dirs tag ctx)))
(let ((count 0)
last-org-file)
@@ -3943,7 +3940,4 @@ Need chrome... :(
(map! :map org-mode-map
:localleader
:desc "Edit Edna rules" "E" #'org-edna-edit))
#+end_src

View File

@@ -2489,8 +2489,8 @@ CONTEXT-TAG is the mu4e/agenda context (e.g. 'TDNDE', 'Perso')."
(interactive
(list (completing-read "Category: " '("1-Projects" "2-Areas" "3-Resources"))
(read-string "Node Name: ")
(read-string "Project tag (slug for agenda/email per project filtering): ")
(read-string "Context tag (slug for agenda/email per context filtering): ")))
(read-string "Project tag: ")
(read-string "Context tag: ")))
(let* ((category-dir (expand-file-name category gortium/exokortex-root))
(node-dir (expand-file-name node-name category-dir))
(org-file (gortium/ensure-node-structure node-dir
@@ -2505,31 +2505,28 @@ If folders are explicitly marked in Dirvish/Dired, it batch-processes all of the
Otherwise, prompts for a single directory, defaulting to the item under the cursor.
Optional PROJECT-TAG and CONTEXT-TAG can be given to create .projectile and .dir-locals.el."
(interactive
(list
(let* ((dired-elements (when (derived-mode-p 'dired-mode)
(dired-get-marked-files nil nil nil t)))
(has-explicit-marks (or (and (listp dired-elements) (> (length dired-elements) 1))
(and (consp dired-elements) (eq (car dired-elements) t))))
(marked-dirs (when has-explicit-marks
(cl-remove-if-not #'file-directory-p
(if (eq (car-safe dired-elements) t)
(cdr dired-elements)
dired-elements)))))
(if marked-dirs
(list marked-dirs
(read-string "Project tag (blank to skip): ")
(completing-read "Context tag: " (quote ("TDNDE" "Perso" "")) nil t))
(let* ((cursor-path (when (derived-mode-p 'dired-mode)
(dired-get-filename nil t)))
(initial-path (cond
((and cursor-path (file-directory-p cursor-path))
cursor-path)
(cursor-path
(file-name-directory cursor-path))
(t default-directory))))
(list (list (read-directory-name "Directory to convert: " nil initial-path t initial-path))
(read-string "Project tag (blank to skip): ")
(completing-read "Context tag: " (quote ("TDNDE" "Perso" "")) nil t)))))))
(let* ((dired-elements (when (derived-mode-p 'dired-mode)
(dired-get-marked-files nil nil nil t)))
(has-explicit-marks (or (and (listp dired-elements) (> (length dired-elements) 1))
(and (consp dired-elements) (eq (car dired-elements) t))))
(marked-dirs (when has-explicit-marks
(cl-remove-if-not #'file-directory-p
(if (eq (car-safe dired-elements) t)
(cdr dired-elements)
dired-elements))))
(dirs (or marked-dirs
(let* ((cursor-path (when (derived-mode-p 'dired-mode)
(dired-get-filename nil t)))
(initial-path (cond
((and cursor-path (file-directory-p cursor-path))
cursor-path)
(cursor-path
(file-name-directory cursor-path))
(t default-directory))))
(list (read-directory-name "Directory to convert: " nil initial-path t initial-path)))))
(tag (read-string "Project tag (blank to skip): "))
(ctx (completing-read "Context tag: " (quote ("TDNDE" "Perso" "")) nil t)))
(list dirs tag ctx)))
(let ((count 0)
last-org-file)