Hackable Recent Files

Post Reply
Random Void User
Posts: 52
Joined: 13.07.2024 21:19

Hackable Recent Files

Post 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!
main Alexey
Posts: 2378
Joined: 25.08.2021 18:15

Re: Hackable Recent Files

Post 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.
Random Void User
Posts: 52
Joined: 13.07.2024 21:19

Re: Hackable Recent Files

Post 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 ).
main Alexey
Posts: 2378
Joined: 25.08.2021 18:15

Re: Hackable Recent Files

Post 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.
Random Void User
Posts: 52
Joined: 13.07.2024 21:19

Re: Hackable Recent Files

Post 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!
main Alexey
Posts: 2378
Joined: 25.08.2021 18:15

Re: Hackable Recent Files

Post 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).
Post Reply