emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/cape ae136b6ba4 010/146: Improve dabbrev lazy loading


From: ELPA Syncer
Subject: [elpa] externals/cape ae136b6ba4 010/146: Improve dabbrev lazy loading
Date: Sun, 9 Jan 2022 20:57:38 -0500 (EST)

branch: externals/cape
commit ae136b6ba4db0dbc612897751eacfa4df7f8b725
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Improve dabbrev lazy loading
---
 cape.el | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/cape.el b/cape.el
index 90447354b0..4a3e367f88 100644
--- a/cape.el
+++ b/cape.el
@@ -29,8 +29,6 @@
 
 ;;; Code:
 
-(require 'dabbrev)
-
 (defgroup cape nil
   "Completion At Point Extensions."
   :group 'convenience
@@ -316,14 +314,22 @@
   (list :annotation-function (lambda (_) " Dabbrev")
         :company-kind (lambda (_) 'text)))
 
+(defvar dabbrev-check-all-buffers)
+(defvar dabbrev-check-other-buffers)
+(declare-function dabbrev--abbrev-at-point "dabbrev")
+(declare-function dabbrev--ignore-case-p "dabbrev")
+(declare-function dabbrev--find-all-expansions "dabbrev")
+(declare-function dabbrev--reset-global-variables "dabbrev")
+
 ;;;###autoload
 (defun cape-dabbrev-capf ()
   "Dabbrev completion-at-point-function."
+  (require 'dabbrev)
   (let ((dabbrev-check-all-buffers nil)
         (dabbrev-check-other-buffers nil))
     (dabbrev--reset-global-variables))
   (let ((abbrev (ignore-errors (dabbrev--abbrev-at-point))))
-    (when (and abbrev (not (string-match-p "[ \t]" abbrev)))
+    (when (and abbrev (not (string-match-p "[ \t\n]" abbrev)))
       (pcase ;; Interruptible scanning
           (while-no-input
             (let ((inhibit-message t)
@@ -343,14 +349,14 @@
              (unless (string-match-p "\n" (buffer-substring beg end))
                `(,beg ,end ,words :exclusive no 
,@cape--dabbrev-properties)))))))))
 
-
 (defvar cape--ispell-properties
   (list :annotation-function (lambda (_) " Ispell")
         :company-kind (lambda (_) 'text)))
 
-(autoload 'ispell-lookup-words "ispell")
+(declare-function ispell-lookup-words "ispell")
 (defun cape--ispell-words (bounds)
   "Return words from Ispell which match the string within BOUNDS."
+  (require 'ispell)
   (with-demoted-errors
       (let ((message-log-max nil)
             (inhibit-message t))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]