On 31/07/2017 14:31, Helge Hafting wrote:


Den 27. juli 2017 19:48, skrev Richard Heck:
On 07/27/2017 11:52 AM, Roberto wrote:
Hi Richard, thanks for bringing in your experience.

If the tar.gz was something you can "mount" like a read-write DMG it
would make sense to say that the archive does what I have in mind. As
far as I know one can open DMG files and edit them and close them,
effectively saving the content. The way it is now with tar.gz for me
it is good only for archival purposes.
In theory, this could probably be done using fusefs on Linux, but that's
not a general solution, and we don't automatically add images, say, to
the archive when you add a picture.
Isn't fusefs overkill?
LyX does its work in a temp folder anyway.

To support working with a single file containing a folder with file.lyx and several figures, just have LyX unpack that archive to the temp folder. Let the user edit the document. Since all the graphichs are unpacked too, they can be edited with their appropriate external editors if needed. When the author saves, LyX recreates the archive file and overwrites the original. (LyX knows this is a all-in-one document, because it was opened as such.) When LyX is closed, the temp directory goes away as usual.

This should give us:
* Backward compatibility.
   - Those preferring figures as separate files see no change.
   - Existing documents works as always

* Those wanting an archive can "save as archive" (not export, but save).
- Then they get an archive containing the document and all included stuff. (graphics, subdocuments, external insets). The original graphics files etc. must be kept - they may be in use for other purposes too. But no longer in use by the now archived document - it has its own copies of everything. - To reverse the process, someone who opened an archive may use "File->convert to separate files". This replaces the archive file with the folder containing separate files.


Seems that this approach would fulfil Roberts wish for user-friendliness, without ruining things for the single-files crowd. LyX could mostly work "as usual", with the archiving code mostly dealing with "open" and "save". And of course, every graphic the user adds to a document while in archive mode.

There is the question of what to do about inclusion of a graphic that exist higher up in the directory tree. I believe the user-friendly way would be to copy such things into the archive folder - possibly in a subfolder. That way, no links outside the archive so no problems when opening the archive on another computer. Might waste space, but nobody is forced to use this.

Helge Hafting


Hi Helge, I think the way you are outlining the functionality is very good! It does indeed help users to have everything they need for that document in a single place, and at the same time allows anybody who wants to keep working with the current style of LyX document to keep working as usual. For sake of having just everything I think is not too bad a compromise to waste some space by copying files that reside at upper level in the directory structure and duplicate them in a subfolder managed by LyX.
Best,
Roberto


Reply via email to