CVSROOT: /cvsroot/lilypond
Module name: lilypond
Branch:
Changes by: Jan Nieuwenhuizen <[EMAIL PROTECTED]> 05/05/10 21:58:45
Modified files:
scm : lily.scm lily-library.scm framework-gnome.scm
lily : general-scheme.cc
. : ChangeLog
Added files:
scripts : lilypond-invoke-editor.scm
scm : editor.scm
Log message:
* scm/editor.scm: New module.
* scm/lily.scm (gui-main): Use it.
* scm/framework-gnome.scm (spawn-editor): Use it.
* scripts/lilypond-invoke-editor.scm: Use it in new script.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scripts/lilypond-invoke-editor.scm?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/editor.scm?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/lily.scm.diff?tr1=1.333&tr2=1.334&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/lily-library.scm.diff?tr1=1.34&tr2=1.35&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/framework-gnome.scm.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/general-scheme.cc.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3590&tr2=1.3591&r1=text&r2=text
Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.3590 lilypond/ChangeLog:1.3591
--- lilypond/ChangeLog:1.3590 Tue May 10 21:16:52 2005
+++ lilypond/ChangeLog Tue May 10 21:58:45 2005
@@ -1,3 +1,13 @@
+2005-05-10 Jan Nieuwenhuizen <[EMAIL PROTECTED]>
+
+ * scm/editor.scm: New module.
+
+ * scm/lily.scm (gui-main): Use it.
+
+ * scm/framework-gnome.scm (spawn-editor): Use it.
+
+ * scripts/lilypond-invoke-editor.scm: Use it in new script.
+
2005-05-10 Han-Wen Nienhuys <[EMAIL PROTECTED]>
* scm/framework-ps.scm (load-font-via-GS): new function.
@@ -18,8 +28,6 @@
* scripts/lilypond-pdfpc-helper.py (ly_pc_editor): robustness fixes.
-2005-05-10 Jan Nieuwenhuizen <[EMAIL PROTECTED]>
-
* scm/backend-library.scm (postscript->pdf): Invoke gs instead of
going through ps2pdf wrappers.
Index: lilypond/lily/general-scheme.cc
diff -u lilypond/lily/general-scheme.cc:1.19
lilypond/lily/general-scheme.cc:1.20
--- lilypond/lily/general-scheme.cc:1.19 Mon May 9 09:19:52 2005
+++ lilypond/lily/general-scheme.cc Tue May 10 21:58:45 2005
@@ -277,8 +277,6 @@
return scm_makfrom0str (prefix_directory.to_str0 ());
}
-
-
LY_DEFINE (ly_chain_assoc_get, "ly:chain-assoc-get",
2, 1, 0, (SCM key, SCM achain, SCM dfault),
"Return value for @var{key} from a list of alists @var{achain}.
Return @var{dfault} "
@@ -295,3 +293,14 @@
else
return dfault == SCM_UNDEFINED ? SCM_BOOL_F : dfault;
}
+
+LY_DEFINE (ly_port_move, "ly:port-move",
+ 2, 0, 0, (SCM fd, SCM port),
+ "Move file descriptor FD to PORT.")
+{
+ SCM_ASSERT_TYPE (scm_port_p (port), port, SCM_ARG1, __FUNCTION__, "port");
+ SCM_ASSERT_TYPE (scm_integer_p (fd), fd, SCM_ARG1, __FUNCTION__, "fd");
+ freopen (ly_scm2newstr (scm_port_filename (port), 0), "a",
+ fdopen (scm_to_int (fd), "a"));
+ return SCM_UNSPECIFIED;
+}
Index: lilypond/scm/framework-gnome.scm
diff -u lilypond/scm/framework-gnome.scm:1.44
lilypond/scm/framework-gnome.scm:1.45
--- lilypond/scm/framework-gnome.scm:1.44 Tue Apr 12 22:49:25 2005
+++ lilypond/scm/framework-gnome.scm Tue May 10 21:58:45 2005
@@ -166,12 +166,6 @@
(add (scrolled go) (canvas go))
(show (canvas go)))))
-(define x-editor #f)
-(define (get-x-editor)
- (if (not x-editor)
- (set! x-editor (getenv "XEDITOR")))
- x-editor)
-
(define ifs #f)
(define (get-ifs)
(if (not ifs)
@@ -184,19 +178,7 @@
(let* ((file-name (car location))
(line (cadr location))
(column (caddr location))
- (template (substring (get-x-editor) 0))
-
- ;; Adhere to %l %c %f?
- (command
- (regexp-substitute/global
- #f "%l" (regexp-substitute/global
- #f "%c"
- (regexp-substitute/global
- #f "%f" template 'pre file-name 'post)
- 'pre (number->string column)
- 'post)
- 'pre (number->string line) 'post)))
-
+ (command (get-editor-command file line column)))
(debugf "spawning: ~s\n" command)
(if (= (primitive-fork) 0)
(let ((command-list (string-split command #\ )));; (get-ifs))))
Index: lilypond/scm/lily-library.scm
diff -u lilypond/scm/lily-library.scm:1.34 lilypond/scm/lily-library.scm:1.35
--- lilypond/scm/lily-library.scm:1.34 Thu Apr 21 14:28:31 2005
+++ lilypond/scm/lily-library.scm Tue May 10 21:58:45 2005
@@ -304,7 +304,6 @@
(cons x (cons between y))))
(fold-right conc #f lst))
-
(define-public (string-regexp-substitute a b str)
(regexp-substitute/global #f a str 'pre b 'post))
Index: lilypond/scm/lily.scm
diff -u lilypond/scm/lily.scm:1.333 lilypond/scm/lily.scm:1.334
--- lilypond/scm/lily.scm:1.333 Tue May 10 07:22:16 2005
+++ lilypond/scm/lily.scm Tue May 10 21:58:45 2005
@@ -15,8 +15,8 @@
(ice-9 safe)
(ice-9 optargs)
(oop goops)
- (srfi srfi-1) ; lists
- (srfi srfi-13)) ; strings
+ (srfi srfi-1) ;; lists
+ (srfi srfi-13)) ;; strings
;; my display
@@ -295,33 +295,17 @@
protects))
outfile)))
+(define-public (tweak-grob-property grob sym val)
+ (set! (ly:grob-property grob sym) val))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(define (no-files-handler)
- (ly:usage)
- (exit 2))
-
(define-public (lilypond-main files)
"Entry point for LilyPond."
(if (null? files)
(no-files-handler))
- (let* ((failed '())
- (handler (lambda (key failed-file)
- (set! failed (append (list failed-file) failed)))))
- ;;(handler (lambda (key . arg) (set! failed (append arg failed)))))
- (for-each
- (lambda (f)
- (catch 'ly-file-failed
- (lambda () (ly:parse-file f))
- (lambda (x . args) (handler x f)))
- ;;(lambda (x) (handler x f)))
- (if #f
- (dump-gc-protects)))
- files)
-
+ (let ((failed (lilypond-all files)))
(if (pair? failed)
(begin
(ly:error (_ "failed files: ~S") (string-join failed))
@@ -331,5 +315,51 @@
(ly:message "")
(exit 0)))))
-(define-public (tweak-grob-property grob sym val)
- (set! (ly:grob-property grob sym) val))
+(define (no-files-handler)
+ (ly:usage)
+ (exit 2))
+
+(define-public (lilypond-all files)
+ (let* ((failed '())
+ (handler (lambda (key failed-file)
+ (set! failed (append (list failed-file) failed)))))
+ ;;(handler (lambda (key . arg) (set! failed (append arg failed)))))
+ (for-each (lambda (x) (lilypond-file handler x)) files)))
+
+(define (lilypond-file handler file-name)
+ (catch 'ly-file-failed
+ (lambda () (ly:parse-file file-name))
+ (lambda (x . args) (handler x file-name)))
+ ;;(lambda (x) (handler x f)))
+ (if #f
+ (dump-gc-protects)))
+
+(use-modules (scm editor))
+
+(define-public (gui-main files)
+ (if (null? files) (gui-no-files-handler))
+ (let* ((base (basename (car files) ".ly"))
+ (log-name (string-append base ".log"))
+ (log-file (open-file log-name "w")))
+ (display "# -*-compilation-*-" log-file)
+ (newline log-file)
+ (ly:message (_ "Redirecting output to ~a...") log-name)
+ (ly:port-move (fileno (current-error-port)) log-file)
+ (if (null? (lilypond-all files))
+ (exit 0)
+ (begin
+ (system (get-editor-command log-name 0 0))
+ (exit 1)))))
+
+(define (gui-no-files-handler)
+ (let* ((input (string-append
+ (string-regexp-substitute
+ "share/lilypond/" "share/doc/lilypond-"
+ (getenv "LILYPONDPREFIX"))
+ "-1/input"))
+ (ly (string-append input "/" "Welcome to LilyPond.ly"))
+ (cmd (get-editor-command ly 0 0)))
+ (system cmd)))
+
+;; FIXME
+;; (define lilypond-main gui-main)
_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs