-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Generalize embark-mark and embark-unmark #253
Comments
embark-select/collect-one
which allows to select candidates one by oneembark-select/collect-one
which allows to select candidates one by one
See these relevant comments and the discussion in #256. |
A related even simpler but still powerful idea: allow mini-buffer embark to act on all the displayed candidates (instead of the first or single selected). I find my self often selecting buffers using consult+orderless (10x faster than any other way), then exporting to an ibuffer, then selecting all ( |
Yes, indeed. My idea is to have two features:
Then one can only use (2) to act on a candidate subset obtained by plain filtering using orderless. But one can also do one by one manual collection (1) if that is desired. |
Since this functionality isn't implemented I can't be sure, but I feel like the ability to run the same action on all current candidates would probably be enough for me. I'm not sure I'd miss the ability to collect candidates haphazardly. |
I have another idea - it would be slightly UI specific: I could add some command to Vertico/Selectrum which allows you to select candidates. And then I write a separate Embark collector which collects just the selected candidates and which will be registered right before the all-candidates-collector. Then we need commands |
Not sure where best to put this, but maybe here. FYI, I had a long back-and-forth in the past couple of weeks trying to get the author of this project to use completing-read everywhere. https://github.com/jkitchin/org-ref-cite I mostly succeeded, save for one piece. He explains why he stayed with ivy as:
|
It seems this package is mostly decoupled? Is there a problem to write multiple frontends, one for ivy, one for helm one only completing-read+embark? Also it seems to be that there is overlap with your bibtex-actions package. |
Definitely.
Not at all. I just thought it could be valuable to hear what an ivy-focused developer values there.
Yeah, they're different ways to use the same bibtex-completion backend. But that's cool. It is all modular, so we can easily mix-and-match components. I, for example, can use his hydra with my CR front-end, and he can in theory use my embark-act at-point integration with his ivy front-end. |
Coming back to this "another idea", WDYT? How it would interact with ideas previously discussed in #166 WRT to |
Perhaps this would be the correct first step, and if we find this hypothesis is off, can always add the more fine-grained control later? I was thinking about this feature again when thinking about using |
I added an |
This is great! Thank you. I will give it a test. |
Apparently I only ever used Similarly, I do most of my file management tasks with file actions from |
@minad @bdarcus @oantolin Here is my code:
Now you can use For instance: I think it is easier to operate than |
That looks quite nice, @Elilif! Maybe it's worth making a tiny package that depends on Embark and on Vertico for this? Or at least documenting it here on the Embark wiki. I haven't tried your code yet, but if I'm reading it correctly, you can continue typing in the minibuffer to narrow further and this does not forget which candidates of the wider list were marked; that's great! The one thing I don't like about this type of interface is that it is pretty hard to see all marked candidates at once, although I guess Embark can help with that: just insert them somewhere. If I understand the code correctly, they stay marked so you can act on them again. |
I guess this is related to previous discussion that resulted in the now defunct |
The snippet made by @Elilif would be quite a simple addition. Unfortunately it breaks down as soon as you want "more", like showing all the marked candidates and also interacting nicely with filtering. But maybe remembering the candidates is just good enough, since you can also show them by collecting them? Anyway, these limitations are the reason why we didn't proceed with this feature in the past. If we want this, we would also need additional integration code for other UIs. One possibility would be to generalize |
Yeah, my intention is to have a method that could be between |
@minad: That does sound worth trying. @Elilif: I haven't actually missed the ability to mark candidates in the minibuffer, and I'm not completely sure why I haven't. I think the main reason is that if I want to do the same thing to a bunch of candidates there is almost always a clear pattern to their names: I want to kill all vc buffers and their names start with So the vast majority of the time |
From my experience this mostly happens with killing buffers, deleting files etc, while not having to think about patterns. Oh I want to delete this one, mark, this one, mark, oh and that one over there too, down down down mark. If we can make this work with reasonable effort, I am in favor of trying this. For me the convincing reason is that it is a generalization of the existing Embark collect marking infrastructure. I can try to implement it for default completion, Embark collect and Vertico. But no guarantee that it will work out nicely. I'd like to avoid adding serious complications to the integration code if possible, since this is a recipe for unstability in the long term. |
I too am in favor of trying this, I was just trying to see more of the appeal. For me, if there is a clear pattern to the candidate I want to act on, I reach for Marking, unmarking and making embark-act-all work is easy. The only tricky part is getting some visual feedback on what is currenty marked. That requires UI-specific code. For Vertico I think advising |
I think one additional motiviation is that completion is restarted for some commands when acting. This means the method of scrolling and acting on each candidate individually is inconvenient. For example Consult narrowing is lost, the selected candidate is lost, etc. I've also recently learned that Helm aborts completion altogether after acting (at least by default), which avoids the kind of restarting ugliness in the first place.
For Vertico one can use a
No, for default completion, Embark collect and all other normal buffers, Embark should simply install an overlay over the target. This is why I think the generalization is elegant. The target finders should return boundaries in these cases, right? We could simply demand that the target finders must return boundaries for this to work. Only Vertico, Ivy, Icomplete should require special casing. |
Yes, I was wondering about this example. Edit: The original mastodon thread, with some discussion of the limitation of the https://mastodon.social/@gmoretti/109460454739376441 Though in that case we're using our custom multi-select UI. |
@bdarcus |
OIC; thanks. And this should work with |
Nevermind.
…On Thu, Apr 20, 2023, 11:12 AM Omar Antolín Camarena < ***@***.***> wrote:
Yes, that is the idea. The way you do it is, assuming you bind embark-act
to C-. is to type C-. SPC on each item you want to select, and then use
embark-act-all which is C-. A to run some action on all of them.
If that's too many C-., you can bind a keyboard macro to C-. SPC. You can
can also bind the command embark-act-all to a single key, if you wish.
—
Reply to this email directly, view it on GitHub
<#253 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAI3XDY2UPFMPIXPY4323XCFG4TANCNFSM477HVCNA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Ah, I saw your "nevermind" a little too late. |
I forgot to do embark-act-all :-)
I do wonder if in time that might go away?
If one selects multiple, then are you not, by definition, wanting to act on
all?
|
Acting on a single candidate is different than acting on multiple candidates. I would prefer if this distinction is kept. If you want an act dwim style command you could write: (defun embark-act-on-single-or-all ()
(interactive)
(if embark--selection (embark-act-all) (embark-act))) EDIT: However this creates problems with the selection action itself, since as soon as you selected an item you probably don't want to unselect it again right away. You should then at least bind the selection action and |
I was going to post exactly the same function that @minad did! I have lots of Embark things in my muscle memory now, like |
I want to emphasize it was a question, and I'm not set in my opinion. But that seems incoherent at first glance. If you select multiple, you want to act on multiple. I was surprised after selecting multiple, per my earlier question, that it only acted on one. Obviously you'll have to see what others users says, but just wanted to put the idea out there, based on my initial experience. |
The way I see it, if I select multiple candidates I eventually want to act on them, but not necessarily right now. For example, yesterday I was editing some notes and wanted to add references for some claims I made, but I was also doing other editing, like rewording, reordering some paragraphs, etc., anf I didn't want to stop to look up the references. So instead I selected the sentences for which I needed to add a reference and was free to use embark anyway for editing (I use it a lot to reorder paragraphs and sentences for example, or to delete entire parenthetical remarks from anywhere inside the remark). Then when I finished editing I ran embark-collect to get a buffer with all the sentences needing a reference, and only then started looking them up. More philosophically, if embark-act forced you to act on the selection it would become a modal interface: once you select anything you are now officially in selection mode and loose the ability to decide what to act on until you leave selection mode. I don't like modal interfaces and while I will happily provide building for others to build their own modal prisons, I wouldn't make that the default in Embark. I find even the modal minibuffer a little constraining and thus recommend enabling recursive minibuffers. |
Plus that function that @minad wrote is short and sweet and solves your problem. We can add it to the wiki and even to the manual, but I I'd prefer to keep embark-act and embark-act-all separate. |
Oh, right @minad, with your embark-act-single-or-all you need a separate binding to select items. That's easily solved, but definitely worth pointing out. |
FWIW I don't want that. To me the Embark design seems coherent as is. But I understand that your proposed workflow is useful and maybe preferrable. I would bind some key to a macro which directly selects and another key to such an embark-act dwim style command. For my taste this is not as nice as the current design, since one needs another key, the selection action is singled out as a separate action. Furthermore I usually want extra protection for @oantolin What about the proposed renaming in #253 (comment)? I saw that you already bumped the version. |
There were are few more things which came to my mind recently, but I forgot them over the discussion. I wonder if we can be sufficiently sure that |
Oh, no! I hadn't seen (or maybe I did and forgot) the proposal to rename |
The question of the selection becoming invalid is tough. You are correct, @minad, that currently It would be easy to implement an alternative model in which:
Would that be better? |
You could change it now, update it everywhere including the changelog and then tag version 0.23. This has also happened to me, that I tagged multiple versions in quick succession because a mistake got in first. I usually avoid tagging a new stable version directly after making any kind of significant change. I usually wait a few days or a week. Many users will pull your package anyway from MELPA or ELPA-devel. Then incoming feedback can be addressed before the release. |
I think we should first gain some experience with the current model and maybe only then make changes afterwards. If the decision is made to use another model I would try something simpler - candidates without bounds are always preserved and candidates with bounds are automatically deselected when they are edited. One can use simple overlay modification hooks for that, such that this would be a trivial change. See https://github.com/minad/jinx/blob/2f7f4ac9ce3f69a0d086e2600406c36f46ff3a07/jinx.el#L266-L268. |
My main concern about the current model is that one somehow loses track of the selected candidates. But in order to tell this, I have to gain more experience with the workflow. But anyway, one can always easily inspect |
I should definitely start doing that. I have done that most of the time, in fact. Here I jumped the gun and it also happened to me once before. Do you describe the changes in the changelog even before bumping the version number? That sounds like a good idea for early adopters. |
I agree with using the current system for a while before changing the model. |
You have those two swapped, right? |
Right, edited. |
Yes, this has happened before. But it is usual that it takes some time to develop a robust release workflow. I am regularly tagging new releases for my packages if new features got in, but almost never right away. Then I usually inspect the last release in order to ensure that I don't forget anything, basically
Yes, see for example https://github.com/minad/vertico/blob/main/CHANGELOG.org. |
There are also many different "philosophies" about how a changelog should look like. I only describe user-facing changes or very relevant technical changes. I also try to keep the changelog concise and usually don't reference the issue tracker. It should be somewhat readable. There are also more formal changelogs which always reference the issues (https://github.com/radian-software/selectrum/blob/master/CHANGELOG.md), but for me this hurts readability. It may be better in the long run if you want to investigate something. But there is still always the git log for that. For me the worst example are the Emacs "changelogs" which are just extracted from the git log, e.g., https://github.com/emacs-mirror/emacs/blob/master/lisp/ChangeLog.16. Totally useless. The NEWS files on the other hand are very useful, but are often lacking information. |
I think I agree with what you put into the changelog. Maybe except in being very brief always. For a major new feature, I'd like to not send people to the manual. I did the renaming and bumped the version again. 😬 |
Makes sense. Your changelog entry looks very good. The only danger is that you will end up with a massive log after a few releases, which takes a lot of time to read. I am still finding my best style for changelogs. :)
Great! |
Very much related to #166, feel free to merge these feature requests.
embark-select
action, add them to a collect bufferThis gives us convenient actions on multiple candidates.
The text was updated successfully, but these errors were encountered: