-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
consult-org-heading, consult-org-agenda #276
Conversation
I am still a bit on the line regarding org commands. While I use org and like it, it offers vast functionality and I am not always sure that new functionality is really needed inside Consult. Org already provides many fancy UIs on its own. So maybe I just feel like I am not enough of an org power user to maintain these commands and they are a better fit for a separate consult-org package? I observed for example that the command To address your comments:
I cannot tell what is better. For imenu it works well, for
I personally wouldn't overdo it with the narrowing options. Right now, narrowing is used in a very "narrow" sense only, think like in consult-buffer/consult--multi, to unhide a few candidates for example. There is no support for fancy filtering. I thought before about supporting more options for narrowing, allowing to narrow according to multiple criteria etc. But these things are in conflict with completion filtering, why would we want to add another filtering system on top of basic completion? For fancy filtering narrowing one would rather want oantolin/orderless#30.
Is it possible to cache the items somehow? If it is too slow, it should not be added here. But a noticeable lag does not sound too bad, it is like consult-line on a large file.
It depends on if you want to attach Marginalia annotations or Embark actions.
The category is not needed for narrowing.
Yes, that's right.
This should be configurable if you use
Sounds good. But I am not using the clock feature right now 🤷 Sorry for not being more concrete! I will add some more comments to the code. |
True. It tends to use Magit-style menus (of course Org predates Magit, by far). In fact,
I am by no means an Org power user, and I wouldn't want to maintain a consult-org package. Now, I would argue the 2 proposed commands are of somewhat broad appeal. I can't think of a third org-related command that would be of broad appeal.
In this case I will not add any narrowing, at least for now. I'll react to your other comments when I have time to work on this again. And we can also wait a bit to let the question of having or not Org-related stuff in Consult mature. |
So, I think I've addressed all your code comments above. I also added narrowing; I may even have gone a bit overboard with it. But it turns out that the most useful (narrow by TODO) was the trickier to get right. Concerning flattening of the tree structure, I noticed the command would be useless without it. Lastly, I created separated And again: I'm not insisting that this should be merged :-). I don't like the idea of having lots of separate little packages, but I might create it if you don't want to include this file in Consult. Or maybe not... |
Okay, I think this looks good besides a few minor nits. |
You might want to add to the user configuration that |
You mean to the readme? Feel free to add your documentation there too. |
I was going to add this, but since it's more of an org-mode hint, I'll let you decide what to do
Otherwise, it's perhaps good to merge now :-) |
Okay, I will probably not add the config example to the README. Org users will know. This looks pretty good now. I took another closer look and still have some improvement proposals. Sorry for the back and forth multiple times, I guess I am a bit more critical since these are the first org commands which are going to be added. |
Now that I think more about the narrow API, I get the impression that it was thought around splitting the candidate list into disjoint collections, and one needs to do some contortions when that's not the case. Fundamentally, the narrowing data should just be a list of predicates. But since we need a UI to select a predicate, the narrowing data should be a list of elements of the form In many cases this would seem like overkill, and for convenience one could accept
as a synonym for
or something similar using a dynamic var. This would also make the narrowing data reusable. For instance, we could append the Or am I missing something? |
You are right. I am sorry for the confusion. I missed that the levels are not disjoint. Then my narrowing proposal is not better to what you have. Todo status and priorities are disjoint, but not the levels. Actually not much thought has been put into the narrow API and I prefer to not over do this in order to avoid introducing another complicated filtering system on top of the completion style as I said in my first comment here.
The scheme you describe is very similar to |
Perhaps not. But whatever you had in mind in oantolin/orderless#30 would be an example, right? The basic difference between the two cases would be the responsibility of defining the categories and predicates: the caller of completing-read or the generator of the candidate list. |
Let's keep it simple as is for now. In oantolin/orderless#30 I had in mind to add these filtering capabilities for exisiting commands depending on the category. Btw one could also implement a narrowing package in the style of Marginalia which enhances existing commands, e.g. adds narrowing/grouping to M-x. |
@astoff commented on this pull request.
[...]
But maybe we should check what other people think. Perhaps @oantolin and
@protesilaos have an opinion?
Thanks for considering me! I do not have an opinion because I have
never done any real work with Org's clocking facilities: I have only
used them once or twice out of curiosity and to test some basic things.
…--
Protesilaos Stavrou
https://protesilaos.com
|
I've pushed a commit that makes the algorithms O((m+n)log(m)) — I think. Now, hash tables aren't meant to work with markers, since they get mutated all the time. But one can define a hash table test which is okay for short-lived hash tables. |
I am mostly happy with this now. The question is if we want to prepend the buffer name to the candidates if we are in a multi-buffer scope. Then we can hide the buffer name again using the |
I really liked the grouping/title thing, and I think the default should be with titles and no prepended buffer name, at least on the vertical UIs. But we have all information to prepend the buffer name at hand, so it should be easy to add. If it's also easy to remove, I see no harm in this. |
The idea here is to add it for the filtering. If the UI supports the title function the prefix will be removed again and will be shown only in the title. I work on a patch for this now :) |
Okay, I added the commit. You may want to give it another try and then I will merge this. |
Looks good to me! |
Thank you for the contribution! |
Co-authored-by: Daniel Mendler <mail@daniel-mendler.de>
Hi, I can help testing them if needed. |
@gdindi There has been a long discussion here. It is better to implement these clocking commands as Embark actions. |
Thanks for your answer. I don't understand what that means, but I will try to decode looking at what Embark does. |
I've kept a dedicated clock-in command in my config, and I'm actually using it a lot (usually directly, more rarely as an Embark action). I don't know what these 3 variants that @gdindi mentions would be, though. @minad (cc @oantolin) Aren't Embark actions just plain old commands? So how would an Embark clock-in action differ from a |
@astoff I meant that one could execute org-clock commands on the org headings in |
That unfortunately doesn't work. One needs a wrapper command. FWIW, a bare-bones @gdindi Jump to the current task already exists: |
Yes, this is what I meant. Which additional bells and whistles you would like to have? |
The main one is a Should I maybe add the simple and the fancy versions on the wiki? I just didn't want this to mean the command will never make it into consult-org.el. |
Wiki is the right place for these commands now. I am looking for more general building blocks, for example consult-org-heading is great :) |
@astoff Nice. Thank you! |
Possible org-related commands were already discussed in the wishlist thread. In my opinion, the two most useful actions would be jumping to an agenda item and clocking in. This pull request is a draft for those two commands.
Possible improvements:
consult-location
here, or invent a new category to allow attaching extra information to candidates, for instance the information needed for narrowing? Also, do I get it correctly that using lists of strings instead of lists of conses is the preferred way to build a candidate list now?outline-n
.consult-clock-in
, it would be nice to somehow inform the user about the currently clocked task, if any. One possibility would be to show the task name in the prompt, as inClock in (current: Heading 1):
. Any other suggestions?What do you think?