[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/capf-autosuggest 024d438 28/63: Don't exclude completio
From: |
ELPA Syncer |
Subject: |
[elpa] externals/capf-autosuggest 024d438 28/63: Don't exclude completion-in-region-mode |
Date: |
Wed, 27 Oct 2021 14:57:58 -0400 (EDT) |
branch: externals/capf-autosuggest
commit 024d4387cae5aeadd0059ba204c4de908fdf199a
Author: jakanakaevangeli <jakanakaevangeli@chiru.no>
Commit: jakanakaevangeli <jakanakaevangeli@chiru.no>
Don't exclude completion-in-region-mode
---
capf-autosuggest.el | 82 +++++++++++++++++++++++++----------------------------
1 file changed, 39 insertions(+), 43 deletions(-)
diff --git a/capf-autosuggest.el b/capf-autosuggest.el
index 70a0e27..6d34f54 100644
--- a/capf-autosuggest.el
+++ b/capf-autosuggest.el
@@ -144,46 +144,44 @@ Otherwise, return nil."
(defun capf-autosuggest--post-h ()
"Create an auto-suggest overlay."
- (if completion-in-region-mode
- (capf-autosuggest-active-mode -1)
- (when capf-autosuggest-active-mode
- ;; `identity' is used to generate slightly faster byte-code
- (pcase-let ((`(,beg . ,end) (identity capf-autosuggest--region)))
- (unless (and (< beg (point) end)
- (eq (buffer-modified-tick) capf-autosuggest--tick))
- (capf-autosuggest-active-mode -1))))
-
- (unless capf-autosuggest-active-mode
- (pcase (capf-autosuggest-orig-capf 'capf-autosuggest-capf-functions)
- (`(,beg ,end ,table . ,plist)
- (let* ((pred (plist-get plist :predicate))
- (string (buffer-substring-no-properties beg end))
- ;; See `completion-emacs21-all-completions'
- (base (car (completion-boundaries string table pred ""))))
- (when-let*
- ((completions
- (let ((capf-autosuggest-all-completions-only-one t))
- ;; Use `all-completions' rather than
- ;; `completion-all-completions' to bypass completion styles
- ;; and strictly match only on prefix. This makes sense here
- ;; as we only use the string without the prefix for the
- ;; overlay.
- (all-completions string table pred)))
- ;; `all-completions' may return strings that don't strictly
- ;; match on our prefix. Ignore them.
- ((string-prefix-p (substring string base) (car completions)))
- (str (substring (car completions) (- end beg base)))
- ((/= 0 (length str))))
- (setq capf-autosuggest--region (cons beg end)
- capf-autosuggest--str (copy-sequence str)
- capf-autosuggest--tick (buffer-modified-tick))
- (move-overlay capf-autosuggest--overlay end end)
- (when (eq ?\n (aref str 0))
- (setq str (concat " " str)))
- (add-text-properties 0 1 (list 'cursor (length str)) str)
- (add-face-text-property 0 (length str) 'capf-autosuggest-face t
str)
- (overlay-put capf-autosuggest--overlay 'after-string str)
- (capf-autosuggest-active-mode))))))))
+ (when capf-autosuggest-active-mode
+ ;; `identity' is used to generate slightly faster byte-code
+ (pcase-let ((`(,beg . ,end) (identity capf-autosuggest--region)))
+ (unless (and (< beg (point) end)
+ (eq (buffer-modified-tick) capf-autosuggest--tick))
+ (capf-autosuggest-active-mode -1))))
+
+ (unless capf-autosuggest-active-mode
+ (pcase (capf-autosuggest-orig-capf 'capf-autosuggest-capf-functions)
+ (`(,beg ,end ,table . ,plist)
+ (let* ((pred (plist-get plist :predicate))
+ (string (buffer-substring-no-properties beg end))
+ ;; See `completion-emacs21-all-completions'
+ (base (car (completion-boundaries string table pred ""))))
+ (when-let*
+ ((completions
+ (let ((capf-autosuggest-all-completions-only-one t))
+ ;; Use `all-completions' rather than
+ ;; `completion-all-completions' to bypass completion styles
+ ;; and strictly match only on prefix. This makes sense here
+ ;; as we only use the string without the prefix for the
+ ;; overlay.
+ (all-completions string table pred)))
+ ;; `all-completions' may return strings that don't strictly
+ ;; match on our prefix. Ignore them.
+ ((string-prefix-p (substring string base) (car completions)))
+ (str (substring (car completions) (- end beg base)))
+ ((/= 0 (length str))))
+ (setq capf-autosuggest--region (cons beg end)
+ capf-autosuggest--str (copy-sequence str)
+ capf-autosuggest--tick (buffer-modified-tick))
+ (move-overlay capf-autosuggest--overlay end end)
+ (when (eq ?\n (aref str 0))
+ (setq str (concat " " str)))
+ (add-text-properties 0 1 (list 'cursor (length str)) str)
+ (add-face-text-property 0 (length str) 'capf-autosuggest-face t str)
+ (overlay-put capf-autosuggest--overlay 'after-string str)
+ (capf-autosuggest-active-mode)))))))
;;;###autoload
(define-minor-mode capf-autosuggest-mode
@@ -192,10 +190,8 @@ Otherwise, return nil."
(if capf-autosuggest-mode
(progn
(setq capf-autosuggest--overlay (make-overlay (point) (point) nil t t))
- (add-hook 'post-command-hook #'capf-autosuggest--post-h nil t)
- (add-hook 'completion-in-region-mode-hook #'capf-autosuggest--post-h
nil t))
+ (add-hook 'post-command-hook #'capf-autosuggest--post-h nil t))
(remove-hook 'post-command-hook #'capf-autosuggest--post-h t)
- (remove-hook 'completion-in-region-mode-hook #'capf-autosuggest--post-h t)
(capf-autosuggest-active-mode -1)))
;;;###autoload
- [elpa] externals/capf-autosuggest c6a38f3 17/63: Sentence end double space, (continued)
- [elpa] externals/capf-autosuggest c6a38f3 17/63: Sentence end double space, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 0ef9e94 16/63: Add documentation to capf functions, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 03004ef 18/63: Begin commentary to capf-autosuggest, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 8507236 20/63: Generalize capf-autosuggest-capf-functions, ELPA Syncer, 2021/10/27
- [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 <=
- [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, 2021/10/27
- [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