[feature request] Add option to capture a new heading right from helm-org-ql buffer#238
Open
yantar92 wants to merge 1 commit intoalphapapa:masterfrom
Open
[feature request] Add option to capture a new heading right from helm-org-ql buffer#238yantar92 wants to merge 1 commit intoalphapapa:masterfrom
yantar92 wants to merge 1 commit intoalphapapa:masterfrom
Conversation
Owner
|
It's an interesting idea, and one I think I've seen in other places. I'm not necessarily opposed to it, but I don't know exactly how it would work. Ideally I guess there would be some kind of "common" Helm actions list for Org headings that we could use, rather than implementing this specifically and only in |
Contributor
Author
|
... Ideally I guess there would be some kind of "common" Helm actions list for Org headings that we could use, rather than implementing this specifically and only in `helm-org-ql`.
I guess "create new heading" as a helm action can be an option, though I
had something similar to helm-mini in mind.
In helm-mini, there is helm-source-buffer-not-found source used to
create a new buffer. Similarly, helm-org-ql can use something like the
following:
(cl-defun yant/helm-org-ql-agenda-files (arg)
"Like `helm-org-ql-agenda-files', but also allow creating a new heading."
(interactive "P")
(let ((files (if arg (org-agenda-files t t) (org-agenda-files t))))
(helm :prompt (format "Query (boolean and): ")
:sources (list (helm-org-ql-source files :name "Org Agenda Files")
(helm-build-sync-source "Create new"
:candidates
(lambda ()
(if (string-empty-p helm-pattern)
(list "New note")
(list (format "New note: \"%s\"" (string-clean-whitespace helm-pattern)))))
:match #'identity
:match-dynamic t
:nohighlight t
:action
'(("New note" . (lambda (_)
(let ((helm-org-ql-default-title helm-pattern))
(org-capture nil "N"))))))))))
Of course, the "new note" source can be also added to other helm-org-ql
commands.
The problem with the above code is hard-coded capture template. I am not
sure what would be the best way to deal with it, especially how to set
the default template.
|
Owner
|
I see, well, that's an interesting idea. I feel like it might be a bit out-of-scope for org-ql to include by default, but I'm not strictly against it. |
4f5fbc4 to
d0acc8c
Compare
059b10c to
77b4c2b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Similar to org-roam's search behaviour, it might be a useful addition to allow creating a new heading when interactive helm-org-ql's query fails.
I imagine something like in the attached screenshot:

WDYT?