Reply To: setting MEW variables from a source file

Product Compare Forums Multi-Edit Support setting MEW variables from a source file Reply To: setting MEW variables from a source file

#5308
Michal Vodicka
Participant

OK, now I understand better :)

Problem with meta-data is where to store it and how to keep the link with given file. If you move files from one directory to other, I guess the best way is to store data to source file itselt; this is the least fragile approach. I’d probably use something like VCS keywords for easier parse ($FuncName: $). Clay’s idea to get these data using post-load macros isn’t bad; you could parse file header and store variables to window/buffer properties or variables tied to window via name.

If you don’t plan to move files, you can use MEW capabilities to save variables. The advantage is you don’t need to bother with parse and files would remain clean. I already mentioned FileToGlobalVarName function which I wrote for similar reasons — have something persistently tied to a file name. It is available in 9.1 but principle is simple: it makes a hash from pathname and adds it to variable(s) prefix. Variables are saved/restored automatically with sessions.

Next, you can save variables to project file which is basically a database of file names and variables. I guess it should be possible to give file name a new attribute or two. It is surely possible to add new variables into database but I don’t remember when it was added (sorry, 8.0 is way too old). The disadvantage is metadata would be tied with project and what if a file is part of more projects? Also, it wouldn’t work if project isn’t current one.