]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-invoke-editor.scm
* lily/self-aligment-interface.cc (set_align_self): new function
[lilypond.git] / scripts / lilypond-invoke-editor.scm
index a9cf32c2497c28543d69acef4879ff10f529fb95..ec585919664d985040ec511fd52b99944b66dbef 100755 (executable)
   (format port "~a (GNU LilyPond) ~a \n" PROGRAM-NAME TOPLEVEL-VERSION))
 
 (define (show-help port)
-  (format port (_ "Usage: lilypond-invoke-editor [textedit://]FILE:LINE:COLUMN
+  (format port (_ "Usage: lilypond-invoke-editor [textedit://]FILE:LINE:CHAR:COLUMN
 
-Visit a file and position the cursor
+Visit a file and position the cursor.
 
 Options:
-  -h,--help          show this help
-  -v,--version       show version
+  -h, --help          show this help
+  -v, --version       show version
 ")))
 
 (define (parse-options args)
@@ -66,9 +66,6 @@ Options:
     (show-version (current-error-port))
     files))
 
-;;(define (re-sub re sub string)
-;;  (let ((sub-string (if (string? sub) sub (sub re))))
-;;    (regexp-substitute/global #f re string 'pre sub-string 'post)))
 (define (re-sub re sub string)
   (regexp-substitute/global #f re string 'pre sub 'post))
 
@@ -82,19 +79,20 @@ Options:
   
 (define (dissect-uri uri)
   (let* ((ri "textedit://")
-        (file-name:line:column (re-sub ri "" uri))
-        (match (string-match "(.*):([^:]+):(.*)$" file-name:line:column)))
+        (file-name:line:char:column (re-sub ri "" uri))
+        (match (string-match "(.*):([^:]+):([^:]+):(.*)$" file-name:line:char:column)))
     (if match
        (list (unquote-uri (match:substring match 1))
              (match:substring match 2)
-             (match:substring match 3))
+             (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)
          (newline (current-error-port))
-         (format (current-error-port) (_ "expect: ~aFILE:LINE:COLUMN") ri)
+         (format (current-error-port) (_ "expect: ~aFILE:LINE:CHAR:COLUMN") ri)
          (newline (current-error-port))
          (exit 1)))))
 
@@ -120,7 +118,7 @@ Options:
     (if (not (= (length files) 1))
        (begin
          (show-help (current-error-port))
-         (exit 1)))
+         (exit 2)))
     (set! %load-path (cons LILYPONDPREFIX %load-path))
     (primitive-eval '(use-modules (scm editor)))
     (let* ((uri (car files))