]> git.donarmstrong.com Git - lilypond.git/commitdiff
* Documentation/user/point-and-click.itely: simplify p&c
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 10 Nov 2005 01:14:39 +0000 (01:14 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 10 Nov 2005 01:14:39 +0000 (01:14 +0000)
instruction: don't configure firefox. Put lilypond-invoke-editor
in front of the browser.

* scripts/lilypond-invoke-editor.scm (run-editor): new function.
(run-browser): new function.

* lily/parser.yy (Lily_lexer): recognize Book

* lily/book.cc (clone): new function

* lily/parser.yy (book_body): allow BOOK_IDENTIFIER.

ChangeLog
Documentation/user/point-and-click.itely
THANKS
lily/book.cc
lily/include/book.hh
lily/parser.yy
scripts/lilypond-invoke-editor.scm

index cc3f322ed2dcb53706accd8211470cf5f6bcf0e2..00004b40a0cb51380428913ae2a899dfb09eb292 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2005-11-10  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * Documentation/user/point-and-click.itely: simplify p&c
+       instruction: don't configure firefox. Put lilypond-invoke-editor
+       in front of the browser.
+
+       * scripts/lilypond-invoke-editor.scm (run-editor): new function.
+       (run-browser): new function.
+
+       * lily/parser.yy (Lily_lexer): recognize Book
+
+       * lily/book.cc (clone): new function
+
+       * lily/parser.yy (book_body): allow BOOK_IDENTIFIER.
+
 2005-11-10  Jürgen Reuter  <reuter@ipd.uka.de>
 
        * lily/vaticana-ligature.cc, lily/vaticana-ligature-engraver.cc:
index a4d58320d773503401f1332d2c8649b5d77f9aa1..827e51bf5fe6b47398808f639c6a3269ccb94bab 100644 (file)
@@ -11,51 +11,22 @@ When this functionality is active, LilyPond adds hyperlinks to the PDF
 file. These hyperlinks are sent to the web-browser, which opens a
 text-editor with the cursor in the right place. 
 
-To make this chain work, the following should done:
-
-@itemize @bullet
-
-@item
-The PDF viewer must be configured for following hyperlinks, preferably
-using Mozilla Firefox.
+To make this chain work, you should configure your PDF viewer to
+follow hyperlinks using the @file{lilypond-invoke-editor} script
+supplied with LilyPond.
 
 For Xpdf on Unix, the following should be present in
 @file{xpdfrc}@footnote{On unix, this file is found either in
 @file{/etc/xpdfrc} or as @file{.xpdfrc} in your home directory.}
 
 @example
-urlCommand     "firefox -remote 'OpenURL(%s)'"
+urlCommand     "lilypond-invoke-editor %s"
 @end example
 
-@item Your web-browser must be configured for the @code{textedit}
-protocol,
-
-For Mozilla and Mozilla Firefox, this is done by adding following
-lines to the @file{user.js}@footnote{On a typical unix system, this
-file exists or must be created in your home-directory as
-@file{.mozilla/firefox/default.trn/user.js} or
-@file{.firefox/default/xxxxxxxx.xxx/user.js},
-see @uref{http://@/www@/.mozilla@/.org@/support@/firefox@/edit#user,location}
-and
-@uref{http://@/www@/.mozilla@/.org@/support@/firefox@/edit#profile,profile}.}
-
-@ignore
-mozilla wants us do store this in user.js:
-
-location on different systems:
-
-@end ignore
-
-@example
-user_pref("network.protocol-handler.app.textedit", "lilypond-invoke-editor");
-user_pref("network.protocol-handler.warn-external.textedit", false);
-@end example
-
-@end itemize
-
-The program @file{lilypond-invoke-editor} is a small helper program.
-It tests the environment variable @code{EDITOR} for the following
-patterns,
+The program @file{lilypond-invoke-editor} is a small helper
+program. It will invoke an editor for the special @code{textedit}
+URIs, and run a web browser for others.  It tests the environment
+variable @code{EDITOR} for the following patterns,
 
 @table @code
 @item emacs
diff --git a/THANKS b/THANKS
index c75ab27e3ed27b5e2aef1709b290c54c4a114a49..e4c5b87e320fe17cf360f7a3b4ad39dc2c53b041 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -54,7 +54,7 @@ Scott Russell
 Thomas Bushnell BSG
 Trevor Bača
 Vicente Solsona Dellá
-Vicenzo Colonnella
+Vincenzo Colonnella
 
 Release 2.6
 ***********
index 28bdb6d5e84a8af8c43033fafb0986127963eff3..e8d0252b2158da5347a26fbf09011f1970c02b67 100644 (file)
@@ -38,6 +38,12 @@ Book::Book ()
   smobify_self ();
 }
 
+Book* 
+Book::clone () const
+{
+  return new Book (*this);
+}
+
 Book::~Book ()
 {
 }
@@ -136,3 +142,4 @@ Book::process (Output_def *default_paper,
   scm_remember_upto_here_1 (scm_key);
   return paper_book;
 }
+
index 4765f332f19ea75a9c335a5e20cd339693373795..31749fbae3643a639108c5460b14532aa47b51da 100644 (file)
@@ -25,6 +25,7 @@ public:
   Output_def *paper_;
   SCM scores_;
 
+  Book *clone () const;
   Book ();
   void add_score (SCM);
   Paper_book *process (Output_def *def_paper,
index 625c107d59a41496949b1529aeeaf036304a4058..70f35f500000a3fb516bd9541d17c17bef939723 100644 (file)
@@ -372,8 +372,7 @@ If we give names, Bison complains.
 %token <i> E_UNSIGNED
 %token <i> UNSIGNED
 
-%token <id> IDENTIFIER
-
+%token <scm> BOOK_IDENTIFIER
 %token <scm> CHORDMODIFIER_PITCH
 %token <scm> CHORD_MODIFIER
 %token <scm> CONTEXT_DEF_IDENTIFIER
@@ -674,6 +673,10 @@ identifier_init:
                $$ = $1->self_scm ();
                $1->unprotect ();
        }
+       | book_block {
+               $$ = $1->self_scm ();
+               $1->unprotect ();
+       }
        | output_def {
                $$ = $1->self_scm ();
                $1->unprotect ();
@@ -757,6 +760,10 @@ book_body:
                $$->paper_->unprotect ();
                $$->header_ = THIS->lexer_->lookup_identifier ("$defaultheader"); 
        }
+       | BOOK_IDENTIFIER {
+               $$ = unsmob_book ($1);
+               $$->set_spot (@$);
+       }
        | book_body paper_block {
                $$->paper_ = $2;
                $2->unprotect ();
@@ -2714,6 +2721,9 @@ Lily_lexer::try_special_identifiers (SCM *destination, SCM sid)
        if (scm_is_string (sid)) {
                *destination = sid;
                return STRING_IDENTIFIER;
+       } else if (unsmob_book (sid)) {
+               *destination = unsmob_book (sid)->clone ()->self_scm ();
+               return BOOK_IDENTIFIER;
        } else if (scm_is_number (sid)) {
                *destination = sid;
                return NUMBER_IDENTIFIER;
index ec585919664d985040ec511fd52b99944b66dbef..9fe02c467f5beef121b207a2607e2ad63d6fbd05 100755 (executable)
   (format #f "~a/lilypond/~a" DATADIR TOPLEVEL-VERSION))
 
 ;; argv0 relocation -- do in wrapper?
+
+
 (define LILYPONDPREFIX
-  (or (getenv "LILYPONDPREFIX")
-      (let* ((bindir (dirname (car (command-line))))
-            (prefix (dirname bindir))
-            (lilypond-prefix
-             (if (eq? prefix (dirname DATADIR)) COMPILE-TIME-PREFIX
-                 (format #f "~a/share/lilypond/~a"
-                         prefix TOPLEVEL-VERSION))))
-       lilypond-prefix)))
+  (let* ((prefix
+         (or (getenv "LILYPONDPREFIX")
+             (dirname  (dirname (car (command-line)))))))
+    
+
+    (if (eq? prefix (dirname DATADIR)) COMPILE-TIME-PREFIX
+       (format #f "~a/share/lilypond/~a"
+               prefix TOPLEVEL-VERSION))))
+
+
 
 ;; gettext wrapper for guile < 1.7.2
 (if (defined? 'gettext)
@@ -69,30 +73,29 @@ Options:
 (define (re-sub re sub string)
   (regexp-substitute/global #f re string 'pre sub 'post))
 
-;; FIXME: I'm going slowly but certainly mad, I really cannot find the
+;; FIXME: I'm going slowly but certainly mad; I really cannot find the
 ;; scm library function for this.
 (define (unquote-uri uri)
   (re-sub "%([A-Fa-f0-9]{2})"
          (lambda (m)
            (string (integer->char (string->number (match:substring m 1) 16))))
          uri))
+
+(define (is-textedit-uri? uri)
+  (string-match "^textedit://" uri))
+  
   
 (define (dissect-uri uri)
-  (let* ((ri "textedit://")
-        (file-name:line:char:column (re-sub ri "" uri))
-        (match (string-match "(.*):([^:]+):([^:]+):(.*)$" file-name:line:char:column)))
+  (let* ((match (string-match "textedit://(.*):([^:]+):([^:]+):(.*)$" uri)))
     (if match
        (list (unquote-uri (match:substring match 1))
              (match:substring match 2)
              (match:substring match 3)
              (match:substring match 4))
        (begin
-         ;; FIXME: why be so strict wrt :LINE:COLUMN,
-         ;; esp. considering omitting textedit:// is explicitly
-         ;; allowed.
-         (format (current-error-port) (_ "invalid URI: ~a") uri)
+         (format (current-error-port) (_ "invalid textedit URI: ~a") uri)
          (newline (current-error-port))
-         (format (current-error-port) (_ "expect: ~aFILE:LINE:CHAR:COLUMN") ri)
+         (format (current-error-port) (_ "expect: textedit://FILE:LINE:CHAR:COLUMN"))
          (newline (current-error-port))
          (exit 1)))))
 
@@ -106,6 +109,21 @@ Options:
     ;; If no TTY and not using safe, assume running from GUI.
     (not have-tty?)))
 
+(define (run-editor uri)
+  (let*
+      ((command (apply get-editor-command (dissect-uri uri)))
+       (status (system command)))
+    (if (not (= status 0))
+       (begin
+         (format (current-error-port)
+                 (_ "failed to invoke editor: ~a") command)
+         (exit 1)))))
+
+(define (run-browser uri)
+
+  ;; TODO: make educated guess which browser to run.
+  (system (format #f "firefox -remote 'OpenURL(~a,new-tab)'" uri)))
+
 (define (main args)
   (let ((files (parse-options args)))
     (if (running-from-gui?)
@@ -121,11 +139,9 @@ Options:
          (exit 2)))
     (set! %load-path (cons LILYPONDPREFIX %load-path))
     (primitive-eval '(use-modules (scm editor)))
-    (let* ((uri (car files))
-          (command (apply get-editor-command (dissect-uri uri)))
-          (status (system command)))
-      (if (not (= status 0))
-         (begin
-           (format (current-error-port)
-                   (_ "failed to invoke editor: ~a") command)
-           (exit 1))))))
+
+    (let* ((uri (car files)))
+      (if (is-textedit-uri? uri)
+         (run-editor uri)
+         (run-browser uri)))))
+