stuart macgregor wrote: >> Actually, it shouldn't be too hard. How would you identify the >> 'scrap' you want to export? Would you mark (highlight) a block of >> text or would you 'deduce' the block from the position of the >> cursor? > > Deduce I think - a matter of taste I suppose.
So, let's think of the syntax that the lfun would have. I'd suggest: "export-paragraph scrap" where "scrap" is an identifier of the environment. The idea being that the paragraph containing the cursor will be 'export'ed if it is of the desired type. I think that everything exists already to 'import' your edited scrap. There is a file in development/lyxserver, server_monitor.c, that makes interaction with LyX through the in/out pipes easy. I compiled it with: gcc -o server_monitor server_monitor.c -lforms -L/usr/X11R6/lib -lXpm -lX11 -lm Start lyx and server_monitor. Tell it where to find the pipes. Here I have: Pipe name: /home/angus/.lyx-1.3.x/server Pressing "Open pipes" should result in the message "LYXSRV:monitor:hello" being posted in the "Notify" window. Navigate from paragraph to paragraph by entering "paragraph-down" or "paragraph-up" in the "Command" input widget and pressing the "Submit Command" button. Remove a particular paragraph with judicious use of: "paragraph-down-select", "paragraph-up-select", "cut", paste" Finally, insert the replacement text with "file-insert-ascii-para" in the Command widget and "/full/path/to/file" in the Argument widget. You may need to reset the layout: Command: "layout" Argument: "itemize" Presumably in your case, that'd be "scrap". Conclusion: we can already import a file exactly as you'd like it. Perhaps you'll test this functionality out yourself and check whether it's up to scratch? -- Angus
