-
Notifications
You must be signed in to change notification settings - Fork 1
config example not setting capf correctly #2
Comments
I really have no idea why you're having the keybinding issue. I don't see why/how citar-capf would alter your keybinds for completion. I was thinking though of making citar-capf a minor mode to make it easier to load in deferred loading scenarios. I could try setting a keymap and see if that helps. Ideally (defun citar-capf-hook () (add-hook 'completion-at-point-functions #'citar-capf -100 t))
:config
;; Add hooks
(with-eval-after-load 'latex-mode
(add-hook 'tex-mode-hook #'citar-capf-hook)
(add-hook 'latex-mode-hook #'citar-capf-hook)
(add-hook 'reftex-mode-hook #'citar-capf-hook))
(with-eval-after-load 'markdown-mode
(add-hook 'markdown-mode-hook #'citar-capf-hook))
(with-eval-after-load 'org-mode
(add-hook 'org-mode-hook #'citar-capf-hook)) EDIT: the reason you're getting no matches in latex and markdown modes is that the other completion table is clobbering citar-capf. This is why it is important that it get added first in the list (hence the |
FYI: I added a minor mode with new setup instructions that seem more reliable. See 16b5bad for details. |
If I set the minor mode with a buffer open, it seems to set the capf correctly. If I switch to another buffer, say in another major-mode, it doesn't. I have to deactivate and reactivate. Do you see that? |
I'm not seeing that. I can ping pong between an elisp, fundamental, org, and markdown buffer and the org and markdown completion works as expected. |
May as well close this, and assume some weird doom conflict. |
Can you post the config file on a gist, or embedded here? |
Try this (note you'll have to set the variables) ;;; CAPF Test
;;;; Set vars
(setq lem-bibliography (concat (getenv "HOME") "/Dropbox/Work/bibfile.bib"))
(setq lem-bib-notes (concat (getenv "HOME") "/Dropbox/Work/projects/notebook/content-org/ref-notes"))
;; Set citar library path
(with-eval-after-load 'citar
(setq citar-library-paths '("/Users/roambot/Library/Mobile Documents/iCloud~com~sonnysoftware~bot/Documents/be-library")))
;;;; Citar
(use-package citar
:straight (:host github :repo "bdarcus/citar")
:custom
(citar-bibliography `(,lem-bibliography))
(org-cite-global-bibliography `(,lem-bibliography))
(org-cite-insert-processor 'citar)
(org-cite-follow-processor 'citar)
(org-cite-activate-processor 'citar)
:config
;; edit notes
(setq citar-notes-paths `(,lem-bib-notes)))
;;;; Markdown
(use-package markdown-mode)
;;;; Org-Cite
;; Eventually this should be a full replacement for org-ref
(use-package oc
:straight nil
:after org
:config
(setq org-cite-global-bibliography `(,lem-bibliography))
(setq org-cite-export-processors
'((beamer csl)
(latex csl)
(t csl))))
;; Currently only using csl
(use-package oc-csl
:straight nil
:after oc
:init
;; make sure to download csl
;; https://citationstyles.org
;; https://github.com/citation-style-language
;; repos for styles & locales
(setq org-cite-csl-styles-dir "~/.local/share/csl/styles")
(setq org-cite-csl-locales-dir "~/.local/share/csl/locales"))
;;;; Citeproc
(use-package citeproc
:straight (:host github :repo "andras-simonyi/citeproc-el")
:after (oc oc-csl))
;;;; Corfu
(use-package corfu
:straight (:type git :host github :repo "minad/corfu")
:hook
(after-init . global-corfu-mode)
:custom
;; auto-complete
(corfu-auto t))
;;;; Citar-Capf
(use-package citar-capf
:straight (:local-repo "/Users/roambot/bin/lisp-projects/citar-capf")
:hook ((org-mode markdown-mode tex-mode latex-mode reftex-mode) . citar-capf-mode))
(defun capf-citar-test ()
(interactive)
(progn
(require 'citar-capf)
(markdown-mode)
(switch-to-buffer "*scratch*"))) you can probably skip the org-cite stuff if you just want to check that it works via markdown. |
Alas, that's incomplete, as it doesn't include the straight setup and such. I really wish emacs made this part easier. |
if you ever get lambda-emacs up and running 🤣 it has a command line switch |
You planning to add to MELPA, post an announcement on REDDIT? |
Yes -- just need to find time. Hopefully in the next week or two. I've been working on https://github.com/mclear-tools/consult-notes a bit. If you have any interest in that package I appreciate any feedback. |
Two related things on notes:
2 is actually somewhat tricky conceptually and practically; please weigh in there if you have thoughts. |
BTW, I'm not committed to finishing and releasing 1. I am working on it mostly to ensure the notes API in citar is correct. But it might be they're complementary. I agree using consult, with its support for narrowing and such, makes sense. I wasn't planning to add that to my package. |
FYI, someone else confirmed a bug in doom that was causing the problem I was seeing with the capf (but later confirmed with others capfs). https://discourse.doomemacs.org/t/new-completion-corfu-module/2685/15 |
FYI @bdarcus I've put an announcement on reddit. Hopefully I'll have time this weekend to submit it on melpa. |
BTW, this major change will impact this code: But should be easy to adapt. |
Picking up where we earlier left off, in the hopes I can get this working, or it might help with the README instructions.
I do plan to test it with emacs -Q; I just need more time (maybe tomorrow).
If I add your
use-package
example, suitably modified for doom ...Org
Value of
completion-at-point-functions
:I do get corfu to activate with the citar completion. But if I hit
RET
on a candidate, it does not insert the key, but instead adds a newline to the buffer.Aside: with the private doom corfu module I'm using, for other capfs (for example, in lisp buffers), when I highlight a candidate, it presents a preview, and when I hit
RET
it behaves as expected (inserts the candidate).LaTeX
Here I get no matches.
Markdown
No matches.
Any suggestions? Is that setup as you expect with the variable?
The text was updated successfully, but these errors were encountered: