[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra fff899a 237/395: counsel.el (counsel--sync-se
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra fff899a 237/395: counsel.el (counsel--sync-sentinel-on-exit): Try not to reset index to 0 |
Date: |
Thu, 25 Feb 2021 08:32:10 -0500 (EST) |
branch: externals/ivy-hydra
commit fff899a305d10409d87867dc05f3bfc97ada60b4
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
counsel.el (counsel--sync-sentinel-on-exit): Try not to reset index to 0
Re #2477
---
counsel.el | 71 +++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 38 insertions(+), 33 deletions(-)
diff --git a/counsel.el b/counsel.el
index 16e86cf..60f144d 100644
--- a/counsel.el
+++ b/counsel.el
@@ -207,42 +207,47 @@ respectively."
(ivy-alist-setting counsel-async-split-string-re-alist)
t))
+(defun counsel--sync-sentinel-on-exit (process)
+ (if (zerop (process-exit-status process))
+ (let ((cur (ivy-state-current ivy-last)))
+ (ivy--set-candidates
+ (ivy--sort-maybe
+ (with-current-buffer (process-buffer process)
+ (counsel--split-string))))
+ (when counsel--async-start
+ (setq counsel--async-duration
+ (time-to-seconds (time-since counsel--async-start))))
+ (let ((re (ivy-re-to-str ivy-regex)))
+ (if ivy--old-cands
+ (if (eq (ivy-alist-setting ivy-index-functions-alist)
'ivy-recompute-index-zero)
+ (ivy-set-index 0)
+ (ivy--recompute-index re ivy--all-candidates))
+ (unless (ivy-set-index
+ (ivy--preselect-index
+ (if (> (length re) 0)
+ cur
+ (ivy-state-preselect ivy-last))
+ ivy--all-candidates))
+ (ivy--recompute-index re ivy--all-candidates))))
+ (setq ivy--old-cands ivy--all-candidates)
+ (if ivy--all-candidates
+ (ivy--exhibit)
+ (ivy--insert-minibuffer "")))
+ (setq counsel--async-last-error-string
+ (with-current-buffer (process-buffer process) (buffer-string)))
+ (setq ivy--all-candidates
+ (let ((status (process-exit-status process))
+ (plist (plist-get counsel--async-exit-code-plist
+ (ivy-state-caller ivy-last))))
+ (list (or (plist-get plist status)
+ (format "error code %d" status)))))
+ (setq ivy--old-cands ivy--all-candidates)
+ (ivy--exhibit)))
+
(defun counsel--async-sentinel (process _msg)
"Sentinel function for an asynchronous counsel PROCESS."
(when (eq (process-status process) 'exit)
- (if (zerop (process-exit-status process))
- (progn
- (ivy--set-candidates
- (ivy--sort-maybe
- (with-current-buffer (process-buffer process)
- (counsel--split-string))))
- (when counsel--async-start
- (setq counsel--async-duration
- (time-to-seconds (time-since counsel--async-start))))
- (let ((re (ivy-re-to-str ivy-regex)))
- (if ivy--old-cands
- (if (eq (ivy-alist-setting ivy-index-functions-alist)
'ivy-recompute-index-zero)
- (ivy-set-index 0)
- (ivy--recompute-index re ivy--all-candidates))
- (unless (ivy-set-index
- (ivy--preselect-index
- (ivy-state-preselect ivy-last)
- ivy--all-candidates))
- (ivy--recompute-index re ivy--all-candidates))))
- (setq ivy--old-cands ivy--all-candidates)
- (if ivy--all-candidates
- (ivy--exhibit)
- (ivy--insert-minibuffer "")))
- (setq counsel--async-last-error-string
- (with-current-buffer (process-buffer process) (buffer-string)))
- (setq ivy--all-candidates
- (let ((status (process-exit-status process))
- (plist (plist-get counsel--async-exit-code-plist
- (ivy-state-caller ivy-last))))
- (list (or (plist-get plist status)
- (format "error code %d" status)))))
- (setq ivy--old-cands ivy--all-candidates)
- (ivy--exhibit))))
+ (counsel--sync-sentinel-on-exit process)))
(defcustom counsel-async-filter-update-time 500000
"The amount of microseconds to wait until updating `counsel--async-filter'."
- [elpa] externals/ivy-hydra 6941b8a 214/395: Revert ".dir-locals.el (outline-regexp): "^(" is not an outline start", (continued)
- [elpa] externals/ivy-hydra 6941b8a 214/395: Revert ".dir-locals.el (outline-regexp): "^(" is not an outline start", Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 93929ec 257/395: * ivy.el (ivy--shorter-matches-first): Simplify, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 1b6f3cf 244/395: Improve ivy-switch-buffer-transformer, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 68ce6e6 384/395: Mention caveats for non-exiting commands in manual, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 1deef76 394/395: Bump version to point release 0.13.2, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 4235010 387/395: Re-revert last change to ivy-update-candidates, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d8ed11e 388/395: Make ivy-switch-buffer-kill respect current predicate, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra c1a61dc 084/395: ivy-test.el (ivy-empty-directory-open): Test opening empty directory, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 316d4dd 232/395: counsel-kmacro: Create actions for cycling the ring and setting a saved counter value., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 38c90e8 196/395: ivy.el (ivy-switch-buffer-transformer): Move ivy-remote logic here, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra fff899a 237/395: counsel.el (counsel--sync-sentinel-on-exit): Try not to reset index to 0,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra a2c86c0 273/395: ivy.el (ivy-completion-in-region): Fixup, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra da0b272 281/395: ivy.el (ivy--call-marked): Handle alists, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra a37ec22 279/395: Revert "ivy.el (ivy--update-minibuffer): don't filter while there's input", Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 05d892d 282/395: counsel-grep/ag/rg/pt: use subprocess instead of shell command, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra b173441 326/395: Fix for ivy-immediate-done with counsel-M-x, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d539306 307/395: Revert "ivy.el (ivy-display-style): Remove", Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 1095e42 298/395: ivy.el (ivy-alt-done-functions-alist): Add, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 7774867 335/395: Guard against null Org heading, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 7b9391f 320/395: ivy-avy.el: Fix typo, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 6bfada5 359/395: ivy.el: Use ivy--completing-fname-p more, Basil L. Contovounesios, 2021/02/25