`cape-dabbrev` unable to complete some of the time.
Closed this issue ยท 6 comments
First thanks writing this :)
In some instances cape-dabbrev
is unable to complete the current word at point but manually calling dabbrev-expand
in the same location works perfectly.
Unfortunately I am unable to reproduce consistently, but it seems to happen only at levels of indentation which is odd.
For example, I mainly just write Python and the class names are no longer showing up as completion candiates via cape-dabbreve
but works fine with dabbrev-expand
.
Any ideas?
I only use cape-dabbrev
, cape-file
, and cape-history
for completion. very bare bones
Here is my config:
(use-package cape
:ensure t
:init
(setq cape-dabbrev-min-length 2)
(setq cape-dabbrev-check-other-buffers 'some)
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
(add-to-list 'completion-at-point-functions #'cape-file)
(add-to-list 'completion-at-point-functions #'cape-history)
:bind ("C-c SPC" . cape-dabbrev)
)
(use-package dabbrev
:custom
(dabbrev-upcase-means-case-search t)
(dabbrev-check-all-buffers nil)
(dabbrev-check-other-buffers t)
(dabbrev-friend-buffer-function 'dabbrev--same-major-mode-p)
(dabbrev-ignored-buffer-regexps '("\\.\\(?:pdf\\|jpe?g\\|png\\)\\'"))
)
For me cape-dabbrev
works as expected. I close this since I'd need a reproducible example to do anything. Please try to debug/trace cape--dabbrev-list
to check for discrepancies. cape-dabbrev
is a relatively simple Capf so it shouldn't be difficult to do some debugging of the candidate computation. Note that cape-dabbrev
filters with cape-dabbrev-min-length
.
I tested for example this configuration and I don't see anything obviously wrong with it.
(setq-local dabbrev-upcase-means-case-search t
dabbrev-check-all-buffers nil
dabbrev-check-other-buffers nil
cape-dabbrev-min-length 0
completion-at-point-functions '(cape-dabbrev)
completion-ignore-case t
completion-styles '(substring))
One possible problem could be if you use uppercase names, which may or may not be filtered out during completion, see completion-ignore-case
. But this doesn't really fit to what you describe regarding the indentation. I could not see indentation-related issues in python-mode, but I only tried this quickly.
@minad I also had this issue, and it was cape-dabbrev-min-length
. I suggest not having such unintuitive defaults. I think these kinds of options are best recommended to be set in the readme, so that the user sees them and customizes them if necessary.
@minad I still have this issue sometimes. I'll post again if I find a way to reproduce it.
The issue seems to be triggered when some "bad" buffer is open which causes a silent error in cape-dabbrev
, as the issue goes away when I close all buffers. The notable thing is that dabbrev-expand
works when cape-dabbrev
does not.
@NightMachinery interesting find! I'll try and kill some buffers next time it happens and see if that also fixes the problem. If it does then we're one step closer to solving this bug! \o/
Have an update on this. I have cape-dabbrev-check-other-buffers
set to cape--buffers-major-mode
vs t
or 'some
and that seemed to resolve the issue. Not sure what is happening there since i Haven't looked at the code myself yet