Thomas Bushnell writes:

> But now there's a new, more subtle, one.

Fixed in CVS, see patch below.

Thanks for the report (and sorry that this kludge survived in the first place).

Jan.

Index: ChangeLog
===================================================================
RCS file: /cvsroot/lilypond/lilypond/ChangeLog,v
retrieving revision 1.3836.2.42
diff -p -u -r1.3836.2.42 ChangeLog
--- ChangeLog	23 Oct 2005 15:58:39 -0000	1.3836.2.42
+++ ChangeLog	23 Oct 2005 19:03:38 -0000
@@ -1,3 +1,8 @@
+2005-10-23  Jan Nieuwenhuizen  <[EMAIL PROTECTED]>
+
+	* scm/lily.scm: Remove horrendous running-from-gui? kludge.
+	(lilypond-main): Redirect to gui-main if 'gui is set.
+
 2005-10-23  Erik Sandberg  <[EMAIL PROTECTED]>
 
 	* scripts/lilypond-book.py: Backport bugfix by Mats Bengtsson.
Index: lily/lily-parser-scheme.cc
===================================================================
RCS file: /cvsroot/lilypond/lilypond/lily/lily-parser-scheme.cc,v
retrieving revision 1.16
diff -p -u -r1.16 lily-parser-scheme.cc
--- lily/lily-parser-scheme.cc	22 Jun 2005 15:06:05 -0000	1.16
+++ lily/lily-parser-scheme.cc	23 Oct 2005 19:02:10 -0000
@@ -8,15 +8,16 @@
 
 #include <unistd.h>
 
+#include "file-name-map.hh"
 #include "file-name.hh"
 #include "file-path.hh"
-#include "main.hh"
-#include "lily-parser.hh"
-#include "warn.hh"
-#include "source.hh"
 #include "lily-lexer.hh"
+#include "lily-parser.hh"
 #include "ly-module.hh"
-#include "file-name-map.hh"
+#include "main.hh"
+#include "program-option.hh"
+#include "source.hh"
+#include "warn.hh"
 
 /* Do not append `!' suffix, since 1st argument is not modified. */
 LY_DEFINE (ly_set_point_and_click, "ly:set-point-and-click",
@@ -52,7 +53,7 @@ LY_DEFINE (ly_parse_file, "ly:parse-file
 
   /* When running from gui, generate output in .ly source directory.  */
   if (output_name_global.is_empty ()
-      && scm_call_0 (ly_lily_module_constant ("running-from-gui?")) == SCM_BOOL_T)
+      && ly_get_option (ly_symbol2scm ("gui")) == SCM_BOOL_T)
     {
       File_name f (file);
       f.base_ = "";
Index: scm/lily.scm
===================================================================
RCS file: /cvsroot/lilypond/lilypond/scm/lily.scm,v
retrieving revision 1.367.2.3
diff -p -u -r1.367.2.3 lily.scm
--- scm/lily.scm	1 Aug 2005 15:14:46 -0000	1.367.2.3
+++ scm/lily.scm	23 Oct 2005 19:02:10 -0000
@@ -348,6 +348,9 @@ The syntax is the same as `define*-publi
 (define-public (lilypond-main files)
   "Entry point for LilyPond."
 
+  (if (ly:get-option 'gui)
+      (gui-main files))
+
   (if (null? files)
       (no-files-handler))
 
@@ -385,29 +388,12 @@ The syntax is the same as `define*-publi
 
 (use-modules (scm editor))
 
-(define-public (running-from-gui?)
-  (let ((have-tty? (isatty? (current-input-port))))
-    ;; If no TTY and not using safe, assume running from GUI.
-    (cond
-     ((eq? PLATFORM 'windows)
-      ;; Always write to .log file.
-      (if DOS #t
-      ;; This only works for i586-mingw32msvc-gcc -mwindows
-      (not (string-match "standard input"
-			 (format #f "~S" (current-input-port))))))
-     ;; FIXME: using -dgui would be nice, but it does not work
-     ((eq? PLATFORM 'foo-windows)
-      (ly:get-option 'gui))
-     ((eq? PLATFORM 'darwin) #f)
-     (else
-      (not have-tty?)))))
-
 (define-public (gui-main files)
   (if (null? files)
       (gui-no-files-handler))
   (let* ((base (basename (car files) ".ly"))
 	 (log-name (string-append base ".log")))
-    (if (not (running-from-gui?))
+    (if (not (ly:get-option 'gui))
 	(ly:message (_ "Redirecting output to ~a...") log-name))
     (ly:stderr-redirect log-name "w")
     (ly:message "# -*-compilation-*-")
@@ -430,7 +416,3 @@ The syntax is the same as `define*-publi
     (ly:message (_ "Invoking `~a'...") cmd)
     (system cmd)
     (exit 1)))
-
-(or (not (running-from-gui?))
-    (ly:get-option 'safe)
-    (define lilypond-main gui-main))
-- 
Jan Nieuwenhuizen <[EMAIL PROTECTED]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to