X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Flilypond-invoke-editor.scm;h=ff3efbdf26ac6a1e6de81490f457d3d9105d2d01;hb=537175ab74b05f3a220e50a6f55fcb62a917188c;hp=275aa901d88304e05d08f1cd1cbaffddbdf1c8f9;hpb=9e69cb84d6ee5b0a861cd97869b10e3bdf0c833c;p=lilypond.git diff --git a/scripts/lilypond-invoke-editor.scm b/scripts/lilypond-invoke-editor.scm old mode 100755 new mode 100644 index 275aa901d8..ff3efbdf26 --- a/scripts/lilypond-invoke-editor.scm +++ b/scripts/lilypond-invoke-editor.scm @@ -1,10 +1,23 @@ #!@GUILE@ -s !# ;;;; lilypond-invoke-editor.scm -- Invoke an editor in file:line:column mode + +;;;; Copyright (C) 2005--2014 Jan Nieuwenhuizen + +;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; source file of the GNU LilyPond music typesetter +;;;; LilyPond is free software: you can redistribute it and/or modify +;;;; it under the terms of the GNU General Public License as published by +;;;; the Free Software Foundation, either version 3 of the License, or +;;;; (at your option) any later version. ;;;; -;;;; (c) 2005--2006 Jan Nieuwenhuizen +;;;; LilyPond is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;;; GNU General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU General Public License +;;;; along with LilyPond. If not, see . ;; gui debug helper ;; (define (exit x) (system "sleep 10")) @@ -24,9 +37,9 @@ ;; argv0 relocation -- do in wrapper? -(define LILYPONDPREFIX +(define LILYPOND_DATADIR (let* ((prefix - (or (getenv "LILYPONDPREFIX") + (or (getenv "LILYPOND_DATADIR") (dirname (dirname (car (command-line))))))) @@ -34,15 +47,10 @@ (format #f "~a/share/lilypond/~a" prefix TOPLEVEL-VERSION)))) - - -;; gettext wrapper for guile < 1.7.2 -(if (defined? 'gettext) - (define-public _ gettext) - (define-public (_ x) x)) +(define-public _ gettext) (define (show-version port) - (format port "~a (GNU LilyPond) ~a \n" PROGRAM-NAME TOPLEVEL-VERSION)) + (format port "~a (GNU LilyPond) ~a\n" PROGRAM-NAME TOPLEVEL-VERSION)) (define (show-help port) (format port (_ "Usage: lilypond-invoke-editor [textedit://]FILE:LINE:CHAR:COLUMN @@ -81,7 +89,7 @@ Options: uri)) (define (is-textedit-uri? uri) - (string-match "^textedit://" uri)) + (string-match "^textedit:" uri)) (define (dissect-uri uri) @@ -121,21 +129,22 @@ Options: (define (run-browser uri) (system (if (getenv "BROWSER") - (format "~a ~a" (getenv "BROWSER") uri) + (format #f "~a ~a" (getenv "BROWSER") uri) (format #f "firefox -remote 'OpenURL(~a,new-tab)'" uri)))) (define (strip-framework-path var) (define pat "lilypond/usr") - (let* - ((val (getenv var)) - (paths (string-split val #\:)) - (without (remove (lambda (s) (string-contains s pat)) - paths))) - - (if (not (= (length without) - (length paths))) - (setenv var (string-join without ":"))))) + (if (getenv var) + (let* + ((val (getenv var)) + (paths (string-split val #\:)) + (without (remove (lambda (s) (string-contains s pat)) + paths))) + + (if (not (= (length without) + (length paths))) + (setenv var (string-join without ":")))))) (define (main args) (let ((files (parse-options args))) @@ -150,7 +159,7 @@ Options: (begin (show-help (current-error-port)) (exit 2))) - (set! %load-path (cons LILYPONDPREFIX %load-path)) + (set! %load-path (cons LILYPOND_DATADIR %load-path)) (primitive-eval '(use-modules (scm editor)))