branch: externals/consult commit 870afb498368a19e7f58cd7dc209de1b5f5acc75 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Rename consult--file-group to consult--prefix-group --- consult-info.el | 8 ++++---- consult.el | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/consult-info.el b/consult-info.el index e641d4de12..00a07fd310 100644 --- a/consult-info.el +++ b/consult-info.el @@ -82,7 +82,7 @@ (add-text-properties 0 (length node) (list 'consult--info-position (cons buffer bol) 'face 'consult-file - 'consult--file-group node) + 'consult--prefix-group node) cand) (push cand candidates)))))))) (nreverse candidates))) @@ -91,7 +91,7 @@ "Lookup info position marker given SELECTED candidate from CANDIDATES list." (when-let ((cand (car (member selected candidates))) (pos (get-text-property 0 'consult--info-position cand)) - (node (get-text-property 0 'consult--file-group cand)) + (node (get-text-property 0 'consult--prefix-group cand)) (matches (consult--point-placement cand (1+ (length node))))) (save-restriction (widen) @@ -107,7 +107,7 @@ (if (not cand) (funcall preview action nil) (let* ((pos (get-text-property 0 'consult--info-position cand)) - (node (get-text-property 0 'consult--file-group cand)) + (node (get-text-property 0 'consult--prefix-group cand)) (matches (consult--point-placement cand (1+ (length node)))) (dest (+ (cdr pos) (car matches)))) (funcall preview action @@ -152,7 +152,7 @@ :require-match t :sort nil :history '(:input consult-info--history) - :group #'consult--file-group + :group #'consult--prefix-group ;; TODO fix consult-man and consult-info embark integration ;; We have to set (alist-get '(general . consult-man) embark-default-action-overrides) ;; and (alist-get '(general . consult-info) embark-default-action-overrides) diff --git a/consult.el b/consult.el index 241d7c3930..d7b7289b8b 100644 --- a/consult.el +++ b/consult.el @@ -1003,6 +1003,13 @@ When no project is found and MAY-PROMPT is non-nil ask the user." "Return t if position POS lies in range `point-min' to `point-max'." (<= (point-min) pos (point-max))) +(defun consult--prefix-group (cand transform) + "Return title for CAND or TRANSFORM the candidate. +The candidate must have a `consult--prefix-group' property." + (if transform + (substring cand (1+ (length (get-text-property 0 'consult--prefix-group cand)))) + (get-text-property 0 'consult--prefix-group cand))) + (defun consult--type-group (types) "Return group function for TYPES." (lambda (cand transform) @@ -4555,8 +4562,8 @@ BUILDER is the command argument builder." (when highlight (funcall highlight content)) (setq str (concat file sep line sep content)) - ;; Store file name in order to avoid allocations in `consult--file-group' - (add-text-properties 0 file-len `(face consult-file consult--file-group ,file) str) + ;; Store file name in order to avoid allocations in `consult--prefix-group' + (add-text-properties 0 file-len `(face consult-file consult--prefix-group ,file) str) (put-text-property (1+ file-len) (+ 1 file-len line-len) 'face 'consult-line-number str) (when ctx (add-face-text-property (+ 2 file-len line-len) (length str) 'consult-grep-context 'append str)) @@ -4589,13 +4596,6 @@ FIND-FILE is the file open function, defaulting to `find-file'." cand (and (not (eq action 'return)) open)))))) -;; TODO rename also in affe -(defun consult--file-group (cand transform) - "Return title for CAND or TRANSFORM the candidate." - (if transform - (substring cand (1+ (length (get-text-property 0 'consult--file-group cand)))) - (get-text-property 0 'consult--file-group cand))) - (defun consult--grep-exclude-args () "Produce grep exclude arguments. Take the variables `grep-find-ignored-directories' and @@ -4625,7 +4625,7 @@ INITIAL is inital input." :add-history (consult--async-split-thingatpt 'symbol) :require-match t :category 'consult-grep - :group #'consult--file-group + :group #'consult--prefix-group :history '(:input consult--grep-history) :sort nil)))