diff --git a/README.org b/README.org index 3e574040..7b66d344 100644 --- a/README.org +++ b/README.org @@ -559,6 +559,7 @@ Simple links may also be written manually in either sexp or non-sexp form, like: *Fixed* + Predicate ~src~'s matching of begin/end block lines, normalization of arguments, and handling in non-sexp queries. (Thanks to [[https://github.com/akirak][Akira Komamura]] for reporting.) + Predicate ~src~'s behavior with various arguments. ++ Various compilation warnings. *Internal* + Certain query predicates, when called multiple times in an ~and~ sub-expression, are optimized to a single call. diff --git a/helm-org-ql.el b/helm-org-ql.el index 02eff9ae..5d460a52 100644 --- a/helm-org-ql.el +++ b/helm-org-ql.el @@ -98,6 +98,8 @@ Based on `helm-map'.") Interactively, search the current buffer. Note that this command only accepts non-sexp, \"plain\" queries. +NAME is passed to `helm-org-ql-source', which see. + NOTE: Atoms in the query are turned into strings where appropriate, which makes it unnecessary to type quotation marks around words that are intended to be searched for as indepenent diff --git a/org-ql-completing-read.el b/org-ql-completing-read.el index 81d85570..b1ef11a1 100644 --- a/org-ql-completing-read.el +++ b/org-ql-completing-read.el @@ -81,6 +81,7 @@ For an experience like `org-rifle', use a newline." (cl-defun org-ql-completing-read (buffers-files &key query-prefix query-filter (prompt "Find entry: ")) "Return marker at Org entry in BUFFERS-FILES selected with `org-ql'. +PROMPT is shown to the user. QUERY-PREFIX may be a string to prepend to the query entered by the user (e.g. use \"heading:\" to only search headings, easily diff --git a/org-ql-find.el b/org-ql-find.el index d9ccad9f..9483c614 100644 --- a/org-ql-find.el +++ b/org-ql-find.el @@ -55,7 +55,7 @@ See function `display-buffer'." (prompt "Find entry: ")) "Go to an Org entry in BUFFERS-FILES selected by searching entries with `org-ql'. Interactively, with universal prefix, select multiple buffers to -search with completion. +search with completion and PROMPT. QUERY-PREFIX may be a string to prepend to the query (e.g. use \"heading:\" to only search headings, easily creating a custom diff --git a/org-ql-search.el b/org-ql-search.el index 1d47be33..f2fd9534 100644 --- a/org-ql-search.el +++ b/org-ql-search.el @@ -47,6 +47,18 @@ (t (warn "org-ql: Unable to define alias `org-ql-search--link-heading-search-string'. This may affect links in dynamic blocks. Please report this as a bug.") #'identity))) +(defalias 'org-ql-search--org-make-link-string + (cond ((fboundp 'org-link-make-string) #'org-link-make-string) + ((fboundp 'org-make-link-string) #'org-make-link-string) + (t (warn "org-ql: Unable to define alias `org-ql-search--org-make-link-string'. Please report this as a bug.") + #'identity))) + +(defalias 'org-ql-search--org-link-store-props + (cond ((fboundp 'org-link-store-props) #'org-link-store-props) + ((fboundp 'org-store-link-props) #'org-store-link-props) + (t (warn "org-ql: Unable to define alias `org-ql-search--org-link-store-props'. Please report this as a bug.") + #'identity))) + ;;;; Variables (defvar org-ql-block-header nil @@ -138,7 +150,7 @@ SUPER-GROUPS: An `org-super-agenda' group set. See variable selectors'. NARROW: When non-nil, don't widen buffers before -searching. Interactively, with prefix, leave narrowed. +searching. Interactively, with prefix, leave narrowed. SORT: One or a list of `org-ql' sorting functions, like `date' or `priority' (see Info node `(org-ql)Listing / acting-on results'). @@ -299,7 +311,7 @@ this (must be a single line in the Org buffer): (cons 'heading (lambda (element) (let ((normalized-heading (org-ql-search--link-heading-search-string (org-element-property :raw-value element)))) - (org-make-link-string normalized-heading (org-link-display-format normalized-heading))))) + (org-ql-search--org-make-link-string normalized-heading (org-link-display-format normalized-heading))))) (cons 'priority (lambda (element) (--when-let (org-element-property :priority element) (char-to-string it)))) diff --git a/org-ql-view.el b/org-ql-view.el index 95dfe3b4..5a03b80f 100644 --- a/org-ql-view.el +++ b/org-ql-view.el @@ -44,6 +44,7 @@ ;; clearly is. It seems to not handle cl-defun, even though its code ;; appears to account for it. (declare-function org-ql-search "org-ql-search" t) +(declare-function org-ql-search--org-link-store-props "org-ql-search" t) (require 'dash) (require 's) @@ -288,7 +289,8 @@ TYPE may be `ts', `ts-active', `ts-inactive', `clocked', or ;;;###autoload (cl-defun org-ql-view-sidebar (&key (slot org-ql-view-list-slot)) - "Show `org-ql-view' view list sidebar." + "Show `org-ql-view' view list sidebar. +SLOT is passed to `display-buffer-in-side-window', which see." ;; TODO: Update sidebar when `org-ql-views' changes. (interactive) (select-window @@ -688,8 +690,7 @@ When opened, the link searches the buffer it's opened from." "?" (url-build-query-string (delete nil params)))) (url (url-recreate-url (url-parse-make-urlobj "org-ql-search" nil nil nil nil filename)))) - ;; FIXME: "Warning: ‘org-store-link-props’ is an obsolete function (as of Org 9.3); use ‘org-link-store-props’ instead" - (org-store-link-props + (org-ql-search--org-link-store-props :type "org-ql-search" :link url :description (concat "org-ql-search: " org-ql-view-title)))) diff --git a/org-ql.el b/org-ql.el index 22fa86f0..9bb05fd6 100644 --- a/org-ql.el +++ b/org-ql.el @@ -75,10 +75,10 @@ That is, \"CLOSED:\", \"DEADLINE:\", or \"SCHEDULED:\".") Tags are stored in match group 1. Match group 2 stores the tags without the enclosing colons.") -(defconst org-ql-link-regexp +(defvaralias 'org-ql-link-regexp (if (bound-and-true-p org-link-bracket-re) - org-link-bracket-re - org-bracket-link-regexp) + 'org-link-bracket-re + 'org-bracket-link-regexp) "Regexp used to match Org bracket links. Necessary because of changes in Org 9.something.") @@ -1347,18 +1347,17 @@ result form." ;; NOTE: This was a defsubst before being defined with the macro. Might be good to make it a defsubst again. :body (or (apply #'org-ql--predicate-todo org-done-keywords))) -(defun org-ql--duration-to-minutes (duration) +(defalias 'org-ql--duration-to-minutes + ;; TODO: Remove when compatibility with Org 9.0 is dropped. + (cond ((fboundp 'org-duration-to-minutes) #'org-duration-to-minutes) + ((fboundp 'org-duration-string-to-minutes) #'org-duration-string-to-minutes) + (t (warn "org-ql: Unable to define alias `org-ql-search--link-heading-search-string'. Please report this as a bug.") + #'identity)) "Return DURATION string as a number of minutes. For compatibility, since Org 9.1 deprecated `org-duration-string-to-minutes', replacing it with `org-duration-to-minutes', which seems to return floats instead -of integers." - ;; FIXME: Define this as an alias instead. - ;; MAYBE: Remove if compatibility with Org 9.0 is dropped. - (funcall (if (fboundp 'org-duration-to-minutes) - #'org-duration-to-minutes - #'org-duration-string-to-minutes) - duration)) +of integers.") (org-ql-defpred effort (&optional effort-or-comparator effort) "Return non-nil if current heading's effort property matches arguments. diff --git a/org-ql.info b/org-ql.info index caee1f63..68572390 100644 --- a/org-ql.info +++ b/org-ql.info @@ -1052,6 +1052,7 @@ File: README.info, Node: 07-pre, Next: 063, Up: Changelog of arguments, and handling in non-sexp queries. (Thanks to Akira Komamura (https://github.com/akirak) for reporting.) • Predicate ‘src’’s behavior with various arguments. + • Various compilation warnings. *Internal* • Certain query predicates, when called multiple times in an ‘and’ @@ -1727,35 +1728,35 @@ Node: Links37140 Node: Tips37827 Node: Changelog38151 Node: 07-pre38934 -Node: 06341399 -Node: 06241934 -Node: 06142239 -Node: 0642807 -Node: 05245861 -Node: 05146161 -Node: 0546584 -Node: 04948113 -Node: 04848393 -Node: 04748742 -Node: 04649151 -Node: 04549559 -Node: 04449920 -Node: 04350279 -Node: 04250482 -Node: 04150643 -Node: 0450890 -Node: 03254991 -Node: 03155394 -Node: 0355591 -Node: 02358891 -Node: 02259125 -Node: 02159405 -Node: 0259610 -Node: 0163688 -Node: Notes63789 -Node: Comparison with Org Agenda searches63951 -Node: org-sidebar64840 -Node: License65119 +Node: 06341436 +Node: 06241971 +Node: 06142276 +Node: 0642844 +Node: 05245898 +Node: 05146198 +Node: 0546621 +Node: 04948150 +Node: 04848430 +Node: 04748779 +Node: 04649188 +Node: 04549596 +Node: 04449957 +Node: 04350316 +Node: 04250519 +Node: 04150680 +Node: 0450927 +Node: 03255028 +Node: 03155431 +Node: 0355628 +Node: 02358928 +Node: 02259162 +Node: 02159442 +Node: 0259647 +Node: 0163725 +Node: Notes63826 +Node: Comparison with Org Agenda searches63988 +Node: org-sidebar64877 +Node: License65156  End Tag Table diff --git a/tests/test-org-ql.el b/tests/test-org-ql.el index c884971e..3af35371 100644 --- a/tests/test-org-ql.el +++ b/tests/test-org-ql.el @@ -30,6 +30,7 @@ (require 'with-simulated-input) (require 'org-ql) +(require 'org-ql-search) (require 'org-ql-view) ;;;; Variables @@ -200,7 +201,10 @@ with keyword arg NOW in PLIST." (insert "* Heading 1") ;; FIXME: `--value-at' does not actually move point, so we do it here. (goto-char (point-min)) - (expect (org-ql--value-at (point-min) #'org-get-local-tags) + (expect (org-ql--value-at (point-min) + ;; TODO: Just use org-get-tags when requiring Org 9.2+. + (cond ((fboundp 'org-get-tags) #'org-get-tags) + ((fboundp 'org-get-local-tags) #'org-get-local-tags))) :to-be nil)))) (describe "Query pre-processing"