Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Add autoload magic comments #36

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions org-ql-agenda.el
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ e.g. `org-ql-search' as desired."

;; FIXME: DRY these two macros.

;;;###autoload
(cl-defmacro org-ql-agenda (&rest args)
"Display an agenda-like buffer of entries in FILES that match QUERY.

Expand Down Expand Up @@ -260,11 +261,13 @@ TITLE: An optional string displayed in the header."
(customize-set-variable 'org-ql-views org-ql-views)
(customize-mark-to-save 'org-ql-views)))

;;;###autoload
(defun org-ql-view (&optional view)
"Choose and display a view stored in `org-ql-views'."
(interactive (list (completing-read "View: " (mapcar #'car org-ql-views))))
(call-interactively (alist-get view org-ql-views nil nil #'string=)))

;;;###autoload
(cl-defun org-ql-view-recent-items (days &optional (type 'ts) (files (org-agenda-files)))
"Show items in FILES from last DAYS days with timestamps of TYPE.
TYPE may be `ts', `ts-active', `ts-inactive', `clocked', or
Expand Down Expand Up @@ -336,6 +339,7 @@ TYPE may be `ts', `ts-active', `ts-inactive', `clocked', or
(org-agenda-finalize)
(goto-char (point-min)))))

;;;###autoload
(defun org-ql-agenda-block (query)
"Insert items for QUERY into current buffer.
QUERY should be an `org-ql' query form. Like other agenda block
Expand All @@ -361,6 +365,7 @@ the `match' item in the custom command form."
org-agenda-finalize-entries
insert)))

;;;###autoload (autoload 'org-ql-block "org-ql-agenda")
(defalias 'org-ql-block 'org-ql-agenda-block)

(defun org-ql-agenda--header-line-format (buffers-files query &optional title)
Expand Down
3 changes: 3 additions & 0 deletions org-ql.el
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ match."
(push (list :name ',pred-name :fn ',fn-name :docstring ,docstring :args ',args) org-ql-predicates)
(cl-defun ,fn-name ,args ,docstring ,@body))))

;;;###autoload
(cl-defmacro org-ql (buffers-or-files query &key sort narrow action)
"Expands into a call to `org-ql-select' with the same arguments.
For convenience, arguments should be unquoted."
Expand All @@ -135,6 +136,7 @@ For convenience, arguments should be unquoted."
(define-hash-table-test 'org-ql-hash-test #'equal (lambda (args)
(sxhash-equal (prin1-to-string args))))

;;;###autoload
(cl-defun org-ql-select (buffers-or-files query &key action narrow sort)
"Return items matching QUERY in BUFFERS-OR-FILES.

Expand Down Expand Up @@ -227,6 +229,7 @@ non-nil."
((pred functionp) (sort items sort))
(_ (user-error "SORT must be either nil, or one or a list of the defined sorting methods (see documentation)")))))

;;;###autoload
(cl-defun org-ql-query (&key (select 'element-with-markers) from where narrow order-by)
"Like `org-ql-select', but arguments are named more like a SQL query.

Expand Down