-
Notifications
You must be signed in to change notification settings - Fork 74
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
Enable org-capture template expansions for file notes #309
Enable org-capture template expansions for file notes #309
Conversation
I've just noticed that doing this removes all but one newlines at the end of the template, which might not be ideal. I'm looking for a solution now. |
The default behaviour of `org-capture-fill-template` is to squash all the newlines at the end of the template into one. This is problematic when your template ends with multiple line. By including non-newline characters at the end of the template, `org-capture-fill-template` preserves those spaces. The included non-newline character can then be removed. Definitely hackish. An easier solution might be available.
I've found a solution, but it is a little hackish. Hopefully one of you will be able to find something better. |
Neat. But I think there is a proposal to switch to the org-capture mechanism entirely. I think there is even a PR for that, but I was unsure about the implementation. Have to revisit this whole issue because I agree that we can easily improve in this area. |
See here #263 for the PR I mentioned. |
Whoops, wasn't aware that there'd been previous attempts, sorry. I'll have a look at the related issue (#260), and I'll audit the PR when I get a chance. |
I've had a look at #263, and the scope is quite a bit larger than the feature I'm proposing here. Moving the note-creation to I've made a handful of commits to propagate the feature to one-file notes. For those, I've also made it possible to have a The code should not change the behaviour of existing configurations besides squashing newlines at the end of one-file notes (standard in |
I like that this code doesn't change existing behaviour. Is there a way to force new lines, for example, via escaping |
Implemention is not intuitive. Having \n and \\n both expand at different moments is not logical.
Now, every newline included in the template as ‘\n’ will be replaced appropriately by a newline.
1376f82
to
f725b33
Compare
Since it’s also needed for single-file capture, we might as well add it to the processing.
Thanks for your remak, it's put me on the right track. :) With the current implementation, every newline in the template will appear in the final output. This is done with a helper function which protects the newline during I think doing it this way removes any hint of hackyness from the original implementation. |
Also, on the topic of fully migrating to I've been working on a connector package between If you want notes on the implementation, the efforts can be browsed in org-roam/org-roam#437 and org-roam/org-roam#415. Thanks for your work! 🎉 |
No worries, I didn't expect anything. Thanks for your contributions so far. Regarding org-roam-bitex, this looks like a really good idea and I might use it myself. One question: is this an add-on for org-ref or does it also work with plain helm/ivy-bibtex as well? I read through some of the relevant threads and some of the source code and the information on that appears conflicting. I'm not using org-ref myself and would favour if i could use org-roam-bibtex without installing org-ref as a dependency. |
Regarding the templating mechanism, do you think it would make sense to generalize the mechanism in bibtex-completion such that it works for org-roam-bibtex? Or does org-roam-bibtex have specific requirements that make this code unsuitable for bibtex-completion? Two reasons for my question: First, I guess we should try to avoid developing two highly similar mechanisms in parallel. Second, if there were two, potentially incompatible mechanisms that could be confusing for users. |
We've actually reused a lot of |
I am a happy org-roam user, so that's fine :)
So if bibtex-completion had templating machinery along the lines of what you implemented, the only missing piece would be the ability to sneak in the I think there might another area where org-roam-bibtex could benefit from changes in bibtex-completion: helm/ivy-bibtex show symbols next to entries that do have notes. As far as I can see, with current org-roam-bibtex you don't get these symbols because the parser in bibtex-completion is not aware of the org-roam backend. I wanted to implement a plug-in infrastructure for finding PDFs and notes for a long time because users have different preferences and needs here. Perhaps now is the time to attack this? |
Pretty much, yes. But depending on how much energy you want to sink into it, this PR really covers 90% of what we'd achieve by fully moving to
I've already played around with it, and I've got a working implementation on a It's based off deprecated code, but it'd be trivial to adapt for |
I went ahead and did it. #311 addresses the |
Yes, but my understanding was org-roam-bibtex is not building on this PR's mechanism but replacing it. Did I misunderstand? Ideally I'd want the mechanism in bibtex-completion to be flexible enough for org-roam-bibtex purposes. Plus I/we intended to move to org-capture anyway. |
Ah, I see what you mean now, sorry for being long on the uptake. Yes, We could turn Did you have something more advanced in mind? |
Allow addons or users to modify the function used by ‘bibtex-completion-edit-notes’.
Proposed implementation is in 11cfa03. |
Merged with minor modifications. Thank you. Anything else we can or should do to accommodate org-roam-bibtex? |
Nope, I think we're all set. Thank you for your work! 🎉 |
Hello, I'm getting an error |
I'm looking into it, thanks for bringing this to our attention. |
Thanks both! Fix is merged. |
Hello,
I wanted to include timestamps in the header of my file-notes, but I realised that
bibtex-completion-notes-template-multiple-files
didn't handleorg-capture
template expansions. Since I don't think there is any drawback to it, I figured we could add it inmaster
.Thanks for your work on
helm-bibtex
. I've been running it for a few years, and it's been stellar.HTH.