-
-
Notifications
You must be signed in to change notification settings - Fork 427
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
Buffer IDs do not persist #2583
Comments
Does |
No. I want to persist a subset of the buffers: really I want to persist an ordered list of up to 9 buffers. See #1695 for the context: I want to save the "tagged" state of some buffers. I thought I could just save a vector of buffer-ids but those ids point to different buffers after a restart. |
Indeed the buffer IDs have only one guarantee: to be unique. They are random on each start, including when restoring a session. This is by design. Do you want to save a session or a subset of the global history tree? I guess that latter would be more general. We could tweak Does the buffer ID really matter though? Why do you want to keep the buffers ordered? |
I just want to tag a subset of buffers with some numbers in the range 1 through 9 so I can quickly switch to them via keys |
You could write a function that checks for a buffer, and if it doesn't exist, opens a new buffer with said URL. Pseudocode: look for buffer with URL then you could map that to C-1 -> C-9. Unless it matters that it be restored buffers with some state from previous executions. |
Well, state like buffer history would be nice! I am surprised that the (somewhat opaque to me) history mechanism in nyxt does not supply a simple way to persist a reference to a buffer! |
Well, Nyxt history library is designed in such a way that it both does not need to and does not know of buffers. But I'm pretty sure we can still sort and store it in a buffer-aware fashion. Just need to experiment with the code (no promises, I'm buzy with lots of stuff atm xD) EDIT: lits -> lots |
@franburstall I believe the best way to achieve what you want is to introduce buffer names. This way you can uniquely identify buffers, and from there do what you want. Introducing buffer names is a simple as adding a new |
@Ambrevar, tagged buffers are a different, and as appealing of a use-case! See #1695 (also by @franburstall), for example (it's 3.0-labelled, but the way!) |
I know, I know, here I'm just suggesting to introduce a name slot, not a tag slot. For instance, buffer with ID 345 would have name "web-buffer2" by default, and the name could be settable by the user at run-time. The name is guaranteed to be unique, like in Emacs. When restoring the session, the name would be restored, but the ID would be different as is currently the case. Tags are different because they are a list of strings, and each tag can be shared by multiple buffers. |
I am having some difficulty getting my mind around persisting any new slot of the It is entirely likely I have misunderstood many things here but the following implementation-independent question remains: how to persist (that is save and later restore) data that belong to a buffer rather than one of the web-pages recorded by whatever history mechanism? |
@aartaka In the end it seems that your last comment was wrong: #2490 does not fix #2064. Correct? So we still need to store modes. I thought a bit more about this: still unclear we need buffer To fix it all in one go, here is what I suggest:
At this point, #2064 and this issue should be fixed. |
Sounds like a plan! |
And... this obviously does not work, because
Thoughts? |
The problem is that while the buffer ID is constant for a given owner, the modes and the tags may change, and we don't have an htree API point to update them. Trickier than I thought... |
See #2627 for an untested design draft. |
Describe the bug
Once more I do not know if this is a bug or a feature request.
I would like to persist a list of favoured buffers and had thought that I could simply save a list of buffer id's to disk.
However, I discover that the mapping from id's to buffers does not survive a restart. That is, the buffers in a restored session have different ids after a restart..
Should this be the case? I thought ids used to persist.
If not, is there a way to accomplish my goal?
Information
show-system-information
:The text was updated successfully, but these errors were encountered: