Skip to content
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

Feature: multiple kubel buffers #114

Merged
merged 3 commits into from
Dec 24, 2023

Conversation

TxGVNN
Copy link
Contributor

@TxGVNN TxGVNN commented Sep 11, 2023

Continue on topic #96.

After discussing at #112 and base on the idea/code of #57. Thanks to Diego Alvarez

In #57, each time I run kubel, it always create a new on buffer with a same buffer name (ya, with a suffix number) and if we want to create multi buffer we have to run multi time of kubel, pretty annoy to me.

I resolved these issues by

  • using (clone-buffer) to clone the local var and rename later when we switch recourse, namespaces...
  • kubel-refresh assume buffer name will match to name of current-buffer, if not it will kill the duplication and rename to correct name

And I added a new interactive function kubel-switch-to-buffer to switch to only kubel's buffer by using prefix name

Hi @abrochard, @d1egoaz. Could you guys take a review and test? Thanks

@abrochard
Copy link
Owner

(sorry i'm super behind on this. I still intend to test and merge when I can. thank you for submitting)

@TxGVNN
Copy link
Contributor Author

TxGVNN commented Oct 15, 2023

(sorry i'm super behind on this. I still intend to test and merge when I can. thank you for submitting)

Ya, these change should be careful tested before merging

kubel.el Show resolved Hide resolved
@abrochard
Copy link
Owner

Thank you for your patience. I just did a full test of the major pathways that this touches and it's looking great. I really like the switch buffer method you implemented.

The only thing I found is duplicated code throwing an error in kubel-set-output-format.

I can patch that for you (and also fix the conflicts) or you can do it. Up to you. But as things are, we could merge before new year.

In any case, happy holidays!

@TxGVNN
Copy link
Contributor Author

TxGVNN commented Dec 23, 2023

Thank you, looks like you've got some free time before the holidays 😄

I can patch that for you (and also fix the conflicts) or you can do it. Up to you. But as things are, we could merge before new year.

Yes, sure. I need your help. Could not be better.

In any case, happy holidays!

Happy holidays, you too!

@abrochard abrochard merged commit 3882222 into abrochard:master Dec 24, 2023
2 of 4 checks passed
@abrochard
Copy link
Owner

It's a christmas miracle! 🥳
Thank you for this change!

@Kyrremann
Copy link
Contributor

Kyrremann commented Jan 12, 2024

This is probably intended behavior, but each time I now change namespace, context, resource it creates a new buffer, the problem is that the old one is still there. I use q to exit the current kubel-buffer, but then I just end up on my last resource or namespace.
Is it just me, or would it be nice to toggle this behavior?

Edit: I do like the b shortcut, so maybe I just need to change may way of navigating Kubel and Emacs.

@TxGVNN
Copy link
Contributor Author

TxGVNN commented Jan 13, 2024

This is probably intended behavior, but each time I now change namespace, context, resource it creates a new buffer, the problem is that the old one is still there.

I want to say this is feature even seems you do not like it :(.

I use q to exit the current kubel-buffer, but then I just end up on my last resource or namespace.

Yes, it actually exits the current buffer.

What is the behaviour you want to expect? Or any feature you want, like a function kubel-kill-all-buffer

@abrochard
Copy link
Owner

Yeah I admit this feature changes pretty drastically how kubel behaves but I personally love it. Looking at how it was implemented, a toggle to revert back to the old behavior is possible but not trivial.

I would encourage you to play around with the new behavior and as @TxGVNN suggested, if there's a specific function that would help, please let us know.

@Kyrremann
Copy link
Contributor

The What is the behaviour you want to expect from @TxGVNN is a really good question! I think maybe I just got caught of guard with the new feature. And I would like to play around more with it. I've used the b button some more, and I do grew more accustomed to it. So another week will probably do good.

I'll also play with the code a bit, as I think what I would like is the possibility to just toggle new buffer when I deliberated choose so, for example by pressing C-u before M-x kubel, og maybe before changing context, namespace, or resource.

@Kyrremann
Copy link
Contributor

I got inspired to play around a little bit yesterday, and by just changing (for each cluster, namespace, resource):

(with-current-buffer (clone-buffer)

to

(with-current-buffer (if current-prefix-arg ;; or some-global-variable
                         (clone-buffer)
                       (current-buffer)))

it allows me to create a new kubel buffer with using C-u. Not sure if it's worth adding, instead of me just getting used to the "new" way of interacting with kubel. It does make my buffer-list cleaner.

@abrochard
Copy link
Owner

Hi @Kyrremann ,
Nice! I have a few comments that come to mind:

  1. i would indeed recommend a global variable rather than using the C-u prefix to make behavior a bit clearer
  2. after more thinking, I'm worried that supporting both behaviors would significantly increase the scope and potential bug surface area (like Multi-buffer loses line highlighting? #125) and would make troubleshooting and support much harder in the long run
  3. I have to look at Allow for customization of shell buffer names #121 but i'm wondering if buffer name customization could help with keeping the buffer-list tidy?
  4. maybe there's also an ad-hoc solution with hooks where you could kill the previous kubel buffer rather than touch the package implementation?

What do you think?

@Kyrremann
Copy link
Contributor

Totally forgot to follow up here. I agree with 2. that it will inflate the problem are for kubel, so it' probably not worth adding this feature. It's easier for me to just add it my self if I can't get used to the new way. For now it's not really a problem, just different.
Buffer name customization may be a solution, I'm wondering if it's all the asterisk, cause I've never thought about it being a problem for Magit, but most/all buffers from Magit disappear when closed with q.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants