diff options
author | Thanos Apollo <[email protected]> | 2025-02-26 13:18:26 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2025-02-26 13:34:52 +0200 |
commit | a6dbd9b7d2b5dcb26b0e469c3f938b5c49c9485a (patch) | |
tree | 5ebf8c7de6a7be284b8cc119297ce294c8c7813f | |
parent | 0e17db1213ddce55df5ded59787dae6f10d036b0 (diff) |
[Feature] insert: When called with prefix, prompt for custom description.
+ org-gnosis-insert called with prefix arg, insert link using custom
title.
+ Adjust org-gnosis-insert for new org-gnosis-select.
-rw-r--r-- | org-gnosis.el | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/org-gnosis.el b/org-gnosis.el index 8f72ddc..29f4562 100644 --- a/org-gnosis.el +++ b/org-gnosis.el @@ -441,16 +441,17 @@ If templates is only item, return it without a prompt." (funcall (apply #'append template)))) ;;;###autoload -(defun org-gnosis-insert (&optional journal-p) +(defun org-gnosis-insert (arg &optional journal-p) "Insert gnosis node. +If called with ARG, prompt for custom link description. If JOURNAL-P is non-nil, retrieve/create node as a journal entry." (interactive "P") (let* ((table (if journal-p 'journal 'nodes)) (node (org-gnosis--find "Select gnosis node: " (org-gnosis-select '[title tags] table) (org-gnosis-select 'title table))) - (id (concat "id:" (car (org-gnosis-select 'id table `(= ,node title)))))) + (id (concat "id:" (car (org-gnosis-select 'id table `(= ,node title) t))))) (cond ((< (length id) 4) ; if less that 4 then `org-gnosis-select' returned nil, (id:) (save-window-excursion (org-gnosis--create-file @@ -459,10 +460,10 @@ If JOURNAL-P is non-nil, retrieve/create node as a journal entry." (save-buffer) (setf id (concat "id:" - (car (org-gnosis-select 'id table `(= ,node title)))))) + (car (org-gnosis-select 'id table `(= ,node title) t))))) (org-insert-link nil id node) (message "Created new node: %s" node)) - (t (org-insert-link nil id node))))) + (t (org-insert-link nil id (if arg (read-string "Description: ") node)))))) (defun org-gnosis-insert-filetag (&optional tag) |