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

Global history polishing #1117

Closed
5 of 7 tasks
Ambrevar opened this issue Feb 2, 2021 · 27 comments
Closed
5 of 7 tasks

Global history polishing #1117

Ambrevar opened this issue Feb 2, 2021 · 27 comments
Labels
high history Related to history handling.

Comments

@Ambrevar
Copy link
Member

Ambrevar commented Feb 2, 2021

Once #1110 is merged, we will have the following points to address:

  1. Replace some uses of open-urls with make-buffer. Then we can remove the parent-buffer argument from open-urls.
  2. Prompt the user for the history file to restore on startup.
  3. Delete session.lisp if there is nothing else to use in there.
  4. Make sure history data access is thread safe (use locks properly with with-data-access macro and friends.)
  5. Restore last current buffer on startup.
  6. Restore history tree of dead buffers.
    This probably requires the storage of (new) nodes in a buffer slot. We could then implement a helper in htree to add all the children given by the nodes passed in argument.
  • Can we inherit history-entry from entry?
    Without it, imported file is 6.4M.
    3.3M with deduplication fix.

    2.3M with obj deduplication fix.

@Ambrevar Ambrevar added the 2-series Related to releases whose major version is 2. label Feb 2, 2021
@Ambrevar
Copy link
Member Author

Ambrevar commented Feb 2, 2021

@aartaka Interested by some of the above tasks?

@aartaka
Copy link
Contributor

aartaka commented Feb 2, 2021

1, 2, 4, 5 — definitely! Other ones — can't yet wrap my head around these. Maybe you'll be better at completing 3 and 6 :)

@Ambrevar
Copy link
Member Author

Ambrevar commented Feb 2, 2021

6 I understand. Out of curiosity, what puzzles you about 3?

@jmercouris
Copy link
Member

I would also like to add: replace binding class with struct.

@Ambrevar
Copy link
Member Author

Ambrevar commented Feb 3, 2021 via email

@Ambrevar
Copy link
Member Author

Ambrevar commented Feb 3, 2021 via email

@aartaka
Copy link
Contributor

aartaka commented Feb 3, 2021

6 I understand. Out of curiosity, what puzzles you about 3?

I don't understand who should delete that -- the user of the browser, and is it as easy as I think it is?

@jmercouris
Copy link
Member

John Mercouris [email protected] writes:
I would also like to add: replace binding class with struct.
I tried to do it, but in the end it resulted in little benefits (for quite a few changes). Instead, I've unexported the binding class, which is what we want here I believe: a small structure that's just an implementation detail. At this point I find that the difference between structs and classes in Common Lisp is mostly due to some weird (historical) idiosyncrasies in the standard. define-class fully supersedes structs, and the export options give us the fine control we want. Thoughts?

I can agree with your reasoning! No problem!

@Ambrevar
Copy link
Member Author

Ambrevar commented Feb 3, 2021

I don't understand who should delete that -- the user of the browser, and is it as easy as I think it is?

Once we add the feature to prompt for which history file to restore, the session feature will be fully superseded.
Let's have a final look at the session.lisp file and make sure there is no feature that we would be missing.

@aartaka
Copy link
Contributor

aartaka commented Feb 4, 2021

Oh wait, I confused session.lisp for the data file $XDG_DATA_HOME/nyxt/session.lisp. Removing the source file doesn't sound good to me -- (re)store-session-by-name are useful commands, so they definitely need to stay.

EDIT: this -> the for less confusion.

@aartaka
Copy link
Contributor

aartaka commented Feb 4, 2021

restore-session-by-name is actually what we used (and can use now) to implement 2.

@Ambrevar
Copy link
Member Author

Ambrevar commented Feb 4, 2021 via email

@aartaka
Copy link
Contributor

aartaka commented Feb 4, 2021

Then I'm in!

@Ambrevar
Copy link
Member Author

Ambrevar commented Feb 5, 2021

Thanks! :)

@aartaka
Copy link
Contributor

aartaka commented Feb 20, 2021

3 is done in 70aa8f1. The problem that one encounters is that, when using restore-history-by-name (new name for restore-session-by-name), Nyxt start constantly prompting "Restore session?" until user responds "No".

This stems from us prompting the user about session restoration from inside restore. This is not right, as restore should be a mere data restoration function (that's why initial GHT implementation added the restore-session-p flag to it -- to separate concerns and make data restoration more controllable) and it shouldn't prompt the user. I'm not sure where to put the prompting part, though -- there was a reason to remove it from startup function, wasn't there?

@Ambrevar
Copy link
Member Author

Ambrevar commented Feb 23, 2021 via email

@aartaka
Copy link
Contributor

aartaka commented Feb 23, 2021

Wanna send a pull request?

Yes! Let me look into it, and I'll send a pull request in a week!

@aartaka
Copy link
Contributor

aartaka commented Mar 17, 2021

open-urls is patched in 134f9f5 :)

@aartaka
Copy link
Contributor

aartaka commented Mar 17, 2021

How do we ensure that history access is thread-safe? I want to tick this box (number 4 in the original comment), but I'm not sure it's a measurable task :)

@Ambrevar
Copy link
Member Author

Ambrevar commented Mar 17, 2021 via email

@Ambrevar
Copy link
Member Author

Ambrevar commented Mar 17, 2021 via email

@aartaka
Copy link
Contributor

aartaka commented Mar 17, 2021

I don't remember the issue precisely. with-data-access uses a mutex. Maybe the problem is that there are places where we don't use with-data-access while we should.

I believe all such places are covered, especially with the introduction of with-data-unsafe -- it's now clearer where to lock the data.

Do you remember what the problem is?

Not really :) I guess it was just a not of caution to re-review things once more.

I've read through all the data-access places while implementing nosave-buffer, so it should be alright now.

@Ambrevar
Copy link
Member Author

Ambrevar commented Mar 17, 2021 via email

@Ambrevar
Copy link
Member Author

There are still issues that remain to be fixed with the GHT, but it's good enough for 2.0 I believe. I'll remove the 2.0 tag.

@Ambrevar Ambrevar added high and removed 2-series Related to releases whose major version is 2. labels May 18, 2021
@aartaka
Copy link
Contributor

aartaka commented Feb 19, 2022

nfiles should fix point 4 (thread-safety of the access) for good.

@Ambrevar
Copy link
Member Author

Good catch!

@Ambrevar Ambrevar added the history Related to history handling. label Jun 17, 2022
@aadcg
Copy link
Member

aadcg commented Feb 10, 2025

No longer important, due to #3598.

@aadcg aadcg closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high history Related to history handling.
Development

No branches or pull requests

4 participants