On Sat, 30 Jan 2021, Henning Hraban Ramm wrote:
If I use \starttikz[name=example], I get "JOBNAME-temp-tikzThick-example.tmp". I’d like to get something like "COMPONENTNAME-##-example.tmp" or a path like "COMPONENTNAME/example_##.tmp". Is there a configuration hook in the module to change name generation?
No. I don't quite understand the concern. How do you plan to use a `name=value` option?
The current auto-generated file names are uncomfortably long, and I’d like to know which contains what.
The idea was to avoid clash of names. That is why the file name starts with \jobname. I also want to avoid clash if you use multiple filters in the same file (a common use case for my projects), hence there is filtername. The -temp- is there because at some point context used to delete \jobname-temp-.tmp files if you passed the --purge option, but I see that it is no longer the case. Maybe that can be removed from the default name. The last part are the numbers, which are needed when caching results.
I’m not yet sure what would make the most sense for this project (at least sorting by chapter/component would), but I have an use case with LilyPond where I could save several LilyPond compile runs if I could influence the naming:
I got ~500 songs in their own component files, and I use them in different songbooklets with the same layout. E.g. there’s one containing all the songs and several with a subject (e.g. winter & christmas, children, medieval & fantasy, some author...). They all use [name=\currentcomponent]. If I could avoid the JOBNAME part of the file name, all booklets would use the same note PDFs. Now, the temp directory contains literally thousands of files. Since this is just for fun, the additional space and compile time is just a bit annoying and doesn’t affect others, but I like to streamline my workflows...
This is a relatively simple feature to add. I have pushed a new branch with this feature: https://github.com/adityam/filter/tree/prefix I have added a new `prefix` option: you can use \defineexternalfilter[....][prefix=whatever] and then the filter module will write the temp name as `whateverfilter0.ext` `whateverfilter1.ext`. The default value of prefix is \jobname-temp- (note trailing dash), so there should be no difference in the default output, but now you can configure the prefix if you want. I am also open to making filter name as part of the prefix, so that you can have the ability to remove it if you wish. But I am hesitant to do so because it can lead to hard to debug errors if there is a clash in the prefix of two different filters. I haven't tested it beyond simple tests to make sure that nothing breaks. You can copy t-filter.mkiv from https://raw.githubusercontent.com/adityam/filter/prefix/t-filter.mkiv to your working directory and test if works for your situation. Aditya