[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult 840484a041 1/3: Remove helper functions consult
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult 840484a041 1/3: Remove helper functions consult--buffer-map and consult--line |
Date: |
Thu, 1 Dec 2022 23:57:24 -0500 (EST) |
branch: externals/consult
commit 840484a0413babd34ba5dc30617fffe79a0a3d61
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Remove helper functions consult--buffer-map and consult--line
---
consult-imenu.el | 12 +++++++++-
consult.el | 67 ++++++++++++++++++--------------------------------------
2 files changed, 32 insertions(+), 47 deletions(-)
diff --git a/consult-imenu.el b/consult-imenu.el
index 58c6e7ad48..c0ee39b230 100644
--- a/consult-imenu.el
+++ b/consult-imenu.el
@@ -157,7 +157,17 @@ TYPES is the mode-specific types configuration."
(defun consult-imenu--multi-items (buffers)
"Return all imenu items from BUFFERS."
- (apply #'append (consult--buffer-map buffers #'consult-imenu--items-safe)))
+ (consult--with-increased-gc
+ (let ((reporter (make-progress-reporter "Collecting" 0 (length buffers))))
+ (prog1
+ (apply #'append
+ (seq-map-indexed (lambda (buf idx)
+ (with-current-buffer buf
+ (prog1 (consult-imenu--items-safe)
+ (progress-reporter-update
+ reporter (1+ idx) (buffer-name)))))
+ buffers))
+ (progress-reporter-done reporter)))))
(defun consult-imenu--jump (item)
"Jump to imenu ITEM via `consult--jump'.
diff --git a/consult.el b/consult.el
index bc18e8989e..3443bd7382 100644
--- a/consult.el
+++ b/consult.el
@@ -3048,29 +3048,6 @@ INPUT is the input string entered by the user."
(cons dest (cdr matches)))
pos)))
-(cl-defun consult--line (candidates &key curr-line prompt initial group)
- "Select from from line CANDIDATES and jump to the match.
-CURR-LINE is the current line. See `consult--read' for the arguments PROMPT,
-INITIAL and GROUP."
- (consult--read
- candidates
- :prompt prompt
- :annotate (consult--line-prefix curr-line)
- :group group
- :category 'consult-location
- :sort nil
- :require-match t
- ;; Always add last isearch string to future history
- :add-history (list (thing-at-point 'symbol) isearch-string)
- :history '(:input consult--line-history)
- :lookup #'consult--line-match
- :default (car candidates)
- ;; Add isearch-string as initial input if starting from isearch
- :initial (or initial
- (and isearch-mode
- (prog1 isearch-string (isearch-done))))
- :state (consult--location-state candidates)))
-
;;;###autoload
(defun consult-line (&optional initial start)
"Search for a matching line.
@@ -3082,15 +3059,28 @@ narrowing. Optional INITIAL input can be provided. The
search starting point is
changed if the START prefix argument is set. The symbol at point and the last
`isearch-string' is added to the future history."
(interactive (list nil (not (not current-prefix-arg))))
- (let ((curr-line (line-number-at-pos (point) consult-line-numbers-widen))
- (top (not (eq start consult-line-start-from-top))))
- (consult--line
- (or (consult--with-increased-gc
- (consult--line-candidates top curr-line))
- (user-error "No lines"))
- :curr-line (and (not top) curr-line)
+ (let* ((curr-line (line-number-at-pos (point) consult-line-numbers-widen))
+ (top (not (eq start consult-line-start-from-top)))
+ (candidates (or (consult--with-increased-gc
+ (consult--line-candidates top curr-line))
+ (user-error "No lines"))))
+ (consult--read
+ candidates
:prompt (if top "Go to line from top: " "Go to line: ")
- :initial initial)))
+ :annotate (consult--line-prefix curr-line)
+ :category 'consult-location
+ :sort nil
+ :require-match t
+ ;; Always add last isearch string to future history
+ :add-history (list (thing-at-point 'symbol) isearch-string)
+ :history '(:input consult--line-history)
+ :lookup #'consult--line-match
+ :default (car candidates)
+ ;; Add isearch-string as initial input if starting from isearch
+ :initial (or initial
+ (and isearch-mode
+ (prog1 isearch-string (isearch-done))))
+ :state (consult--location-state candidates))))
;;;;; Command: consult-line-multi
@@ -4156,21 +4146,6 @@ AS is a conversion function."
(if as (funcall as it) it)))))
buffers))
-(defun consult--buffer-map (buffer &rest app)
- "Run function application APP for each BUFFER.
-Report progress and return a list of the results"
- (consult--with-increased-gc
- (let* ((count (length buffer))
- (reporter (make-progress-reporter "Collecting" 0 count)))
- (prog1
- (seq-map-indexed (lambda (buf idx)
- (with-current-buffer buf
- (prog1 (apply app)
- (progress-reporter-update
- reporter (1+ idx) (buffer-name)))))
- buffer)
- (progress-reporter-done reporter)))))
-
(defun consult--buffer-file-hash ()
"Return hash table of all buffer file names."
(consult--string-hash (consult--buffer-query :as #'buffer-file-name)))