From 137763be8df35590f75d65f4a276bfeb4ca85c19 Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Mon, 10 Apr 2023 10:44:23 +0200 Subject: Fix cape-dabbrev --- cape.el | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/cape.el b/cape.el index 13e614d..cc3db27 100644 --- a/cape.el +++ b/cape.el @@ -401,6 +401,20 @@ If INTERACTIVE is nil the function acts like a Capf." (declare-function dabbrev--find-all-expansions "dabbrev") (declare-function dabbrev--reset-global-variables "dabbrev") +(defun cape--dabbrev-list (input) + "Find all dabbrev expansions for INPUT." + (cape--silent + (let ((dabbrev-check-other-buffers (not (null cape-dabbrev-check-other-buffers))) + (dabbrev-check-all-buffers (eq cape-dabbrev-check-other-buffers t))) + (dabbrev--reset-global-variables)) + (cl-loop with min-len = (+ cape-dabbrev-min-length (length input)) + with ic = (if (eq dabbrev-case-fold-search 'case-fold-search) + case-fold-search + dabbrev-case-fold-search) + for w in (dabbrev--find-all-expansions input ic) + if (>= (length w) min-len) collect + (cape--case-replace (and ic dabbrev-case-replace) input w)))) + ;;;###autoload (defun cape-dabbrev (&optional interactive) "Complete with Dabbrev at point. @@ -415,6 +429,7 @@ See the user options `cape-dabbrev-min-length' and (let ((cape-dabbrev-min-length 0)) (cape-interactive #'cape-dabbrev)) (when (thing-at-point-looking-at "\\(?:\\sw\\|\\s_\\)+") + (require 'dabbrev) (let ((beg (match-beginning 0)) (end (match-end 0))) `(,beg ,end @@ -427,21 +442,6 @@ See the user options `cape-dabbrev-min-length' and :category 'cape-dabbrev) ,@cape--dabbrev-properties))))) -(defun cape--dabbrev-list (input) - "Find all dabbrev expansions for INPUT." - (require 'dabbrev) - (cape--silent - (let ((dabbrev-check-other-buffers (not (null cape-dabbrev-check-other-buffers))) - (dabbrev-check-all-buffers (eq cape-dabbrev-check-other-buffers t))) - (dabbrev--reset-global-variables)) - (cl-loop with min-len = (+ cape-dabbrev-min-length (length input)) - with ic = (if (eq dabbrev-case-fold-search 'case-fold-search) - case-fold-search - dabbrev-case-fold-search) - for w in (dabbrev--find-all-expansions input ic) - if (>= (length w) min-len) collect - (cape--case-replace (and ic dabbrev-case-replace) input w)))) - ;;;;; cape-dict (defvar cape--dict-properties -- cgit v1.0