-
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
pre-1.0-cleanup branch #651
Conversation
2ba3553
to
6157ca5
Compare
Because they're machine-readable, and can remove some human-readable text. Also update the dates and such.
I don't think my name is needed on on the copyright. I haven't tested the new interface yet but I will over this weekend. |
Agreed. No need to worry about it for me. :) I'm testing and reconfiguring some of my custom functions now. All seems good so far, and its easy to see the API is much more sensible/consistent. I'll be sure to flag any issues when/if I come across them. |
@localauthor - OK cool. Do you use Embark, such that you're testing the new minor mode? |
I am testing the Embark minor mode, yes, and all seems ok so far.
|
And remind me: do you use markdown for notes, and your note package? If yes, any thoughts on my question 1? Might be we add a note source config for markdown, at least to the wiki? So I'm curious what that should look like, to answer that API question. Perhaps that's what you're working on now? |
I primarily use org-mode, not markdown. But I've used some homecooked advices to access my notes through citar, so it'll take a bit of reworking before I can comment on the note source API specifically. One thing: I think |
Ok, so I've just made a note source tailored to my Re: question 1 above, I think |
The one wrinkle here is the distinction between format and create. With the former, we could use same open function, but different format functions, for markdown and org. I lean, then, towards Or could just write the docs in such a way it's clear it's up to the developer to do what they want with the functions? |
This is one place where the API is a little non-orthogonal. If your note-taking package is agnostic about Org/Markdown/etc., it still has to be able to format the note appropriately because that is the responsibility of the note source. Even though perhaps |
We should rename But beyond that, it seems the options are:
Right? |
I agree there should only be one function, just as emacs has
This is of course a question for the developer of the note package, but if they want Citar to handle the note formatting (option 3) then we might able to provide a function to help them. |
Does that not suggest an (optional) So then the default ( That reminds me; we should rename |
Would Citar call this after the
The The simplest way to do this would be to add a defcustom Another option would be to add a command like We'd need a new note API function ( |
Yes. I was just doing the thought experiment of asking what it would look like to add a markdown function that otherwise works the same as the current org one. But I do think perhaps if in doubt, we should stay with just the one.
Except, would that generalize? What if someone wanted a note source where there was a single file, and markdown?
Do you think it's something you're confident we need to add now, or should we just add it later? For example, one wrinkle with this is org-roam allows more than one ref per node, while I suspect most systems wouldn't. But I guess we'd want to be more general here? My impulse is the latter (hold for later, until we actually need it). I'm less concerned with adding note functions later, than changing how they operate. |
For now, I just pushed 7a04d3e |
Lest this get lost in the shuffle: Should |
Sorry; meant to add that also today. Done. |
I've pushed a new commit that makes some API changes. As @bdarcus hoped in #634, the API functions no longer take an optional This change also affects notes sources since the I've also simplified some of the code around |
citar.el
Outdated
(if-let ((resource (citar--select-resource keys | ||
:files t :links t :notes t | ||
:always-prompt citar-open-prompt))) | ||
;; TODO Does this work for non-file notes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@roshanshariff - do you mean, for example, citar-org-roam?
If yes, the answer is yes; it works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correction: something is broken.
Unrelated to this, but with citar-open
:
Debugger entered--Lisp error: (void-variable embark-default-action-overrides)
citar-open(("ahrens2017"))
funcall-interactively(citar-open ("ahrens2017"))
command-execute(citar-open record)
execute-extended-command(nil "citar-open" nil)
funcall-interactively(execute-extended-command nil "citar-open" nil)
command-execute(execute-extended-command)
... which I can't figure out, because you declare the variable.
I did push a tiny fix for a syntax error (let
-> let*
) in citar--library-file-action
, that I squashed into your commit, but that doesn't resolve it.
BTW, I created a separate branch with the updated :open
property for citar-org-roam
, if you want to test it.
https://github.com/emacs-citar/citar-org-roam/tree/cit-1.0
EDIT: I earlier edited this noting a bug with citar-open-notes
, but that turned out to be user error :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested it and citar-open
doesn't actually work when opening notes with citar-org-roam
:
- Set
citar-notes-source
to'citar-org-roam
. - Run
citar-open
and select a ref with notes. - Select a note and press RET.
It just opens a new file named like "citekey nodeid"
. This makes sense because citar-open
calls citar--open-multi
, which has no idea what to do with a string returned by a note source's :items
function. It just treats it like a filename and calls find-file
on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
I don't know what happened. Could have sworn it worked on main.
But I'm kind of distracted ATM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just pushed a commit that looks to me like it should work, but doesn't. So it's close.
Can you take a look please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the problem, though not yet a solution:
citar--select-resource
returns a plain string; not a propertized multi-category
string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need an additional optional note property; a function to say what to do with the string?
But we still have no way of knowing it's a note, unless I guess we assume anything other than a URL or a file is?
Best if we remove my latest commit regardless; that won't work. done
So you're no longer concerned about this? |
The API functions no longer take an `entries` argument. Instead, there is a new buffer-local variable `citar--entries` that can be let-bound to prevent the API functions from accessing the cache. Also, simplify `citar--select-resource` and related resource opening functions. Finally, add `:transform` key to `citar-notes-sources` that is used by `citar--select-group-related-resources` to transform note candidates for display.
Edit: I moved this to #653. |
I agree with this, those divergences would be hard to track down if they happen. And speed is definitely not a concern for me. The new cache generation is very fast and most of the my bib files have less than 200 entries so even the first run feels instantaneous. |
I think the best way to fix
I think the Personally, I think this makes for a more logical notes API: As an aside, doing (1) also simplifies the grouping function a great deal, since it doesn't have to guess what type of resource it's been given. I can implement this plan if it sounds acceptable. |
Yes, that's acceptable; it's basically what I was thinking (the lookup part).
Thanks!
|
I see @roshanshariff pushed the note fixes. Thank you! So far, we haven't gotten any reported bugs or suggestions, except our own. And I believe we've resolved all. Anything else that needs done before I merge, and tag 1.0? |
I merged this. Will hold off on tagging 1.0 until I hear back. |
* Change :action to :open * Add message with number of notes opened * Update code for latest changes in emacs-citar/citar#651 * Fix docstring Co-authored-by: Roshan Shariff <[email protected]>
Would it be okay if we held off on tagging 1.0 for a week or two? There are some parts of the code base I would like to review more thoroughly. It's possible that a Citar 1.0 release will get some publicity, and it would be good to minimize the chances of bugs that might put off new users if they encounter them. There are also a number of TODOS we should probably resolve as well. Maybe we could just do another point release in the meantime? |
Yes; sure thing. Should I go the point release now, or wait? |
I don't think we've introduced any serious new bugs, so I'd be okay with releasing now 😅 |
@roshanshariff I haven't had time to cut a release, but I did just assign a new bug to the 1.0 milestone. I'm dealing with some crises ATM, so likely won't be able to help much. But I raised your privileges, so you can merge things yourself. |
Where do we stand ATM @roshanshariff? You obviously were able to address at least some of this with the notes functions, but I wasn't sure if there were other pieces of the code you felt needed review before we tag 1.0? I know your time is limited these days, and mine will likely be for a couple/few months, so it's just a question of when the right time to pull the trigger is, without delaying too long. From my POV, it certainly makes sense to close #507, but I think other issues can wait, though I did assign a few others to this milestone. |
One thing I noticed while testing my recent changes on an old file: the new caching seems to be case-sensitive on the field names of the entry i.e. "Title" field is not equivalent to "title" now while it used to be. Maybe some uses of I don't know if this was intended and I don't think it is crucial since this can be resolved by adding both cased versions in the template. But seems like something that should be settled before 1.0 whatever the answer here is. |
That sounds like an oversight. It could be changes in parsebib maybe? I do vaguely remember we needed to use It should remain the case that it works for both formats, as should ignoring case. |
@aikrahguzar, thanks for spotting the case-sensitivity bug. In 64c332a, I've added back the case-fold option to the @bdarcus, I think the main pending issue for 1.0 is the performance regression in #659. I did some preliminary investigation there and on my (fairly old) computer I don't see the problem right away (loads that bibliography in ~5 sec). I'll have to investigate a little more to see where the slowdown is. Other than that, since we did the notes refactoring, I don't foresee any needed changes to external APIs in the immediate future. There's just the matter of mopping up the small bugs you've already tagged under the v1.0 milestone (and any others that might be uncovered in the meantime). |
That's really weird. Maybe Colin could help with that? I suppose in theory the PR I merged yesterday should speed things up a tad (since before that we were cleaning TeX strings twice), but not enough to explain what he's seeing. If we can't reproduce it, though, that shouldn't hold up 1.0, since it doesn't appear to be a general problem, and a fix wouldn't impact the API. |
Only question I have is if not using multi-category has implications for
embark?
|
It shouldn't make a difference to Embark, because from what I remember of its code, it doesn't distinguish between single-category completion and multi-category with all items having the same category. It might make a difference to other hypothetical packages that interact with the completion system, since specifying a single category is part of the standard Emacs completion API, whereas the multi-category mechanism is a non-standard extension that is followed by Embark, Marginalia, etc. |
Seems some sort of GitHub hiccup here. The comment says I posted that today. But I don't even remember doing that, which means it was probably months ago! Shrug. |
…r of notes opened* Update code for latest changes in emacs-citar/citar#651* Fix docstringCo-authored-by: Roshan Shariff <[email protected]>
I was realizing I was making too many small commits, so setup this branch to collect various commits to get this repo ready for tagging 1.0 in the next week or so.
The first commit emerged out of a suggestion from the MELPA review for citar-embark, and that is to use these for the file headers:
https://spdx.dev/ids/
So I've done that, and also removed the human-readable license text. I hope that's OK; I guess it should be if MELPA folks recommended it.
@localauthor and @aikrahguzar - not sure if you wanted your names on the copyright for some of these files?
Questions/Issues
:action
function (or we could all it:open
?), and leaving out the:create
one. My reasoning is that creating new notes is pretty closely-tied to opening them, and so better to just have the API reflect that. Yes, if someone wants something like the default source for markdown, it will mean having to copy and adjust the default function(s). But that seems a small price to pay. And at least withcitar-org-roam
, there's no value in a separate configurable function for new notes.