[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/capf-autosuggest 4461655 40/63: Try not to interfere wi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/capf-autosuggest 4461655 40/63: Try not to interfere with command output too much |
Date: |
Wed, 27 Oct 2021 14:58:01 -0400 (EDT) |
branch: externals/capf-autosuggest
commit 4461655554b52511a2827603f6894ce1d1e62daf
Author: jakanakaevangeli <jakanakaevangeli@chiru.no>
Commit: jakanakaevangeli <jakanakaevangeli@chiru.no>
Try not to interfere with command output too much
In particular, disable previewing if input is empty and we aren't sure if
we're
at a prompt.
---
capf-autosuggest.el | 49 +++++++++++++++++++++++++++++--------------------
1 file changed, 29 insertions(+), 20 deletions(-)
diff --git a/capf-autosuggest.el b/capf-autosuggest.el
index 390b8a7..a8740e7 100644
--- a/capf-autosuggest.el
+++ b/capf-autosuggest.el
@@ -486,31 +486,40 @@ suggestion and send input."
"Completion-at-point function for comint input history.
Is only applicable if point is after the last prompt."
(let ((ring comint-input-ring)
- (beg nil))
- (and ring (ring-p ring) (not (ring-empty-p ring))
- (or (and (setq beg comint-accum-marker)
- (setq beg (marker-position beg)))
- (and (setq beg (get-buffer-process (current-buffer)))
- (setq beg (marker-position (process-mark beg)))))
- (>= (point) beg)
- (list beg (if comint-use-prompt-regexp
- (line-end-position)
- (field-end))
- (capf-autosuggest--completion-table ring)
- :exclusive 'no))))
+ (beg nil) (end nil))
+ (or (and (setq beg comint-accum-marker)
+ (setq beg (marker-position beg)))
+ (and (setq beg (get-buffer-process (current-buffer)))
+ (setq beg (marker-position (process-mark beg)))))
+ (cond
+ ;; Return nil to allow possible further capf functions
+ ((null beg) nil)
+ ((< (point) beg) nil)
+ ((<= (setq end (if comint-use-prompt-regexp
+ (line-end-position)
+ (field-end)))
+ beg)
+ ;; Return non-nil but empty completion table to block possible further
+ ;; capf functions
+ (list (point) (point) nil))
+ ((and (ring-p ring) (not (ring-empty-p ring)))
+ (list beg end (capf-autosuggest--completion-table ring)
+ :exclusive 'no)))))
(defun capf-autosuggest-eshell-capf ()
"Completion-at-point function for eshell input history.
Is only applicable if point is after the last prompt."
(let ((ring eshell-history-ring)
- (beg nil))
- (and ring (ring-p ring) (not (ring-empty-p ring))
- (setq beg eshell-last-output-end)
- (setq beg (marker-position beg))
- (>= (point) beg)
- (list (save-excursion (eshell-bol) (point)) (point-max)
- (capf-autosuggest--completion-table ring)
- :exclusive 'no))))
+ (beg (save-excursion (eshell-bol) (point)))
+ (end (point-max)))
+ (cond
+ ((< (point) eshell-last-output-end) nil)
+ ((< (point) beg) nil)
+ ((and (= end beg) (eshell-interactive-process))
+ (list (point) (point) nil))
+ ((and (ring-p ring) (not (ring-empty-p ring)))
+ (list beg end (capf-autosuggest--completion-table ring)
+ :exclusive 'no)))))
(defun capf-autosuggest--completion-table (ring)
"Return a completion table to complete on RING."
- [elpa] externals/capf-autosuggest d53b499 24/63: insert -> insert-and-inherit, (continued)
- [elpa] externals/capf-autosuggest d53b499 24/63: insert -> insert-and-inherit, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 2163c64 27/63: after-change-functions -> buffer-modified-tick, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 5455064 22/63: Allow forward-sexp to enter overlay, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest b836fcc 33/63: Prevent misbehaving capf functions from modifying buffer, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest abd71ab 29/63: Don't leak overlays when killing all local variables, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 8f091ce 26/63: Extend description, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 024d438 28/63: Don't exclude completion-in-region-mode, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 40336d0 38/63: Adjust short description, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 76b643a 34/63: Doc fixes and additions, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest b16a9d8 36/63: Silence compiler warnings, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 4461655 40/63: Try not to interfere with command output too much,
ELPA Syncer <=
- [elpa] externals/capf-autosuggest 84bdbc5 44/63: Fix completion-in-region popping up in eshell after "(forward", ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 2b241a4 43/63: Avoid recomputing string length, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 1ede511 46/63: Minor doc fix, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 200c509 50/63: Disable overlay before executing a partial accept command, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 3064910 54/63: Add undo-boundary when accepting suggestion, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 3f53162 58/63: Remove README, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 0bcdfae 59/63: Add license, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 05980d5 60/63: Adjust package headers, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 3e36894 61/63: Fix copyright notice, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 9fb8c7e 10/63: Fix cursor display if suggested string begins with newline, ELPA Syncer, 2021/10/27