Bo Peng wrote:

 Look, I want to make bibfilesCache_ a map. I have very good reasons to
 want to do this. I therefore want InsetBibtex::getBibFilesCache() to
 return such a map. (I suppose it could return something else, and then I
 could do some conversion, but why?) Back in InsetBibtex, I can produce
 the map from an EmbeddedFileList, but the much easier thing to do is to
 have InsetBibtex::bibfiles_ itself be such a map, and I'll just return a
 const reference to it---just like we do now. If your implementation of
 the embedding feature prohibits me from doing this, then that, it seems
 to me, is a big problem. Do you think it does? If not, is it OK with you
 if I make this change?

What is the key to this map? If it is biblio, not /path/to/biblio.bib,
then you can make bibfiles_ a map, and the meta_ patch is no longer
needed.
Yes. This is what I've been trying to say, more or less. But note that, when we output latex, we iterate not over bibfiles_ but over params, and we (quickly) look up the embedded file info in the map. We do it this way because we should keep the order. This requires that bibfiles_ and the params be in sync, but they have to be kept in sync anyway. We resolved that issue a long time ago.

A complication here is that registerEmbeddedFile has to ask
params for the order of the files.... this is in the end not so good.

Why do they need to be saved in the same order as the parameters? If the concern is that the order should stay the same from save to save, then this is a non-issue: It will, because the order of the map will not change unless the keys do. This will be so even across systems and platforms.
 And second: If the order of the embedded files in the LyX file matters,
 then you'd better check the code, because it simply does not guarantee
 that the order will not change after minor edits. It is also false that
 it might change after an open/save sequence, unless you've moved
 systems. But in that case, it may change anyway.

The current code will not change the order of embedded files, unless
you use a map to return bib files without order from InsetBibtex.

Yes, it will. Not just from open/save---I didn't say that---but it will change the order, say, if you change the order of the files in the bibliography inset, or if you move one graphic in front of another. This is because of how the files are registered. If it matters that the order stay the same, then you need to sort the list in EmbeddedFileList::writeFile(), or probably better in update(). But if you do that, then it doesn't matter what the reported order is, and it doesn't matter if we use a map.

rh

Reply via email to