maxima

How to add directories/subdirectories (by wildcard) to be searched by Maxima's "load" function


I know how to add some directories to the default value of file_search_maxima; for example as mentioned in the documentation, the below setting appends two additional directories to the default value of file_search_maxima:

file_search_maxima: append (file_search_maxima,["/usr/local/foo/###.mac", "/usr/local/bar/###.mac"])$

Is it achievable to append all subdirectories of a given directories to the value of file_search_maxima?

e.g., something like below, which appends all subdirectories by "wildcard" (unfortunately it does not work):

file_search_maxima: append (file_search_maxima,["/usr/local/###/###.mac"])$

Is this achievable at all?

Motivation: a specific directory is soon getting crowded after putting Maxima files in it. Hence, it would be a good idea to put the Maxima files in subdirectories/subfolders. But, in order to be able to load the files, it will be necessary to add the subdirectories one by one. It would be great if "load" function could search within all subdirectories of a given "safe" directory.


Solution

  • I think this is possible, but you'll have to do some work to get what you want. First use directory("/usr/local/**/"). This will produce a list of all the subdirectories of "/usr/local/". For each element in the list, append "###.mac". Finally, prepend this to file_search_maxima.

    However, in git HEAD, it will be easier. The pattern to use is different. You'll just need to add "/usr/local/**/*.mac". Then maxima will automatically search all the subdirectories of "/usr/local/" to find a mac file.