Closed deb75 closed 1 year ago
Well, the error is because there's no longer any citar-capf-mode
.
Did you have it working earlier?
That code in general needs work (see #660), which is largely why it's not currently documented.
And I don't use it, so am actually not sure what the right configuration should be.
Perhaps you can figure out how to modify the config so you remove the error, and get it to load correctly, and see if you still have the same issue?
You can see what the mode did here , as a basis for the config?
@mclearc - are you using citar-capf
these days? Any tips?
@mclearc - are you using
citar-capf
these days? Any tips?
hi @bdarcus -- I'm actually just using a very basic capf I wrote that just uses parsebib. At least in my use case I've found this is more reliable and responsive (as per this comment) than using citar (though I do still use citar -- just more for note-related stuff).
hi @bdarcus -- I'm actually just using a very basic capf I wrote that just uses parsebib. At least in my use case I've found this is more reliable and responsive (as per this comment) than using citar (though I do still use citar -- just more for note-related stuff).
Have you changed anything in the bibtex-capf
activation code, @mclearc, the lack of which would explain what the OP is seeing (that the capf doesn't appear to activate; I see the same), that we might apply here?
EDIT: reading the bibtex-capf
function, it does seem the same. Maybe a config issue?
The candidates/caching is a separate issue that I'm more comfortable with figuring out; I actually have an idea on that.
EDIT: reading the
bibtex-capf
function, it does seem the same. Maybe a config issue?
I see the issue here.
I had used this to config, from IELM:
(add-hook 'completion-at-point-functions #'citar-capf -90 t)
That last argument makes the hook local, and so to IELM, which means it doesn't work in org-mode.
@deb75 - can you try this? It should work:
(use-package citar-capf
:init
(add-to-list 'completion-at-point-functions #'citar-capf -90))
Is that right for the README @mclearc?
I guess we could add back the minor-mode and use a hook there, but maybe premature until we address #660.
(use-package citar-capf :init (add-to-list 'completion-at-point-functions #'citar-capf -90))
Is that right for the README @mclearc?
EDIT: the activation issue usually stems from some other completion function running before citar gets its try. Hence the "90" weight. But note you're using add-to-list
instead of add-hook
, so here you should just prepend. So something like this.
(use-package citar-capf
:init
(add-to-list 'completion-at-point-functions #'citar-capf)
EDIT2: Note though that for the list addition to work it has to be added in every mode, which is why I use hooks.
Note though that for the list addition to work it has to be added in every mode, which is why I use hooks.
Oops; just pushed the earlier iteration.
How would I change it to use hooks, without adding a minor-mode? Just change add-to-list
to add-hook
?
How would I change it to use hooks, without adding a minor-mode?
I assume by adding one for each mode:
(add-hook 'org-mode-hook (lambda () (add-hook 'completion-at-point-functions #'citar-capf -90)))
etc...
@mclearc how do you find the UX with the simple complete-on-the-citekey?
I can see it may have some appeal in this (buffer) context?
If yes, it seems like we could solve #660 pretty easily:
(completing-read "Test: " (citar-get-entries)) ; cached data, accounts for local bib files
... and then an annotation function (which is the only piece of content dynamically-generated; though maybe even this is problematic for a capf?) like:
(defun citar-capf-annotate (key)
"Annotate a citation KEY."
(concat
(truncate-string-to-width
(or (citar-get-value "author" key)
(citar-get-value "editor" key)
"")
20 nil 32)
(citar-get-value "title" key)))
I started to play with this idea on the capf-refactor
branch, though can't yet get it to work!
@bdarcus that seems like it should work since I do something similar in my bibtex-capf completion function: https://github.com/mclear-tools/bibtex-capf/blob/406d7232b1460c79e70e0f76ba52c102e14afbb9/bibtex-capf.el#L104
That worked!
I was more worried about the padding between the candidate and the annotation, but that turned to be a non-issue.
OK, I'm closing this, as I'm pretty certain this was a config issue to begin with (not a bug), and I just merged #728.
Feel free to test it out, and open a separate issue if you have problems, @deb75?
EDIT: I've also made some other minor changes; see the config in the README.
Any luck with this @deb75?
š š š
Regards
Actually, it suddenly stops working, answering "No match" although I use the same word which was working before.
In the message buffer, I get some errors :
Search failed: there is an unmatched expression somewhere or we are at the beginning/end of file. [4 times]
Error in post-command-hook (cursor-sensor--detect): (wrong-type-argument integer-or-marker-p nil)
redisplay--pre-redisplay-functions: (wrong-type-argument integer-or-marker-p nil)
Beginning of buffer
but I am not sure if they are all related to citar-capf
.
~Oddly enough, I also can't get it to work now, though I get no error.~ Was just a syntax error in my config.
~OTOH, I can't get it work in markdown or latex.~
Your error, however, does look like it's related to cursor-sensor
; not the capf.
Describe the bug
Citar completion at point is not working.
To Reproduce
Expected behavior
Should open a menu with possible completions
Emacs version:
windows 11 / mingw64 / emacs 30.0.60
Additional context
I have
citar
,org-cite
configured and working as expected as for inserting citations. When loading the emacs init file, I noticed the error :This error can be reproduced by
M-x citar-capdf-mode
The citar configuration is :