Skip to content

Commit 17db89d

Browse files
committed
Build org-agenda view from helm-org-ql selection
1 parent 3bb12e3 commit 17db89d

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

config.org

+22-2
Original file line numberDiff line numberDiff line change
@@ -8842,7 +8842,8 @@ Also, no contexts are prompted in Inbox agenda.
88428842
(unless (eq major-mode 'org-agenda-mode) (user-error "Cannot run %s outside agenda view" this-command))
88438843
(when (and (memq this-command '(org-agenda yant/org-agenda-filter-by-location-context))
88448844
(not (string= org-agenda-name "Inbox items"))
8845-
(not (string= org-agenda-name "Hanging tasks")))
8845+
(not (string= org-agenda-name "Hanging tasks"))
8846+
(not (bound-and-true-p 'org-agenda-skip-location-context)))
88468847
(unless (local-variable-p 'org-global-tags-completion-table)
88478848
(setq-local org-global-tags-completion-table
88488849
(org-global-tags-completion-table)))
@@ -9844,12 +9845,31 @@ into (not QUERY)."
98449845
(defun yant/helm-org-ql-open-url (marker)
98459846
"Open URL from link"
98469847
(org-open-link-from-string (org-entry-get marker "Source")))
9848+
(defun yant/helm-org-ql-show-in-agenda (markers)
9849+
"Show agenda view with all the matches."
9850+
(let ((org-agenda-skip-function `(lambda ()
9851+
(org-back-to-heading t)
9852+
(let ((markerhere (point-marker))
9853+
(markers ',(helm-marked-candidates)))
9854+
(setq markers (-filter (lambda (marker) (eq (current-buffer) (marker-buffer marker))) markers))
9855+
(if (member (point-marker) markers)
9856+
nil
9857+
(while (and markers
9858+
(> markerhere (car markers)))
9859+
(setq markers (cdr markers)))
9860+
(if (car markers)
9861+
(goto-char (car markers))
9862+
(goto-char (point-max)))))))
9863+
(org-agenda-skip-location-context t)
9864+
(org-agenda-sticky nil))
9865+
(org-tags-view nil "!")))
98479866
:custom
98489867
(helm-org-ql-actions '(("Insert link to heading" . yant/helm-org-ql-create-link)
98499868
("Go to heading" . helm-org-ql-show-marker)
98509869
("Open heading source" . yant/helm-org-ql-open-url)
98519870
("Insert URL of heading" . yant/helm-org-ql-insert-url)
9852-
("Refile heading(s) to heading at point" . helm-org--refile-heading-here)))
9871+
("Refile heading(s) to heading at point" . helm-org--refile-heading-here)
9872+
("Show in agenda" . yant/helm-org-ql-show-in-agenda)))
98539873
)
98549874
#+end_src
98559875

0 commit comments

Comments
 (0)