Page 1 of 1

Hackable Recent Files

Posted: 24.02.2025 21:23
by Random Void User
I use the "File / Open recent" menu far more than "sessions" or "projects." Maybe I'm confused how CudaText works, but I ask anyway.

The only tweak for recent files is to clear the list. I want to change it. I want different groups swapping in and out. Only one group is active at a time. I don't want files in the active group opened, just listed. The purpose of a recent files group is to offer a list of files for opening, just as "Open recent" does. A group does not need lexers, bookmarks, cursors, or other metadata. I just want a hackable recent files list.

Now I may need a 'jq' or 'jaq' script to swap out the json stanza in history.json. If I can achieve the trick with any existing CudaText method (projects, sessions, custom menus, whatever), please let me know.

Thanks!

Re: Hackable Recent Files

Posted: 24.02.2025 21:34
by main Alexey
maybe it will be OK to give the python API to read/write names of recent filenames? then you can make a plugin.

Re: Hackable Recent Files

Posted: 25.02.2025 01:22
by Random Void User
Maybe. It might also work to add boolean options to each separate project or session controlling what files automatically open when it's active ( 0 = none, 1 = all ).

Re: Hackable Recent Files

Posted: 28.02.2025 16:17
by main Alexey
Boolean options? add them where, to session? but it's redundant. when user opens a session, session's last opened filenames are opened in Cud. no need for option.

I added the API:

1.0.463 (1.221.6)
* add: app_proc: PROC_SET_FILE_RECENTS

PROC_SET_FILE_RECENTS: Fills "recent filenames" list. Param "text" must be string, "\n"-separated filenames. First filename will be in the bottom of recents, last one will be in the top.

sorry that "text" is not usual list, it was hard to handle usual list.

Re: Hackable Recent Files

Posted: 28.02.2025 19:08
by Random Void User
main Alexey wrote: 28.02.2025 16:17 Boolean options? add them where, to session? but it's redundant. when user opens a session, session's last opened filenames are opened in Cud. no need for option.
The boolean defines if the session or project opens its files automatically. Consider the 'Open recent' item on the 'File' menu. 'Open recent' just shows a list, it does not open the whole list at once. A session or project does open all its files at once.

I will experiment with the new API. Thanks!

Re: Hackable Recent Files

Posted: 01.03.2025 06:02
by main Alexey
Session opens all its files. yes. it is ok. project does not. it opens only files opened in its 'project session' (if it exists in project).