Skip to content

Commit fcb4e3e

Browse files
committed
Merge: v0.8.8
2 parents b0cb761 + 20c0e5a commit fcb4e3e

5 files changed

+173
-147
lines changed

README.org

+7
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,13 @@ Simple links may also be written manually in either sexp or non-sexp form, like:
567567

568568
Tagged v0.6.2, fixing a compilation warning.
569569

570+
** 0.8.8
571+
572+
*Fixes*
573+
+ Remove text properties from to-do keywords before displaying them in an ~org-ql-view~ buffer. (Such text properties could cause them to, e.g. display with extra leading spaces, depending on which other modes might be enabled in the source Org buffer.)
574+
+ Binding of ~completion-styles-alist~ in ~org-ql-completing-read~. (This fixes compatibility with Helm's ~helm~ completion style, as well as default Emacs completion in recursive minibuffers. [[https://github.com/alphapapa/org-ql/issues/337][#337]]. Thanks to [[https://github.com/progfolio][Nicholas Vollmer]], [[https://github.com/9viz][viz]], and [[https://github.com/karthink][Karthik Chikmagalur]] for reporting and suggesting fixes.)
575+
+ Use of the context snippet function for ~org-ql-completing-read~. ([[https://github.com/alphapapa/org-ql/issues/419][#419]]. Thanks to [[https://github.com/tpeacock19][tpeacock19]] for reporting.)
576+
570577
** 0.8.7
571578

572579
*Fixes*

org-ql-completing-read.el

+16-23
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,10 @@
5050
:type 'boolean)
5151

5252
(defcustom org-ql-completing-read-snippet-function #'org-ql-completing-read--snippet-simple
53-
;; TODO: I'd like to make the -regexp one the default, but with
54-
;; default Emacs completion affixation, it can sometimes be a bit
55-
;; slow, and I don't want that to be a user's first impression. It
56-
;; may be possible to further optimize the -regexp one so that it
57-
;; can be used by default. In the meantime, the -simple one seems
58-
;; fast enough for general use.
53+
;; TODO(v0.9): Performance of completion annotations seems to be
54+
;; much improved now (whether due to changes in Emacs, Vertico, or
55+
;; both, I don't know). It may be reasonable to make the context
56+
;; snippet the default now.
5957
"Function used to annotate results in `org-ql-completing-read'.
6058
Function is called at entry beginning. (When set to
6159
`org-ql-completing-read--snippet-regexp', it is called with a
@@ -109,11 +107,13 @@ value, or nil."
109107
;; responsive as, e.g. Helm while typing, but it seems to
110108
;; help a little when using the org-rifle-style snippets.
111109
(org-with-point-at marker
112-
(or (funcall org-ql-completing-read-snippet-function)
110+
(or (funcall org-ql-completing-read-snippet-function
111+
org-ql-completing-read-input-regexp)
113112
(org-ql-completing-read--snippet-simple))))
114113
(`t ;; Interrupted: return nil (which can be concatted).
115114
nil)
116-
(else else)))
115+
(else (propertize (concat " " else)
116+
'face 'org-ql-completing-read-snippet))))
117117

118118
(defun org-ql-completing-read-path (marker)
119119
"Return formatted outline path for entry at MARKER."
@@ -219,15 +219,7 @@ single predicate)."
219219
;; Using `while-no-input' here doesn't make it as responsive as,
220220
;; e.g. Helm while typing, but it seems to help a little when using the
221221
;; org-rifle-style snippets.
222-
(or (snippet (get-text-property 0 'org-marker candidate)) "")))
223-
(snippet (marker)
224-
(when-let
225-
((snippet
226-
(org-with-point-at marker
227-
(or (funcall org-ql-completing-read-snippet-function org-ql-completing-read-input-regexp)
228-
(org-ql-completing-read--snippet-simple)))))
229-
(propertize (concat " " snippet)
230-
'face 'org-ql-completing-read-snippet)))
222+
(or (funcall snippet (get-text-property 0 'org-marker candidate)) "")))
231223
(group (candidate transform)
232224
(pcase transform
233225
(`nil (buffer-name (marker-buffer (get-text-property 0 'org-marker candidate))))
@@ -341,7 +333,8 @@ single predicate)."
341333
;; `completing-read'.
342334
(mapc #'org-ql--ensure-buffer buffers-files)
343335
(let* ((completion-styles '(org-ql-completing-read))
344-
(completion-styles-alist (list (list 'org-ql-completing-read #'try #'all "Org QL Find")))
336+
(completion-styles-alist (cons (list 'org-ql-completing-read #'try #'all "Org QL Find")
337+
completion-styles-alist))
345338
(selected
346339
(minibuffer-with-setup-hook
347340
(lambda ()
@@ -373,7 +366,7 @@ single predicate)."
373366
(car (hash-table-values table))
374367
(user-error "No results for input"))))))
375368

376-
(defun org-ql-completing-read--snippet-simple ()
369+
(defun org-ql-completing-read--snippet-simple (&optional _input-regexp)
377370
"Return a snippet of the current entry.
378371
Returns up to `org-ql-completing-read-snippet-length' characters."
379372
(save-excursion
@@ -387,15 +380,15 @@ Returns up to `org-ql-completing-read-snippet-length' characters."
387380
t t)
388381
50 nil nil t))))))
389382

390-
(defun org-ql-completing-read--snippet-regexp (regexp)
391-
"Return a snippet of the current entry's matches for REGEXP."
383+
(defun org-ql-completing-read--snippet-regexp (&optional input-regexp)
384+
"Return a snippet of the current entry's matches for INPUT-REGEXP."
392385
;; REGEXP may be nil if there are no qualifying tokens in the query.
393-
(when regexp
386+
(when input-regexp
394387
(save-excursion
395388
(org-end-of-meta-data t)
396389
(unless (org-at-heading-p)
397390
(let* ((end (org-entry-end-position))
398-
(snippets (cl-loop while (re-search-forward regexp end t)
391+
(snippets (cl-loop while (re-search-forward input-regexp end t)
399392
concat (match-string 0) concat ""
400393
do (goto-char (match-end 0)))))
401394
(unless (string-empty-p snippets)

org-ql-view.el

+2-1
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,8 @@ return an empty string."
878878
(title (--> (org-ql-view--add-faces element)
879879
(org-element-property :raw-value it)))
880880
(todo-keyword (-some--> (org-element-property :todo-keyword element)
881-
(org-ql-view--add-todo-face it)))
881+
(org-ql-view--add-todo-face
882+
(substring-no-properties it))))
882883
(tag-list (if org-use-tag-inheritance
883884
;; MAYBE: Use our own variable instead of `org-use-tag-inheritance'.
884885
(if-let ((marker (or (org-element-property :org-hd-marker element)

org-ql.el

+1-1
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@ defined in `org-ql-predicates' by calling `org-ql-defpred'."
11441144
(byte-compile 'org-ql--query-preamble)))
11451145

11461146
(cl-defmacro org-ql-defpred (name args docstring &key body preambles normalizers coalesce)
1147-
"Define an Org QL selector predicate `org-ql--predicate-NAME'.
1147+
"Define an Org QL selector predicate \\=`org-ql--predicate-NAME'.
11481148
NAME may be a symbol or a list of symbols: if a list, the first
11491149
is used as NAME and the rest are aliases. A function is only
11501150
created for NAME, not for aliases, so a normalizer should be used

0 commit comments

Comments
 (0)