diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2023-04-10 10:44:23 +0200 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2023-04-10 10:44:23 +0200 |
| commit | 137763be8df35590f75d65f4a276bfeb4ca85c19 (patch) | |
| tree | 1a762122b47a6973c33f130962c143b5fc833fb0 | |
| parent | 41e05124edcdb2d97f9baf4005707121a37498e3 (diff) | |
Fix cape-dabbrev
| -rw-r--r-- | cape.el | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -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 |
