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

add option to disable "no heading in buffer" warning #394

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion org-ql.el
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@ See Info node `(org-ql)Queries'."
(const outline-path)
(const outline-path-segment)))

(defcustom org-ql-warn-no-heading t
"Whether to display a warning message when a regular buffer with
no headings are searched."
:type 'boolean)

;;;; Functions

;;;;; Query execution
Expand Down Expand Up @@ -539,7 +544,7 @@ PREAMBLE-CASE-FOLD."
(if (not (org-at-heading-p))
(progn
;; No headings in buffer: return nil.
(unless (string-prefix-p " " (buffer-name))
(unless (or (not org-ql-warn-no-heading) (string-prefix-p " " (buffer-name)))
;; Not a special, hidden buffer: show message, because if a user accidentally
;; searches a buffer without headings, he might be confused.
(message "org-ql: No headings in buffer: %s" (current-buffer)))
Expand Down