From 18bfc231311511803e6518bb2b68d8e00ede23c0 Mon Sep 17 00:00:00 2001 From: Xu Jingcheng Date: Sat, 30 Dec 2023 22:17:15 -0600 Subject: [PATCH] add option to disable "no heading in buffer" warning --- org-ql.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/org-ql.el b/org-ql.el index 338c52af..5f20311b 100644 --- a/org-ql.el +++ b/org-ql.el @@ -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 @@ -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)))