From b947fd620c590068794d5e142953b4f039abf653 Mon Sep 17 00:00:00 2001 From: Konstantin Borisov Date: Fri, 7 Mar 2025 02:49:22 +0700 Subject: [PATCH 1/2] * org-ql-find added initial-input parameter --- org-ql-completing-read.el | 8 +++++--- org-ql-find.el | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/org-ql-completing-read.el b/org-ql-completing-read.el index 93dbf009..80aae7f1 100644 --- a/org-ql-completing-read.el +++ b/org-ql-completing-read.el @@ -134,7 +134,7 @@ value, or nil." ;;;###autoload (cl-defun org-ql-completing-read - (buffers-files &key query-prefix query-filter narrowp + (buffers-files &key query-prefix query-filter narrowp initial-input (action #'org-ql-completing-read-action) ;; FIXME: Unused argument. ;; (annotate #'org-ql-completing-read-snippet) @@ -156,7 +156,9 @@ QUERY-FILTER may be a function through which the query the user types is filtered before execution (e.g. it could replace spaces with commas to turn multiple tokens, which would normally be treated as multiple predicates, into multiple arguments to a -single predicate)." +single predicate). + +INITIAL-INPUT may be a string to initially be filled in the query." (declare (indent defun)) ;; Emacs's completion API is not always easy to understand, especially when using "programmed ;; completion." This code was made possible by the example Clemens Radermacher shared at @@ -351,7 +353,7 @@ single predicate)." (abort-recursive-edit)))) ((symbol-function 'embark-export) (symbol-function 'org-ql-completing-read-export))) - (completing-read prompt #'collection nil t))))) + (completing-read prompt #'collection nil t initial-input))))) ;; (debug-message "SELECTED:%S KEYS:%S" selected (hash-table-keys table)) (or (gethash selected table) ;; If there are completions in the table, but none of them exactly match the user input diff --git a/org-ql-find.el b/org-ql-find.el index e6c47952..4ca95511 100644 --- a/org-ql-find.el +++ b/org-ql-find.el @@ -55,7 +55,7 @@ See function `display-buffer'." ;;;###autoload (cl-defun org-ql-find (buffers-files &key query-prefix query-filter widen - (prompt "Find entry: ")) + initial-input (prompt "Find entry: ")) "Go to an Org entry in BUFFERS-FILES selected by searching entries with `org-ql'. Interactively, search the buffers and files relevant to the current buffer (i.e. in `org-agenda-mode', the value of @@ -75,7 +75,9 @@ QUERY-FILTER may be a function through which the query the user types is filtered before execution (e.g. it could replace spaces with commas to turn multiple tokens, which would normally be treated as multiple predicates, into multiple arguments to a -single predicate)." +single predicate). + +INITIAL-INPUT may be a string to initially be filled in the query." (interactive (list (org-ql-find--buffers :read-buffer-p (equal '(16) current-prefix-arg)) :widen current-prefix-arg)) @@ -86,6 +88,7 @@ single predicate)." :narrowp (not widen) :query-prefix query-prefix :query-filter query-filter + :initial-input initial-input :prompt prompt)))) (set-buffer (or (buffer-base-buffer (marker-buffer marker)) (marker-buffer marker))) From 666bff4d1dbcf23dea28c90c79b1c52ef63856ab Mon Sep 17 00:00:00 2001 From: Musa Al-hassy Date: Sun, 20 Apr 2025 07:50:43 -0400 Subject: [PATCH 2/2] =?UTF-8?q?Docs:=20Remove=20grammatical=20typo=20from?= =?UTF-8?q?=20=E2=80=9Corg-ql-search-block=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- org-ql-search.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org-ql-search.el b/org-ql-search.el index 9c0aa868..dc7c1301 100644 --- a/org-ql-search.el +++ b/org-ql-search.el @@ -235,7 +235,7 @@ Like other agenda block commands, it searches files returned by function `org-agenda-files'. Inserts a newline after the block. If `org-ql-block-header' is non-nil, it is used as the header -string for the block, otherwise a the header is formed +string for the block, otherwise the header is formed automatically from the query." (let (narrow-p old-beg old-end) (when-let* ((from (pcase org-agenda-restrict