From a91bb208a347441e5332a537e5b56840bd9e47e3 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sun, 8 Nov 2020 23:29:41 -0600 Subject: [PATCH] Notes: Update --- notes.org | 87 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 64 insertions(+), 23 deletions(-) diff --git a/notes.org b/notes.org index 5452820..12ec0a7 100644 --- a/notes.org +++ b/notes.org @@ -20,11 +20,9 @@ :END: :CONTENTS: - [[#add-auto-keyword-to-planning-predicate][Add :auto keyword to (planning) predicate]] -- [[#consider-using-parsec-for-parsing-queries][Consider using parsec for parsing queries]] - [[#document-sorters][Document sorters]] - [[#org-block-to-insert-results-of-queries-with-links-to-entries][Org block to insert results of queries with links to entries]] - [[#outline-path-in-buffers-files-arg][Outline path in buffers-files arg]] -- [[#tools-for-saving-queries-and-accessing-them-24][Tools for saving queries and accessing them {2/4}]] - [[#add-more-sorters][Add more sorters?]] - [[#change-deadlines-auto-argument-to-auto-andor-auto-t][Change (deadline)'s auto argument to :auto and/or :auto t]] - [[#default-sort][Default sort]] @@ -39,9 +37,11 @@ - [[#org-agenda-skip-function][org-agenda-skip-function]] - [[#test-caching][Test caching]] - [[#update-commentary][Update commentary]] +- [[#tools-for-saving-queries-and-accessing-them-34][Tools for saving queries and accessing them {3/4}]] - [[#outline-path-predicate][Outline path predicate]] - [[#node-caching]["Node" caching]] - [[#implement-view-with-tabulated-list-mode-or-magit-section][Implement view with tabulated-list-mode or magit-section]] +- [[#consider-using-parsec-for-parsing-queries][Consider using parsec for parsing queries]] - [[#overlay-based-caching-inspired-by-org-num-mode][Overlay-based caching inspired by org-num-mode]] - [[#use-bovine-or-wisent-to-parse-non-sexp-syntax][Use Bovine or Wisent to parse non-sexp syntax]] - [[#fancier-searching-for-inherited-tags][Fancier searching for inherited tags]] @@ -79,27 +79,6 @@ e.g. Also, should support an ~id~ one. -** TODO [#A] Tools for saving queries and accessing them [2/4] - -+ Added example to =examples.org=. - -*** TODO Bookmarks - -*** TODO Org link types -:PROPERTIES: -:ID: 4db73c1c-a4ed-425e-9e38-8d334ed03e1e -:END: - -This would be useful for having a menu of saved queries as Org links, or even bookmarking saved queries. - -**** TODO For all parameters - -**** TODO For saved queries - -*** DONE Access saved query from saved query list - -*** DONE Save query from ql-agenda buffer - ** TODO [#B] Add more sorters? + [ ] =category= @@ -430,6 +409,68 @@ See notes on 1dce9467f25428b5289d3665cd840820969ed65a. It would be good to test ** TODO [#C] Update commentary +** UNDERWAY [#A] Tools for saving queries and accessing them [3/4] + ++ Added example to =examples.org=. + +*** UNDERWAY [#A] Org link types +:PROPERTIES: +:ID: 4db73c1c-a4ed-425e-9e38-8d334ed03e1e +:END: + +This would be useful for having a menu of saved queries as Org links, or even bookmarking saved queries. + +[2020-11-08 Sun 22:59] Let's try a very simple implementation so I could write a link like this to search the current buffer: + +#+BEGIN_SRC org + [[org-ql-search:property:author="AUTHOR"]] +#+END_SRC + +[2020-11-08 Sun 23:22] Seems to work! + +#+BEGIN_SRC elisp + ;;;; Org link type + + ;; This section adds a custom link type to Org. See info:org#Adding hyperlink types. + + (org-link-set-parameters "org-ql-search" + :follow #'org-ql-search--link-open + :store #'org-ql-search--link-store) + + (defun org-ql-search--link-open (query) + "Open Org QL QUERY for current buffer." + (org-ql-search (current-buffer) query)) + + (defun org-ql-search--link-store () + "Store a link to current Org QL query." + ;; TODO: When we have an org-ql-view-mode, test it here instead of org-ql-view-query. + (when org-ql-view-query + (org-store-link-props :type "org-ql-search" + :link (concat "org-ql-search:" (org-ql-view--format-query org-ql-view-query)) + :description org-ql-view-title) + t)) +#+END_SRC + +Tested on these queries: + +#+BEGIN_SRC org + + [[org-ql-search:(property%20:author%20"Chris%20Wellons")][org-ql-search:(property :author "Chris Wellons")]] + + [[org-ql-search:(link%20"nullprogram")][org-ql-search:(link "nullprogram")]] + + [[org-ql-search:link:nullprogram]] +#+END_SRC + +**** TODO For all parameters + +**** TODO For saved queries + +*** DONE Bookmarks + +[2020-11-08 Sun 23:25] Already done in =e5b4cd106558790563af26a8e32ec9508f904855=. + +*** DONE Access saved query from saved query list + +*** DONE Save query from ql-agenda buffer + ** UNDERWAY [#A] Outline path predicate [2019-10-07 Mon 11:15] There are two potential types of matching on outline paths: matching on any part of the outline path, and matching a specific path. For example, with this file: