Git Product home page Git Product logo

Comments (18)

mclearc avatar mclearc commented on July 20, 2024 1

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 citar-capf goes before the other completion frameworks. This isn't going to be consistent if you have it loading after those modes i've noticed. So one thing to check is whether you can add a hook to loading markdown and tex that runs when those modes are first loaded:

(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 -100 depth value).

from citar-capf.

bdarcus avatar bdarcus commented on July 20, 2024 1

OK; well that's good. Must be something with my system.

I'll take a closer look later, probably tomorrow.

EDIT: in the meantime, I've reported the bug on the doom discourse, assuming it's specific to doom, and have tried to setup lambda-emacs instead, though got stuck.

from citar-capf.

bdarcus avatar bdarcus commented on July 20, 2024 1

Two related things on notes:

  1. I started this tiny project,, which led to ...
  2. this issue at org-roam: org-roam/org-roam#2207

2 is actually somewhat tricky conceptually and practically; please weigh in there if you have thoughts.

from citar-capf.

bdarcus avatar bdarcus commented on July 20, 2024 1

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

from citar-capf.

mclearc avatar mclearc commented on July 20, 2024

FYI: I added a minor mode with new setup instructions that seem more reliable. See 16b5bad for details.

from citar-capf.

bdarcus avatar bdarcus commented on July 20, 2024

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?

from citar-capf.

mclearc avatar mclearc commented on July 20, 2024

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.

from citar-capf.

mclearc avatar mclearc commented on July 20, 2024

FYI -- this seems to work from me with a minimal (basically emacs -Q with config necessary to load markdown, org, citar, corfu) setup. I noticed no issues with keybindings. Both return and tab complete and insert the candidate as expected.

Screen Shot 2022-05-17 at 11 40 00

from citar-capf.

bdarcus avatar bdarcus commented on July 20, 2024

May as well close this, and assume some weird doom conflict.

from citar-capf.

bdarcus avatar bdarcus commented on July 20, 2024

Can you post the config file on a gist, or embedded here?

from citar-capf.

mclearc avatar mclearc commented on July 20, 2024

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.

from citar-capf.

bdarcus avatar bdarcus commented on July 20, 2024

Alas, that's incomplete, as it doesn't include the straight setup and such.

I really wish emacs made this part easier.

from citar-capf.

mclearc avatar mclearc commented on July 20, 2024

if you ever get lambda-emacs up and running 🤣 it has a command line switch -test that you can run that loads just the packages in lem-setup-test.el and the straight setup in init.el. Useful for testing without having to download all new packages etc.

from citar-capf.

bdarcus avatar bdarcus commented on July 20, 2024

You planning to add to MELPA, post an announcement on REDDIT?

from citar-capf.

mclearc avatar mclearc commented on July 20, 2024

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.

from citar-capf.

bdarcus avatar bdarcus commented on July 20, 2024

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.

from citar-capf.

mclearc avatar mclearc commented on July 20, 2024

You planning to add to MELPA, post an announcement on REDDIT?

FYI @bdarcus I've put an announcement on reddit. Hopefully I'll have time this weekend to submit it on melpa.

from citar-capf.

bdarcus avatar bdarcus commented on July 20, 2024

BTW, this major change will impact this code:

emacs-citar/citar#628

But should be easy to adapt.

from citar-capf.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.