-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add bibtex-actions-at-point #137
Conversation
Thanks for this! First, I'm a little confused on the intial input connection. How is this supposed to work from a user POV? Second, can you please look at #132, and consider:
Also, see the CI docstring warnings. |
Nice idea, but somehow the way this additional function is realized strikes me as odd. We already have a plethora of functions which can be bound to any key, plus the real action would be actually hidden in the value of The core of the proporal is to create an initial input from the thing at point, so why not generalize this function? If we are on a key, just add that key to the initial input - for any function. In such a more generalized form, it could be also used for tools like |
I don't know much about how to implement a completion-at-point-function. This PR just reuses
I have been using ivy-bibtex before. ivy-bibtex has one main command
I'm not sure if it is good to add the key at point for all bibtex actions. When a user calls a bibtex action interactively, the key at point should be useful for |
Sounds like a good solution to me! As said, this also preserves the possibility to use the"parser" which recognize a citation key at point for |
I just tested this, and it doesn't work for me; no initial input is set. Not sure it make any difference, but I'm testing the new org-cite syntax, which is high priority for me to support. Example:
What do you use to author documents? Latex, markdown, or org?
I made a design decision early on not to follow the ivy/helm-bibtex approach of a single command, in part to give us all more flexibility. But @apc earlier was asking for essentially a configurable default "open" command. See, for example, #121 (comment), and subsequent discussion. Do note that I have followed helm/ivy-bibtex where it makes sense, and diverged in other cases.
Yes. PS - if we do merge this, I just realized we may want to configure the prompt for each command, so that one knows which one is active. |
latex and org
Adding a command But I don't insist on adding As pointed out by @publicimageltd, the core of this PR is allowing |
OIC. I took a look again at the Also works as expected for me in
Seems we need to submit a PR for this for I notice also it doesn't recognize pandoc citations in org.
Yeah, I'm just trying to think forward. For sake of argument, let's say Does that have any implications for this at all? https://code.orgmode.org/bzg/org-mode/src/wip-cite-new/lisp/oc.el
I'm not sure. When I'm asking questions, I'm legitimately interested in feedback to help think it through together. :-) Part of my uncertainty is I don't understand how |
I got word today of a sudden death in the family that may slow down my decision-making on the details here. But that will give time for others to weigh in as well. In any case, I support this PR in principle; thanks again. In related news, I've decided to make the function in #132 specific to org-cite as well, and asked for help on it on the org-mode list. So we could end up with two org-cite-specific at-point functions. |
Actually, WDYT about adding that We can always remove it if it gets integrated in |
Though easy enough to add once org-cite is actually merged. |
@ilupin - it's taken me a bit to understand org-cite follow processors, but I think I have it. It allows us to wrap the same function here in such a way that a user could call that function directly from the buffer using Something like this (though there's probably a bug, because I'm currently unable to test it) should be all that's necessary: https://gist.github.com/bdarcus/9e93547c91da8923897b25b31f230b1b I'd probably want something like a hydra menu to bind a few command options there, unless |
I'd use ;;; First, define a function which identifies the thing at point:
(defun embark-target-org-link-at-point ()
"Teach embark to recognize org links at point."
(when (org-in-regexp org-link-any-re)
;; return a list: (category item)
(cons 'org-link (match-string-no-properties 0))))
;;; Then register it as a 'target finder':
(add-to-list 'embark-target-finders
#'embark-target-org-link-at-point)
;;; Now define a target specific keymap....
(embark-define-keymap embark-org-link-map
"Keymap for org links."
("RET" org-open-at-point-global)
("o" some-other-function-which-is-not-defined-in-that-snippet))
;;; ...and hook it into embark:
(add-to-list 'embark-keymap-alist
'(org-link . embark-org-link-map)) |
Great; this is the piece I didn't know! Thanks! So we could tweak the new org-cite at-point function to turn it into such a "follow" processor, then add an example embark config to bind additional commands for that to the README? How does embark then work at point? Just use a different keybinding to bring up the command list? |
Yes. Though it would be cool, of course, to have some kind of automatic plug in, e.g. with
Exactly. You call The function chosen by the user is called with the "calling" point current, as far as I understand, so you can use all functions which e.g. scan the buffer, etc. |
So the "follow" processor by definition works on org-cite objects in buffer. The new bibtex-actions-at-point function is basically, with a minor tweak or two, just such a follow processor. So it will extract the keys from the object, and pass it to the default function. I just want to bind a keymap to that, such that if point is on an org citation or citation-reference, embark with allow us to directly call the relevant functions in the same way. That'll work then? Or does what you suggest mean we need dedicated at-point command variants for each one? |
Do you mean |
Just curious, but in that example, couldn't you just use higher level
Ok. Seems we ought to open a branch to figure out what code and documentation we need for this. |
This PR allows the bibtex key at point as initial input. Actions are available through
bibtex-actions-at-point
withbibtex-actions-open
as the default.