Re: #6720: Better error handling of instant preview

2011-01-21 Thread Enrico Forestieri
On Fri, Jan 21, 2011 at 04:58:31PM -0500, Julien Rioux wrote: > On 20/01/2011 7:21 PM, Enrico Forestieri wrote: > >I don't have lilypond-book, so I need confirmation that the attached > >patch works for you. > > The patch applies and works fine. Thanks. Committed. -- Enrico

Re: #6720: Better error handling of instant preview

2011-01-21 Thread Julien Rioux
On 21/01/2011 12:40 PM, veno...@arcadiaclub.com wrote: As far as I understand it preview-latex is useful because 1) Some macros defined outside the preview environment might still be needed by TeX to process the code inside the environment. Howver this is not always obvious to LyX (especially sin

Re: #6720: Better error handling of instant preview

2011-01-21 Thread Julien Rioux
On 20/01/2011 7:21 PM, Enrico Forestieri wrote: I don't have lilypond-book, so I need confirmation that the attached patch works for you. The patch applies and works fine. Thanks. -- Julien

Re: #6720: Better error handling of instant preview

2011-01-21 Thread Julien Rioux
Ah! Nevermind the last message! -- Julien

Re: #6720: Better error handling of instant preview

2011-01-21 Thread Julien Rioux
On 20/01/2011 7:21 PM, Enrico Forestieri wrote: I don't have lilypond-book, so I need confirmation that the attached patch works for you. Hmm, sounds like a silly question but... How do I apply a patch created with svn diff? -- Julien

Re: #6720: Better error handling of instant preview

2011-01-21 Thread Enrico Forestieri
On Fri, Jan 21, 2011 at 06:40:03PM +0100, veno...@arcadiaclub.com wrote: > Enrico: I'm also trying to understand if there's a way to make GhostScript > ignore errors so we don't have to make a lot of files with "dvips -i" and a GS > call for each one. > On the #ghostscript IRC channel on freenode

Re: #6720: Better error handling of instant preview

2011-01-21 Thread Enrico Forestieri
On Fri, Jan 21, 2011 at 12:36:21AM +0100, Enrico Forestieri wrote: > There is a number of preview snippets failing in the math manual, but > it seems that hyperref is the culprit here. For example, see: > https://bugs.launchpad.net/ubuntu/+source/auctex/+bug/524961 > https://bugs.launchpad.net/ubu

RE: #6720: Better error handling of instant preview

2011-01-21 Thread venom00
> As far as I understand it preview-latex is useful because 1) > Some macros > defined outside the preview environment might still be needed > by TeX to > process the code inside the environment. Howver this is not always > obvious to LyX (especially since we don't even attempt to > parse any

Re: #6720: Better error handling of instant preview

2011-01-21 Thread Julien Rioux
On 20/01/2011 7:21 PM, Enrico Forestieri wrote: I don't have lilypond-book, so I need confirmation that the attached patch works for you. Thanks, I'll try this later today. -- Julien

Re: #6720: Better error handling of instant preview

2011-01-21 Thread Julien Rioux
On 20/01/2011 7:14 PM, veno...@arcadiaclub.com wrote: Maybe it's a dumb question but... What's the use of preview-latex? Couldn't we simply create a page for each snippet and then make the usual calls to the converters? Maybe this would simplify the process and remove all the incompatibilities. B

Re: #6720: Better error handling of instant preview

2011-01-20 Thread Enrico Forestieri
On Fri, Jan 21, 2011 at 01:14:58AM +0100, veno...@arcadiaclub.com wrote: > I saw you removed the .dtl file generation, I changed that from the first > patch > thinking that a DTL of 500 shouldn't stay in memory, however it's 133 kB for > Math.lyx, it shouldn't be a serious problem. We are concer

Re: #6720: Better error handling of instant preview

2011-01-20 Thread Pavel Sanda
Enrico Forestieri wrote: > It works for me. confirming that current version works fine here with math manual. pavel

Re: #6720: Better error handling of instant preview

2011-01-20 Thread Enrico Forestieri
On Thu, Jan 20, 2011 at 07:10:44PM -0500, Julien Rioux wrote: > On 20/01/2011 6:36 PM, Enrico Forestieri wrote: > >Your patch is an improvement over the current situation, so I am going > >to commit a revised version. > > Could you please also apply the changes that were made in > > lyxpreview2b

RE: #6720: Better error handling of instant preview

2011-01-20 Thread venom00
> It works for me. Great! > > > > I've not yet investigated the XeTeX version of > instant-preview, and > > > > how it works. I'll do it. > > > > Not managed in this patch. How many people use XeTeX? > > Well, it seems that instant-preview is semi-broken when using XeTeX. > The preview snippe

Re: #6720: Better error handling of instant preview

2011-01-20 Thread Julien Rioux
On 20/01/2011 6:36 PM, Enrico Forestieri wrote: Your patch is an improvement over the current situation, so I am going to commit a revised version. Could you please also apply the changes that were made in lyxpreview2bitmap.py to lyxpreview-lytex2bitmap.py -- Julien

Re: #6720: Better error handling of instant preview

2011-01-20 Thread Enrico Forestieri
On Tue, Jan 18, 2011 at 08:31:31PM +0100, veno...@arcadiaclub.com wrote: > Here's the new patch: dvipng encountering PostScript specials was VERY slow > (it > seems to call GhostScripting internally but failing miserably), so I looked > for > another solution. Dvipng has "-pp" parameter which al

RE: #6720: Better error handling of instant preview

2011-01-18 Thread venom00
Sorry, this is the updated patch. venom00 ip_error_handling3.diff Description: Binary data

RE: #6720: Better error handling of instant preview

2011-01-18 Thread venom00
> You are right. In the past, we had the dtl sources in our tree and > this problem had been already identified! Indeed, Angus patched > dt2dv.c just to solve this exact issue. I am attaching the diff > between the current dt2dv.c in CTAN and the patched one. > Most probably, for your tests you use

Re: #6720: Better error handling of instant preview

2011-01-17 Thread Enrico Forestieri
On Mon, Jan 17, 2011 at 07:34:17PM +0100, veno...@arcadiaclub.com wrote: > > The point is that it currently does not work well. Loading > > examples/instant_preview.lyx I get: > > {{{ > > Program "dt2dv" version 0.6.0 compiled in standard C. > > dt2dv (read_variety) : DTL variety sequences-6

RE: #6720: Better error handling of instant preview

2011-01-17 Thread venom00
> The point is that it currently does not work well. Loading > examples/instant_preview.lyx I get: > {{{ > Program "dt2dv" version 0.6.0 compiled in standard C. > dt2dv (read_variety) : DTL variety sequences-6 is OK. > dt2dv (ls_putb) : ERROR : No more room in Lstring. > dt2dv (dinfo) : Curr

RE: #6720: Better error handling of instant preview

2011-01-14 Thread venom00
Well, I managed to make a patch which seems to work, but, as usual, I need you to test it. This is my solution: when we open a document all the snippets are put together in a unique LaTeX file. Then we parse the DVI (the DTL created with dv2dt actually) looking for pages containing literal PostScr

Re: #6720: Better error handling of instant preview

2011-01-14 Thread Pavel Sanda
Enrico Forestieri wrote: > I am afraid, something more clever is needed. what if we switch to the way how instant preview works with images - simply wait for the moment when it appears on the screen? pavel

RE: #6720: Better error handling of instant preview

2011-01-12 Thread venom00
> In order to avoid wasting time, I suggest to check whether > the approach > can lead somewhere. For example, by using the quite simple attached > patch, whenever the legacy route is taken I get all previews except > the failing ones. However, the problem is that ghostscript is still > called for

Re: #6720: Better error handling of instant preview

2011-01-12 Thread Julien Rioux
On 12/01/2011 6:56 AM, veno...@arcadiaclub.com wrote: Enrico, Pavel: Can we put a together a a list of all the typical things we use with instant- preview? - math - TikZ - PSTricks - please add lilypond psfrag sweave ...

RE: #6720: Better error handling of instant preview

2011-01-12 Thread venom00
> In order to avoid wasting time, I suggest to check whether > the approach > can lead somewhere. For example, by using the quite simple attached > patch, whenever the legacy route is taken I get all previews except > the failing ones. However, the problem is that ghostscript is still > called for

Re: #6720: Better error handling of instant preview

2011-01-12 Thread Enrico Forestieri
On Wed, Jan 12, 2011 at 01:01:43PM +0100, veno...@arcadiaclub.com wrote: > > Tomorrow I'll try to write down this "splitter". In order to avoid wasting time, I suggest to check whether the approach can lead somewhere. For example, by using the quite simple attached patch, whenever the legacy rout

Re: #6720: Better error handling of instant preview

2011-01-12 Thread Pavel Sanda
veno...@arcadiaclub.com wrote: > > > I've tested it under linux and seems a good solution, [...] > > Unfortunately, there might be something wrong with dviselect, at > > least with this particular version: every page extracted by this tool > > except page 1 couldn't render by Yap, while it had

RE: #6720: Better error handling of instant preview

2011-01-12 Thread venom00
I've investigated the problem, at least with PSTricks the problem is that the PostScript initialization code of the package is included in the first page, and dviselect doesn't repeat it on all pages. This is the PSTricks initialization in DT format (from dv2dt): special1 19 'header=pstricks.pro'

RE: #6720: Better error handling of instant preview

2011-01-12 Thread venom00
> > I've tested it under linux and seems a good solution, [...] > Unfortunately, there might be something wrong with dviselect, at > least with this particular version: every page extracted by this tool > except page 1 couldn't render by Yap, while it had no problem with the > source dvi. This

RE: #6720: Better error handling of instant preview

2011-01-11 Thread venom00
> > 1) latex mega-tex-with-all-snippets.tex > > 2) with dviselect create a .dvi for each page > > 3) check each .dvi if it needs legacy method (PSTricks or pgf/TikZ) > > 4a) call dvipng on each .dvi not using ps > > 4b) call the legacy method for the others (which needs another latex > > call be

Re: #6720: Better error handling of instant preview

2011-01-11 Thread Michal
On Tue, 11 Jan 2011 11:04:21 +0100 Michal wrote: > Another thing: I don't want to be pessimistic about it, but what > if step 1) fails (for example, because of a single 'failing' inset - > or multiple ones)? Just an idea: maybe in the case mentioned, by parsing latex stdout/stderr it will

Re: #6720: Better error handling of instant preview

2011-01-11 Thread Michal
> 1) latex mega-tex-with-all-snippets.tex > 2) with dviselect create a .dvi for each page > 3) check each .dvi if it needs legacy method (PSTricks or pgf/TikZ) > 4a) call dvipng on each .dvi not using ps > 4b) call the legacy method for the others (which needs another latex > call because we nee

RE: #6720: Better error handling of instant preview

2011-01-11 Thread venom00
> I would try a different approach. Currently, all previews are > generated > from a single dvi file. However, each preview snippet is > contained in a > separate page, so I would use dviselect to extract all pages > and process > them one by one in the python scripts. In this way, latex is > c

Re: #6720: Better error handling of instant preview

2011-01-10 Thread Michal
On Mon, 10 Jan 2011 21:19:35 +0100 Pavel Sanda wrote: > Michal wrote: > > Unfortunately, in this case the stupid code would also be very > > slow, > why does it hurt when we do it in background invisible to users? Well, it is invisible only when you have multicore cpu and fast hdd, and

Re: #6720: Better error handling of instant preview

2011-01-10 Thread Enrico Forestieri
On Tue, Jan 11, 2011 at 12:04:07AM +0100, Pavel Sanda wrote: > Enrico Forestieri wrote: > > I would try a different approach. Currently, all previews are generated > > from a single dvi file. However, each preview snippet is contained in a > > separate page, so I would use dviselect to extract all

Re: #6720: Better error handling of instant preview

2011-01-10 Thread Pavel Sanda
Enrico Forestieri wrote: > I would try a different approach. Currently, all previews are generated > from a single dvi file. However, each preview snippet is contained in a > separate page, so I would use dviselect to extract all pages and process > them one by one in the python scripts. In this wa

Re: #6720: Better error handling of instant preview

2011-01-10 Thread Enrico Forestieri
On Mon, Jan 10, 2011 at 09:11:25PM +0100, Pavel Sanda wrote: > veno...@arcadiaclub.com wrote: > > I've attached a patch which waits for the a snippets to be rendered to start > > with the next one, this doesn't lock the UI with the math guide and allows > > to > > choose for each snippet which met

Re: #6720: Better error handling of instant preview

2011-01-10 Thread Pavel Sanda
Michal wrote: > Unfortunately, in this case the stupid code would also be very slow, why does it hurt when we do it in background invisible to users? > The bisection isn't *that* smart anyway :). Just look at the it has log(n) only because you stop after first problem and do not let othe

Re: #6720: Better error handling of instant preview

2011-01-10 Thread Pavel Sanda
veno...@arcadiaclub.com wrote: > I've attached a patch which waits for the a snippets to be rendered to start > with the next one, this doesn't lock the UI with the math guide and allows to > choose for each snippet which method to use (dvipng or legacy). > What do you think? Is it a stupid enough

RE: #6720: Better error handling of instant preview

2011-01-10 Thread venom00
> by the way all threads seems to eat only one my cpu core. > cant we ask QTs to use whole cpu power? The code doesn't use any additional thread, just the main one. It waits for a signal (a boost feature). I've attached a patch which waits for the a snippets to be rendered to start with the next o

Re: #6720: Better error handling of instant preview

2011-01-09 Thread Michal
> [...] > Enumerating IPs one-by-one means using the IP generation script > n times, instead of using it only log(n) times, per each opened > document. [...] Sorry, I meant 'per each opened document with problems'. For a document without ones, the amount of calls equals 1, of course. Regar

Re: #6720: Better error handling of instant preview

2011-01-09 Thread Michal
On Mon, 10 Jan 2011 00:00:55 +0100 wrote: > > For this, the simple recursive bisection would work. > > I was thinking that too. But we still have the problem of choosing > between dvipng (quicker) or legacy (needed by PSTricks and TikZ) mode. As I'd like to think it through and give some

Re: #6720: Better error handling of instant preview

2011-01-09 Thread Michal
On Mon, 10 Jan 2011 00:09:12 +0100 Pavel Sanda wrote: > [...] > again i would like to keep this code simple and stupid if possible. Well, in general I completely agree with this. In terms of stability and maintainability, it is important to not to overcomplicate the code. Unfortunately, i

Re: #6720: Better error handling of instant preview

2011-01-09 Thread Pavel Sanda
veno...@arcadiaclub.com wrote: > Pavel: why the user inteface become unresponsive while opening a document and > creating all the IPs? Shouldn't this be an async operation? i was wondering about the same and my intuition was that there are too many threads fighting for resources (i didnt check th

Re: #6720: Better error handling of instant preview

2011-01-09 Thread Pavel Sanda
veno...@arcadiaclub.com wrote: > Then what was your idea? Isolate the failing one? dont think this is a good idea, because of the involved code complexity. i would try something like: 1. keep the old method by default (i.e. all preview in a single latex file) 2. if it fails then keep it simple and

RE: #6720: Better error handling of instant preview

2011-01-09 Thread venom00
> For this, the simple recursive bisection would work. I was thinking that too. But we still have the problem of choosing between dvipng (quicker) or legacy (needed by PSTricks and TikZ) mode. > As a bonus feature, something similar to 'visual instant warnings' > from some compilers (as i

Re: #6720: Better error handling of instant preview

2011-01-09 Thread Michal
On Sun, 9 Jan 2011 18:07:51 +0100 wrote: > [...] > Then what was your idea? Isolate the failing one? Well, I don't know about Pavel Sanda's idea, but I've done some thinking about it for some time. The conclusion is that isolating all the failing insets would always be very ineffective perform

RE: #6720: Better error handling of instant preview

2011-01-09 Thread venom00
> do i understand correctly that you force separate translation > by default? > (any document with high number of math insets will be opened > for long long time.) > i just tried opening math manual, and killed the whole > session after 30s of waiting... You're right, I didn't think it would ha

Re: #6720: Better error handling of instant preview

2011-01-09 Thread Pavel Sanda
veno...@arcadiaclub.com wrote: > Well, here's the patch to make IP load separately. As far as I tested it > works fine. do i understand correctly that you force separate translation by default? (any document with high number of math insets will be opened for long long time.) i just tried opening

RE: #6720: Better error handling of instant preview

2011-01-09 Thread venom00
Well, here's the patch to make IP load separately. As far as I tested it works fine. One may disagree with the choice of creating a one-element list to pass to the old version of the function, but I did this to make non-invasive edit without a more experienced LyX coder revision. The fact is tha