Re: Why does LilyPond delete the PDF first?
Valentin Villenave wrote Wednesday, June 11, 2008 11:39 AM 2008/6/11 Risto Vääräniemi <[EMAIL PROTECTED]>: I guess Windows (and Acrobat) handles files differently than Linux and KPDF. Could you test on Linux what happens, if a pdf is opened with Acrobat (Reader) and you re-compile the file? I have the same behavior with Foxit Reader, Sumatra, and the JPedal viewer. So it's definitely an MS-Windows limitation. This is not a limitation enforced by Windows. For example, if I open a file in ConTEXT I can change it with copy or by checking out a different branch in git, no problem. When I return to ConTEXT it says the open file has been modified and would I like to reload it. Windows permits file sharing, and provides an optional file locking mechanism to allow an application to control access by other applications to a file it has opened. But it seems the several pdf viewers simply choose to lock the file when they open it :( Cheers, Valentin Trevor ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Why does LilyPond delete the PDF first?
Dag Risto Vääräniemi, op woensdag 11 juni 2008, schreef je: > Could you test on Linux what happens, if a pdf is opened with > Acrobat (Reader) and you re-compile the file? On Linux there is no problem with writing to the PDF file while Acrobat Reader is displaying it. best regards! Wilbert Berendsen -- LilyKDE, LilyPond for KDE: http://lilykde.googlecode.com/ ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Why does LilyPond delete the PDF first?
Op woensdag 11 juni 2008, schreef Reinhold Kainhofer: > Am Mittwoch, 11. Juni 2008 schrieb Carl D. Sorensen: > > LilypondTool works properly with JPedal under windows. As long as JPedal > > is not the active window, the pdf can be properly written. If JPedal is > > the active window, then you get a write error on the pdf. > > BTW, kpdf works exactly the other way round: Instead of locking the pdf > file and preventing any changes while the file is viewed, it explicitly > allows changes while a file is open, watches it and reloads the file if a > change is detected. This is what lilypond breaks by explicitly deleting the > file. I think KPDF doesn't even keep the file handle open after all contents have been read and parsed. It just keeps watching the file for changes to its mtime, and reopens the file if it is updated. In http://code.google.com/p/lilypond/issues/detail?id=635 I added a very small patch to scm/backend-library.scm that just deletes the PDF as always when run on windows, but not on other platforms. best regards! Wilbert Berendsen -- LilyKDE, LilyPond for KDE: http://lilykde.googlecode.com/ ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Why does LilyPond delete the PDF first?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am Mittwoch, 11. Juni 2008 schrieb Carl D. Sorensen: > LilypondTool works properly with JPedal under windows. As long as JPedal > is not the active window, the pdf can be properly written. If JPedal is > the active window, then you get a write error on the pdf. BTW, kpdf works exactly the other way round: Instead of locking the pdf file and preventing any changes while the file is viewed, it explicitly allows changes while a file is open, watches it and reloads the file if a change is detected. This is what lilypond breaks by explicitly deleting the file. Cheers, Reinhold - -- - -- Reinhold Kainhofer, Vienna University of Technology, Austria email: [EMAIL PROTECTED], http://reinhold.kainhofer.com/ * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/ * K Desktop Environment, http://www.kde.org, KOrganizer maintainer * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) iD8DBQFIT94wTqjEwhXvPN0RAvESAJ4oIH/oH2kOHkFTiburlW3gFae8HgCgk2r8 JPR8Ch5ZPODAZyAfyg/yX1E= =3TEw -END PGP SIGNATURE- ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Why does LilyPond delete the PDF first?
LilypondTool works properly with JPedal under windows. As long as JPedal is not the active window, the pdf can be properly written. If JPedal is the active window, then you get a write error on the pdf. Yes, because LilyPondTool has control over JPedal, so it closes the PDF when you press the "Compile with lilypond" button. Bert ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
RE: Why does LilyPond delete the PDF first?
> -Original Message- > From: Valentin Villenave [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 11, 2008 4:40 AM > To: Risto Vääräniemi > Cc: Lily-Devel List > Subject: Re: Why does LilyPond delete the PDF first? > > > > I guess Windows (and Acrobat) handles files differently > than Linux and > > KPDF. Could you test on Linux what happens, if a pdf is opened with > > Acrobat (Reader) and you re-compile the file? > > I have the same behavior with Foxit Reader, Sumatra, and the > JPedal viewer. So it's definitely an MS-Windows limitation. > LilypondTool works properly with JPedal under windows. As long as JPedal is not the active window, the pdf can be properly written. If JPedal is the active window, then you get a write error on the pdf. Carl ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Why does LilyPond delete the PDF first?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am Mittwoch, 11. Juni 2008 schrieb Valentin Villenave: > 2008/6/11 Risto Vääräniemi <[EMAIL PROTECTED]>: > > With this modification Ghostscript tries to open the file but cannot > > because it's locked. I got a lot of programming errors saying: Parsed > > object should be dead: static scm_unused_struct*. > > This is the kind of errors you get when you try to recompile a .ly > file without closing the PDF reader. > > This locking thing is really annoying. > > > I guess Windows (and Acrobat) handles files differently than Linux and > > KPDF. Could you test on Linux what happens, if a pdf is opened with > > Acrobat (Reader) and you re-compile the file? > > I have the same behavior with Foxit Reader, Sumatra, and the JPedal > viewer. So it's definitely an MS-Windows limitation. Yes, in Linux you can compile a lilypond file while you have the PDF open in several applications (actually, I usually have several old versions of the same pdf open in kpdf at the same time, because kpdf doesn't detect a changed pdf and reload it. Of course, I mostly forget to close the PDF viewer, but that's no problem in Linux...) Isn't there any platform-independent way to check whether an existing PDf file can be opened for writing? Google turned up a list of file-related scheme commands (), maybe (file-writeable? filename) does what we need... Does this return #f for locked PDFs, too, or does it only look at file permissions? If it returns #f, that would probably the way to properly implement this (i.e. if the file is locked or write-protected, spit out an error message or try to delete the file, otherwise simply overwrite the file). If it only checks file permissions, maybe (file-open filename "a") will trigger an error and can be used to detect a locked file... BTW, I get the same errors if I change the .ps file to read-only... Cheers, Reinhold - -- - -- Reinhold Kainhofer, Vienna University of Technology, Austria email: [EMAIL PROTECTED], http://reinhold.kainhofer.com/ * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/ * K Desktop Environment, http://www.kde.org, KOrganizer maintainer * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) iD8DBQFIT8pYTqjEwhXvPN0RAnNLAJ9GXdqibvgZ2u7gemual7qFh4IHCQCgqCQT FmcbFwSTXQs284gNBn5XWGE= =af0c -END PGP SIGNATURE- ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Why does LilyPond delete the PDF first?
2008/6/11 Risto Vääräniemi <[EMAIL PROTECTED]>: > With this modification Ghostscript tries to open the file but cannot > because it's locked. I got a lot of programming errors saying: Parsed > object should be dead: static scm_unused_struct*. This is the kind of errors you get when you try to recompile a .ly file without closing the PDF reader. This locking thing is really annoying. > I guess Windows (and Acrobat) handles files differently than Linux and > KPDF. Could you test on Linux what happens, if a pdf is opened with > Acrobat (Reader) and you re-compile the file? I have the same behavior with Foxit Reader, Sumatra, and the JPedal viewer. So it's definitely an MS-Windows limitation. Cheers, Valentin ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Why does LilyPond delete the PDF first?
2008/6/11 Wilbert Berendsen : > Hi, in scm/backend-library there is (line 114-115): > >(if (access? pdf-name W_OK) >(delete-file pdf-name)) > > Why is the PDF deleted (instead of just truncated on write)? It breaks the PDF > watching feature of KDE, because KDE looses the watch on the file because it > is deleted. When the file is recreated, it has a different inode number, and > other attributes on the former PDF are lost as well. Commenting those lines creates a lot of ugly error messages on Windoze. If a PDF is open e.g. on an Acrobat Reader the LP usually just complains that the pdf file cannot be deleted and therefore cannot be re-created. With this modification Ghostscript tries to open the file but cannot because it's locked. I got a lot of programming errors saying: Parsed object should be dead: static scm_unused_struct*. I guess Windows (and Acrobat) handles files differently than Linux and KPDF. Could you test on Linux what happens, if a pdf is opened with Acrobat (Reader) and you re-compile the file? -Risto ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Why does LilyPond delete the PDF first?
Hi, in scm/backend-library there is (line 114-115): (if (access? pdf-name W_OK) (delete-file pdf-name)) Why is the PDF deleted (instead of just truncated on write)? It breaks the PDF watching feature of KDE, because KDE looses the watch on the file because it is deleted. When the file is recreated, it has a different inode number, and other attributes on the former PDF are lost as well. Commenting or deleting the two lines does not seem to do any harm on my system, and it fixes greatly the behaviour of KPDF and Okular. best regards, Wilbert Berendsen -- LilyKDE, LilyPond for KDE: http://lilykde.googlecode.com/ ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel