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 (interactive
(list (completing-read "Category: " '("1-Projects" "2-Areas" "3-Resources")) (list (completing-read "Category: " '("1-Projects" "2-Areas" "3-Resources"))
(read-string "Node Name: ") (read-string "Node Name: ")
(read-string "Project tag (slug for agenda/email per project filtering): ") (read-string "Project tag: ")
(read-string "Context tag (slug for agenda/email per context filtering): "))) (read-string "Context tag: ")))
(let* ((category-dir (expand-file-name category gortium/exokortex-root)) (let* ((category-dir (expand-file-name category gortium/exokortex-root))
(node-dir (expand-file-name node-name category-dir)) (node-dir (expand-file-name node-name category-dir))
(org-file (gortium/ensure-node-structure node-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. 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." Optional PROJECT-TAG and CONTEXT-TAG can be given to create .projectile and .dir-locals.el."
(interactive (interactive
(list (let* ((dired-elements (when (derived-mode-p 'dired-mode)
(let* ((dired-elements (when (derived-mode-p 'dired-mode) (dired-get-marked-files nil nil nil t)))
(dired-get-marked-files nil nil nil t))) (has-explicit-marks (or (and (listp dired-elements) (> (length dired-elements) 1))
(has-explicit-marks (or (and (listp dired-elements) (> (length dired-elements) 1)) (and (consp dired-elements) (eq (car dired-elements) t))))
(and (consp dired-elements) (eq (car dired-elements) t)))) (marked-dirs (when has-explicit-marks
(marked-dirs (when has-explicit-marks (cl-remove-if-not #'file-directory-p
(cl-remove-if-not #'file-directory-p (if (eq (car-safe dired-elements) t)
(if (eq (car-safe dired-elements) t) (cdr dired-elements)
(cdr dired-elements) dired-elements))))
dired-elements))))) (dirs (or marked-dirs
(if marked-dirs (let* ((cursor-path (when (derived-mode-p 'dired-mode)
(list marked-dirs (dired-get-filename nil t)))
(read-string "Project tag (blank to skip): ") (initial-path (cond
(completing-read "Context tag: " (quote ("TDNDE" "Perso" "")) nil t)) ((and cursor-path (file-directory-p cursor-path))
(let* ((cursor-path (when (derived-mode-p 'dired-mode) cursor-path)
(dired-get-filename nil t))) (cursor-path
(initial-path (cond (file-name-directory cursor-path))
((and cursor-path (file-directory-p cursor-path)) (t default-directory))))
cursor-path) (list (read-directory-name "Directory to convert: " nil initial-path t initial-path)))))
(cursor-path (tag (read-string "Project tag (blank to skip): "))
(file-name-directory cursor-path)) (ctx (completing-read "Context tag: " (quote ("TDNDE" "Perso" "")) nil t)))
(t default-directory)))) (list dirs tag ctx)))
(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 ((count 0) (let ((count 0)
last-org-file) last-org-file)
@@ -3943,7 +3940,4 @@ Need chrome... :(
(map! :map org-mode-map (map! :map org-mode-map
:localleader :localleader
:desc "Edit Edna rules" "E" #'org-edna-edit)) :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 (interactive
(list (completing-read "Category: " '("1-Projects" "2-Areas" "3-Resources")) (list (completing-read "Category: " '("1-Projects" "2-Areas" "3-Resources"))
(read-string "Node Name: ") (read-string "Node Name: ")
(read-string "Project tag (slug for agenda/email per project filtering): ") (read-string "Project tag: ")
(read-string "Context tag (slug for agenda/email per context filtering): "))) (read-string "Context tag: ")))
(let* ((category-dir (expand-file-name category gortium/exokortex-root)) (let* ((category-dir (expand-file-name category gortium/exokortex-root))
(node-dir (expand-file-name node-name category-dir)) (node-dir (expand-file-name node-name category-dir))
(org-file (gortium/ensure-node-structure node-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. 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." Optional PROJECT-TAG and CONTEXT-TAG can be given to create .projectile and .dir-locals.el."
(interactive (interactive
(list (let* ((dired-elements (when (derived-mode-p 'dired-mode)
(let* ((dired-elements (when (derived-mode-p 'dired-mode) (dired-get-marked-files nil nil nil t)))
(dired-get-marked-files nil nil nil t))) (has-explicit-marks (or (and (listp dired-elements) (> (length dired-elements) 1))
(has-explicit-marks (or (and (listp dired-elements) (> (length dired-elements) 1)) (and (consp dired-elements) (eq (car dired-elements) t))))
(and (consp dired-elements) (eq (car dired-elements) t)))) (marked-dirs (when has-explicit-marks
(marked-dirs (when has-explicit-marks (cl-remove-if-not #'file-directory-p
(cl-remove-if-not #'file-directory-p (if (eq (car-safe dired-elements) t)
(if (eq (car-safe dired-elements) t) (cdr dired-elements)
(cdr dired-elements) dired-elements))))
dired-elements))))) (dirs (or marked-dirs
(if marked-dirs (let* ((cursor-path (when (derived-mode-p 'dired-mode)
(list marked-dirs (dired-get-filename nil t)))
(read-string "Project tag (blank to skip): ") (initial-path (cond
(completing-read "Context tag: " (quote ("TDNDE" "Perso" "")) nil t)) ((and cursor-path (file-directory-p cursor-path))
(let* ((cursor-path (when (derived-mode-p 'dired-mode) cursor-path)
(dired-get-filename nil t))) (cursor-path
(initial-path (cond (file-name-directory cursor-path))
((and cursor-path (file-directory-p cursor-path)) (t default-directory))))
cursor-path) (list (read-directory-name "Directory to convert: " nil initial-path t initial-path)))))
(cursor-path (tag (read-string "Project tag (blank to skip): "))
(file-name-directory cursor-path)) (ctx (completing-read "Context tag: " (quote ("TDNDE" "Perso" "")) nil t)))
(t default-directory)))) (list dirs tag ctx)))
(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 ((count 0) (let ((count 0)
last-org-file) last-org-file)