[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/cape 0e60999893 032/146: cape-ispell: Fix caching
From: |
ELPA Syncer |
Subject: |
[elpa] externals/cape 0e60999893 032/146: cape-ispell: Fix caching |
Date: |
Sun, 9 Jan 2022 20:57:40 -0500 (EST) |
branch: externals/cape
commit 0e60999893d4f7b7442a63be4761368ea0b1d25a
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
cape-ispell: Fix caching
---
cape.el | 42 +++++++++++++++++++++++-------------------
1 file changed, 23 insertions(+), 19 deletions(-)
diff --git a/cape.el b/cape.el
index 0af2f6ea42..b5b52839ef 100644
--- a/cape.el
+++ b/cape.el
@@ -386,35 +386,39 @@
:company-kind (lambda (_) 'text)))
(declare-function ispell-lookup-words "ispell")
-(defun cape--ispell-words (str)
- "Return words from Ispell which match STR."
- (require 'ispell)
- (with-demoted-errors
- (let ((message-log-max nil)
- (inhibit-message t))
- (ispell-lookup-words (format "*%s*" str)))))
+(defun cape--ispell-table (bounds)
+ "Return completion table for Ispell completion between BOUNDS."
+ (let ((input nil)
+ (beg (copy-marker (car bounds)))
+ (end (copy-marker (car bounds) t))
+ (words 'init))
+ (lambda (str pred action)
+ (let ((new-input (buffer-substring-no-properties beg end)))
+ (when (or (eq words 'init) (not (string-match-p (regexp-quote input)
new-input)))
+ (setq input new-input
+ words (with-demoted-errors
+ (require 'ispell)
+ (let ((message-log-max nil)
+ (inhibit-message t))
+ (ispell-lookup-words (format "*%s*" input)))))))
+ (complete-with-action action words str pred))))
;;;###autoload
(defun cape-ispell-capf ()
"Ispell completion-at-point-function."
(when-let (bounds (bounds-of-thing-at-point 'word))
- (let ((input (buffer-substring-no-properties (car bounds) (cdr bounds)))
- (words nil))
- `(,(car bounds) ,(cdr bounds)
- ,(lambda (str pred action)
- (complete-with-action
- action (or words (setq words (cape--ispell-words input))) str
pred))
- :exclusive no
- ,@cape--ispell-properties))))
+ `(,(car bounds) ,(cdr bounds)
+ ,(cape--ispell-table bounds)
+ :exclusive no
+ ,@cape--ispell-properties)))
;;;###autoload
(defun cape-ispell ()
"Complete with Ispell at point."
(interactive)
- (let* ((bounds (or (bounds-of-thing-at-point 'word) (cons (point) (point))))
- (input (buffer-substring-no-properties (car bounds) (cdr bounds)))
- (completion-extra-properties cape--ispell-properties))
- (completion-in-region (car bounds) (cdr bounds) (cape--ispell-words
input))))
+ (let ((bounds (or (bounds-of-thing-at-point 'word) (cons (point) (point))))
+ (completion-extra-properties cape--ispell-properties))
+ (completion-in-region (car bounds) (cdr bounds) (cape--ispell-table
bounds))))
(defvar cape--dict-properties
(list :annotation-function (lambda (_) " Dict")
- [elpa] externals/cape 97eacd933d 016/146: README: Update example, (continued)
- [elpa] externals/cape 97eacd933d 016/146: README: Update example, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 9833045077 017/146: Add completion categories, ELPA Syncer, 2022/01/09
- [elpa] externals/cape b3c5e4ec69 018/146: cape-merge-capfs: Fix sorting, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 26b822db0a 011/146: Add MELPA badges, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 84c128ae9b 013/146: Add cape-merge-capfs (Fix #2), ELPA Syncer, 2022/01/09
- [elpa] externals/cape 6c124b6cfd 015/146: README: Add some justification for the name :), ELPA Syncer, 2022/01/09
- [elpa] externals/cape 63ded5fde4 028/146: Improve cape-company-to-capf, ELPA Syncer, 2022/01/09
- [elpa] externals/cape f270456b5d 041/146: Improve cape-dabbrev-capf, ELPA Syncer, 2022/01/09
- [elpa] externals/cape a8e10cf7ae 014/146: Update README, ELPA Syncer, 2022/01/09
- [elpa] externals/cape d6b13d3055 027/146: Fix no-cache call, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 0e60999893 032/146: cape-ispell: Fix caching,
ELPA Syncer <=
- [elpa] externals/cape 7325c5002f 035/146: Update README, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 0a374042c9 003/146: README: Update configuration, ELPA Syncer, 2022/01/09
- [elpa] externals/cape d7c765d057 004/146: Add cape-keyword and cape-keyword-capf (Fix #3), ELPA Syncer, 2022/01/09
- [elpa] externals/cape 1aaca0fd74 008/146: Expand comment, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 38802ada22 007/146: Add kinds, ELPA Syncer, 2022/01/09
- [elpa] externals/cape b1f57d79ba 009/146: Improve ispell, ELPA Syncer, 2022/01/09
- [elpa] externals/cape ae136b6ba4 010/146: Improve dabbrev lazy loading, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 0cc116b29c 012/146: Implement company adapter (See #1), ELPA Syncer, 2022/01/09
- [elpa] externals/cape 845f3483f1 019/146: company-merge-capfs: Add support for :company-prefix-length, ELPA Syncer, 2022/01/09
- [elpa] externals/cape 31acb66152 021/146: Update README, ELPA Syncer, 2022/01/09