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

Remove deleted files from 'Recents' list #174

Closed
karlwessel opened this issue Jun 10, 2020 · 16 comments
Closed

Remove deleted files from 'Recents' list #174

karlwessel opened this issue Jun 10, 2020 · 16 comments
Labels
enhancement New feature or request frontend Concerning the HTML editor

Comments

@karlwessel
Copy link
Contributor

To keep the list of recent notebooks clean it would be nice if Pluto could purge the list of recent notebooks from notebooks that are in the temporary folder and don't exist anymore.

@fonsp fonsp added enhancement New feature or request frontend Concerning the HTML editor HTTP/WS The connection between backend and frontend labels Jun 11, 2020
@fonsp fonsp changed the title Regularly clean temporary notebooks from recent list Remove non-existing files from 'Recents' list Jun 11, 2020
@fonsp fonsp changed the title Remove non-existing files from 'Recents' list Remove deleted files from 'Recents' list Jun 11, 2020
@fonsp
Copy link
Owner

fonsp commented Jul 7, 2020

The motivating issue is that your recents list gets cluttered up by tmp notebooks right?

(some loose thoughts:)

I was thinking: Pluto doesn't actually need a file on disk to work - the state is kept in memory. So temporary notebooks and new notebooks could start out with no file, and invite the user to save it somewhere. This also solves #97 and some feedback that we got that it is unclear how to save a notebook. They are right: when you open a sample notebook, you are first greeted with the Pluto logo, and then some OS magic spell words that don't mean anything to most people, even if you are familiar with paths and file systems. What the technowords don't communicate is: "I am the current filename and you can change me". Part of this is that software usually does not save somewhere until you explicitly do so. Although a common trend is to always save as "Untitled" (google drive) or "FunkyApricotDolphin".

One reason I can come up with to always save notebooks is for backups in case Pluto breaks. But that doesnt seem to happen anymore, especially not with quick-and-dirty notebooks that you would not care enough for to save them yourself. The other one is for user error: if you close the Pluto server you might not realise that you had an unsaved notebook open. With the current /tmp solution, you could always open that folder and sort by most recently modified (if you are techy enough).

What do you think @karlwessel ?

@karlwessel
Copy link
Contributor Author

I really like that notebooks are stored on file and not in memory, exactly because of the reasons you described. Also, the /tmp folder is ideal for storing "untitled" notebooks, since it assures that no important directory gets cluttered with sample and test notebooks. If I just want to test something in a notebook I know /tmp will clean up after me and if the tests are worthy I can still decide to give them some proper location.

This issue is only about the fact that while tmp automatically cleans up my mess of notebooks, Pluto does not (yet).

Regarding the "users are greated with some OS-Magic" issue. Can't Pluto just display only the notebook name without extension and path? And if you click on it it is expanded to the full path for the techy people and for the non techy people there is the "rename" button which could be renamed to "save as" (a bit like for jupyter-notebooks).

And I really like the "FunkyApricotDolphin" approach to naming new/temporary notebooks. That way there is a nice name to display even if the notebook hasn't been saved yet and it is easier to find/remember than "YhZGQnwe.jl" in the temporary folder.

@fonsp
Copy link
Owner

fonsp commented Jul 7, 2020

One thing we could do is keep the functionality the same, but instead of the initial /tmp path, we show "Save notebook...", and when you click on it, it defaults to:
[home dir]/funky-apricot-dolphin.jl with funky-apricot-dolphin.jl preselected.

The only thing we miss is that users don't know where to look for backups, but maybe we can print things to the terminal like:

[ Info: opened a new notebook in /tmp/jl_jkadfskjh.jl

and

[ Info: renamed /tmp/jl_jkadfskjh.jl to /home/fonsi/apricot.jl

to teach users that Pluto keeps backups there.

What do you think?

Displaying a shorter path is #169, let's talk more there

@karlwessel
Copy link
Contributor Author

karlwessel commented Jul 8, 2020

That sounds good!

Does anything speak against already naming the temporary file with some random word combination like cinnamon-zebra.jl instead of jl_jkadfskjh.jl? Even if you know exactly for which file to look, jl_jkadfskjh.jl is hard to find between jl_cnaysdyfn.jl and jl_alrunasdf.jl :)

@fonsp
Copy link
Owner

fonsp commented Jul 8, 2020

Yes that makes sense! Perhaps you can write this in a PR?

You just replace tempname() with our own cutename() here. Have a look at the source for tempname() to see how they do cross-OS support, i think that it's joinpath(tempdir(), "dolpin.jl").

I wrote a list of cute words for another project, if you need inspiration :) Maybe nice to split it into adjectives and nouns?

@karlwessel
Copy link
Contributor Author

Can do that, together with the other PRs I promised, when the semester ends.

@fonsp
Copy link
Owner

fonsp commented Jul 8, 2020

okay :)

@fonsp
Copy link
Owner

fonsp commented Jul 11, 2020

#97

@fonsp
Copy link
Owner

fonsp commented Jul 11, 2020

@lukavdplas suggested to use the creation date as filename for temporary files - that way they still make some sense when you see them in your recents. funky-dolphin.jl is memorable, but showing Save notebook... instead of /tmp/funky-doliphin.jl means that you will never see that filename.

@fonsp
Copy link
Owner

fonsp commented Jul 11, 2020

I went with the cute names after all.

When the notebook lives inside the temp dir:
image

When you click on "Save notebook..." you get a suggested filename, and "Rename" is "Save" instead:
image

@karlwessel
Copy link
Contributor Author

karlwessel commented Aug 5, 2020

I like the new default note book names!

Since Pluto now purges temporary notebooks automatically we can close this issue right?

Although one last thing: how do I purge notebooks that don't exist anymore (all my old temporary ones) from the recent notebooks list? Let me think this through :)

@fonsp
Copy link
Owner

fonsp commented Aug 5, 2020

Sure! But your point was valid - notebooks stick around forever in the recents list, there is no way to delete them automatically/manually.

@karlwessel
Copy link
Contributor Author

Yep. I also had a quick glance to see whether I could fix this by only showing notebooks that exist or aren't located in the /tmp directory. But it seem Preact has no access to the filesystem and and therefore this would have to be fixed on backend and front end side.

@fonsp
Copy link
Owner

fonsp commented Aug 5, 2020

Yep! And they might not be the same computer

@fonsp
Copy link
Owner

fonsp commented Oct 10, 2020

Notebooks are no longer stored in temporary storage :)

As for removing deleted files, hmmmm i'm not sure. Not a priority

@fonsp fonsp added one day Closed because we won't work on it soon, will be opened again later. and removed HTTP/WS The connection between backend and frontend labels Oct 10, 2020
@fonsp fonsp closed this as completed Oct 10, 2020
@fonsp
Copy link
Owner

fonsp commented Nov 15, 2022

Continued in #877

@fonsp fonsp removed the one day Closed because we won't work on it soon, will be opened again later. label Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request frontend Concerning the HTML editor
Projects
None yet
Development

No branches or pull requests

2 participants