-
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
Customize initial input #130
Customize initial input #130
Conversation
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 added one minor suggestion (which you can commit by just clicking to accept it), and added a link to the issue to your post.
But the bigger question is I'm not clear on the use case, given my response to #129.
Can you clarify?
bibtex-actions.el
Outdated
'((pdf . "has:pdf") | ||
(note . "has:note") | ||
(link . "has:link") | ||
(source . "has:link\\|has:pdf")) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
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.
Space is added in bibtex-actions-read
, which see.
As to the use case, I thought the idea is to just make it customizable anyways. It's Emacs, after all. 😄
For me, at least, there is actually a good use case: I use bibtex-action-open-notes
with the fallback mechanism provided by bibtex-completion
, which creates a note file if there is none. So the initial input is useless, since for me, bibtex-action-open-notes
is supposed to open or create a note with one command (which is very handy, btw). Another use case would be the ability to define what "source" actually means (as discussed in #121 ).
But TBH, I cannot imagine many more use cases right now. 🤷 So it's up to the maintainer!
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.
Space is added in
bibtex-actions-read
, which see.
Oops! I just hid the comment then.
As to the use case, I thought the idea is to just make it customizable anyways. It's Emacs, after all.
Well, no; customization for the sake of it would be overkill.
But when there's need, that's another matter.
For me, at least, there is actually a good use case: I use
bibtex-action-open-notes
with the fallback mechanism provided bybibtex-completion
, which creates a note file if there is none.
Ooh, that's actually one I care about too; I totally forgot about that!
This does raise a larger design question, which is what @apc and I were going back-and-forth on in #118.
We settled on the initial-input approach, because the goal was filtering, but to make it easy for the user to effectively turn off or modify the filtering mid-stream; in this case to delete the initial-input.
This is not only because of cases like this, but also because with embark, you may open your library with one action in mind, but change your mind, and so need access to a wider list of candidates.
So the big question: did we make the right decision? And if yes, is this the right addition to this?
I'm inclined to say yes on both counts, but curious what you and @apc think.
So the initial input is useless, since for me,
bibtex-action-open-notes
is supposed to open or create a note with one command (which is very handy, btw). Another use case would be the ability to define what "source" actually means (as discussed in #121 ).But TBH, I cannot imagine many more use cases right now. So it's up to the maintainer!
No, that's a good enough reason, per above.
It does occur to me, though, that default value for notes should be nil. This is largely because they are different than the others, for the reason you note. |
So you approve the PR, right? Nice! Only thing I forgot, as usual, is the readme. As to the default value for Regarding #118, I also think that the initial input solution is quite elegant to solve the problem of filtering: it can be easily changed and since it is visible, it is understood immediately that some kind of filtering is active. No need to remember some keys. |
Let's see if any feedback comes in from others. I know @apc is in the US, for example. Your solution is the most general, but if I had known about this use case upfront, I probably would have suggested starting with a boolean specific to open-notes, so users can just do something like: (setq bibtex-actions-prefilter-notes nil) What would, for example, the README addition be for this solution, for example, for the user that doesn't use the defcustom UI? Edit: the user would have to redefine the entire alist; right? So for our preference, would have to add this to the init? (setq bibtex-actions-initial-inputs
'((pdf . "has:pdf")
(note . nil)
(link . "has:link")
(source . "has:link\\|has:pdf")) |
I'm inclined to agree with @publicimageltd that setting the default value of 'notes' to I think it might be helpful to emphasize that the user may want to set a 'default' entry point to her list of references (I essentially treat So ideally, you would have a single command for each of |
To be clear, we all agree on this, for the reasons @publicimageltd outlined.
Before I wrap my head around this, I just want to make sure we're all on the same page WRT to notes. Are you aware of this @apc? https://github.com/tmalsburg/helm-bibtex#notes This is what @publicimageltd is referring to. I actually don't remember whether the "add new notes if none exist" functionality is built in to bibtex-completion, or it's automatically added when you use But in any case, the config a user has to do it minimal. I do agree it's not on by default, though, which is why it makes sense to filter by default. I think our question for this PR is twofold:
|
I'm not super clear on what you mean by 'this' here. Is it the option to work with a single note file or with multiple notes files? Or is it the functionality to create a note if none exists? I was aware of both, but I took @publicimageltd to be mostly talking about the latter. But maybe I'm misunderstanding something here?
No, it is built into
What is not on by default? Sorry, I think I'm only half following here. Maybe I should be looking more carefully at the PR...
I see little harm in having the most general functionality available to users—let anyone customize what, if anything, they want as filters for the relevant actions, but give 'sane' defaults. I cannot think of a reason to use anything other than `nil' or one of the original values as initial filters, but I imagine most people will not need to tweak the defaults, so I say go for a "if you want to mess with these defaults, here, you can do whatever you want" approach. ;) |
Sorry. I complain about non-specific referents with my students all the time! By "this" I mean automatic note creation.
So not only is it included, but it's on my default? If that's the case, then I go back to my earlier point: I don't think we should filter by default. In any case, I think we should base whether we filter by notes or not based on what's default. If automatic note creation is default, then initial-value should be nil by default.
OK, then. Thanks. Any further thoughts @publicimageltd? |
Oh, and @bdarcus I didn't mean to suggest any changes. I was just thinking that there were two options for how to think of the filtering etc.
I was suggesting that the better approach is 2. (At first, I thought this could, but need not, involve making |
😆
I think so, yes.
I ultimately think it's fine either way. But, FWIW, even taking the That said: perhaps my mistake here is thinking that how you get to the list is essentially irrelevant because of embark, and not properly keeping in mind that someone may just want to create a note by default from the list of entries by simply pressing |
Let me just explain why I initially added I was consistently annoyed when wanting to open a document (pdf or link) that I didn't know which entries that action would return a result on. Aside: So I wanted to filter on presence of different related items, and also for the UI to reflect that. With that, I would no longer be surprised. But you, @apc, pointed out the next step was to incorporate this into the relevant commands. However, |
I see. That makes sense. I was probably thinking about things differently. Since you already have indicators that will tell you which entries have pdfs, say, it never occurred to me you would call I guess there are two ways of thinking about what's best to do as a default: have it so that there's as little friction as possible for |
I'm kind of lost in this discussion now, to be honest. So what about utmost explicitness?
|
Sorry. This does end up somewhat complicated, in part because our goal (or at least mine) is simple and clear for users. I can make decisions and commit them on this branch for final review, hopefully later today, but in the meantime I think I only have one question for you, @publicimageltd: Why would someone want to change the value of the Is it we don't really have a reason ATM, but it's a more general solution so gives more flexibility in the future? I do think we need to turn off note filtering by default, but I think I'll just need to decide on that. In any case, I can include the README content that explains all this, hopefully simply and clearly, and you all can see what you think.
I don't think we need to go so far as to add commands :-) |
Actually, here's a start of possible README content: By default,
That is, upon running the command, an By default, pre-filtering of If you want to modify those values, or remove them entirely, you can set (setq bibtex-actions-initial-inputs
'((pdf . nil)
(note . nil)
(link . "has:link")
(source . "has:link\\|has:pdf")) |
Actually I think that one advantage of the current PR is that the options are much more explicit than a simple
But it could solve the slight inconsistency we are struggling with, which is, at least in one view, basically the fact that there is one exception (notes) which forces us to add customization for every other open command. 🤷♂️ In any case, the README proposal is clear and understandable, go for it! |
This is partly another consequence of me trying to simplify naming compared to That function there is called OTOH, in hindsight, you could argue that opening PDFs or links is a view--only option, so could have had command names like Hmm ... I guess there's some confusion around these verbs: open, view, edit (and add) in general. |
Here's the PR for the customizable initial input. AFAIU, all other occurences of strings like "has:pdf" in the source code are used for actually inserting these strings in the candidates, so they should not be affected by that change.
Closes #129.