summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2024-01-30 18:44:14 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2024-01-30 19:59:39 +0100
commitc94c648fe91247b74a524c438f4fa43e87c70e49 (patch)
treea84a139f50d6e26c6bb331d06cb4e206088043a0
parent2032acea9b5aaa40bffa06cfced7da51675896ea (diff)
cape-capf-buster: Ensure that point is inside the prefixrelax-refresh-condition
-rw-r--r--cape.el23
1 files changed, 12 insertions, 11 deletions
diff --git a/cape.el b/cape.el
index a196c68..b41a422 100644
--- a/cape.el
+++ b/cape.el
@@ -1007,18 +1007,19 @@ completion table is refreshed on every input change."
(input (buffer-substring-no-properties beg end)))
(lambda (str pred action)
(let ((new-input (cape--input-string beg end)))
- (when (and
- ;; Only refresh table for the `all-completions' action.
- (eq action t)
- ;; Point must be inside the input string. It could lie
- ;; outside if the Orderless completion style is used.
- (<= beg (point) (+ beg (length new-input)))
- ;; Current input is not valid.
- (not (funcall valid input new-input)))
+ ;; Only refresh table for the `all-completions' action if the
+ ;; input is not valid (has changed).
+ (when (and (eq action t) (not (funcall valid input new-input)))
(pcase
- ;; Reset in case `all-completions' is used inside CAPF
- (let (completion-ignore-case completion-regexp-list)
- (funcall capf))
+ (save-excursion
+ ;; Point must be inside the input string. It could lie
+ ;; outside if the Orderless completion style is used.
+ (let ((end (+ beg (length new-input))))
+ (unless (<= beg (point) end)
+ (goto-char end)))
+ ;; Reset in case `all-completions' is used inside CAPF.
+ (let (completion-ignore-case completion-regexp-list)
+ (funcall capf)))
((and `(,new-beg ,new-end ,new-table . ,new-plist)
;; new-end can be before end for Orderless completion.
(guard (and (= new-beg beg) (<= new-end end))))