Skip to content

Commit

Permalink
Tidy: Compilation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
alphapapa committed Mar 9, 2023
1 parent d86a402 commit d21da36
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 47 deletions.
1 change: 1 addition & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions helm-org-ql.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions org-ql-completing-read.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion org-ql-find.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 14 additions & 2 deletions org-ql-search.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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').
Expand Down Expand Up @@ -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))))
Expand Down
7 changes: 4 additions & 3 deletions org-ql-view.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))))
Expand Down
21 changes: 10 additions & 11 deletions org-ql.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down Expand Up @@ -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.
Expand Down
59 changes: 30 additions & 29 deletions org-ql.info
Original file line number Diff line number Diff line change
Expand Up @@ -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’
Expand Down Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion tests/test-org-ql.el
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
(require 'with-simulated-input)

(require 'org-ql)
(require 'org-ql-search)
(require 'org-ql-view)

;;;; Variables
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit d21da36

Please sign in to comment.