]> git.donarmstrong.com Git - lilypond.git/commitdiff
new file. Invoke different
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 27 Feb 2005 12:19:13 +0000 (12:19 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 27 Feb 2005 12:19:13 +0000 (12:19 +0000)
editors based on EDITOR setting.

ChangeLog
VERSION
ps/music-drawing-routines.ps
scm/output-ps.scm
scripts/GNUmakefile
scripts/lilypond-pdfpc-helper.py [new file with mode: 0644]

index 8eeb7027d185241e9400287b6ae7731d8fb508c5..82b9b511e61613912f9e167bceb0de3d17b2d8c1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-02-27  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * scripts/lilypond-pdfpc-helper.py: new file. Invoke different
+       editors based on EDITOR setting.
+
 2005-02-27  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * scm/*: Oops, more grand 2005 replace bits.
diff --git a/VERSION b/VERSION
index 3643ac4c4b6c88a7dd293fa2fb0dfcac727f2ced..4871c881c2b52aa859fb1d08c55676bb8e7ed0cd 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,6 +1,6 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=2
 MINOR_VERSION=5
-PATCH_LEVEL=12
+PATCH_LEVEL=13
 MY_PATCH_LEVEL=
 
index b54622b3bb3c9f3af5da3e1082babf173fddacae..36d16ce38301e7a939639fa90a6ffa4cf8e2fd02 100644 (file)
@@ -10,7 +10,7 @@
 % llx lly urx ury command
 /mark_file_line
 {
-    /editorcommand exch def
+    /command exch def
     /ury exch def
     /urx exch def
     /lly exch def
     [
        /Rect [ llx lly urx ury ]
        /Border [ 0 0 0 0 ]
-       /Action 
-       <<
-           /Subtype /Launch
-           /File editorcommand
+%      /Action /Launch
+%      /File command
+       /Action <<
+           /Subtype /URI
+           /URI command
        >>
+    
         /Subtype /Link
     /ANN
     pdfmark
index 205fbe87357a1b03ab5059448dc3b79c14f1b76c..d258df8e9e7811ff21cf0b859063c92215549f76 100644 (file)
         )
 
     (if location
-       (format "~a ~a ~a ~a (lily-edit.sh ~a ~a ~a) mark_file_line\n"
+       (format "~a ~a ~a ~a (~a:~a:~a) mark_file_line\n"
                (+ (car offset) (car x-ext))
                (+ (cdr offset) (car y-ext))
                (+ (car offset) (cdr x-ext))
index 2d89889d84f289750f4a9ea54008aa6bb4db68d6..ca11b211d988833d588ff136db553f7de7960837 100644 (file)
@@ -1,6 +1,6 @@
 depth = ..
 
-SEXECUTABLES=convert-ly lilypond-book lilypond-latex abc2ly etf2ly mup2ly midi2ly ps2png
+SEXECUTABLES=convert-ly lilypond-book lilypond-latex abc2ly etf2ly mup2ly midi2ly ps2png lilypond-pdfpc-helper
 
 STEPMAKE_TEMPLATES=script help2man po
 LOCALSTEPMAKE_TEMPLATES = lilypond
diff --git a/scripts/lilypond-pdfpc-helper.py b/scripts/lilypond-pdfpc-helper.py
new file mode 100644 (file)
index 0000000..87f23c0
--- /dev/null
@@ -0,0 +1,94 @@
+#!@PYTHON@
+import re
+import getopt
+import sys
+import os
+
+version = '@TOPLEVEL_VERSION@'
+
+localedir = '@localedir@'
+try:
+       import gettext
+       gettext.bindtextdomain ('lilypond', localedir)
+       gettext.textdomain ('lilypond')
+       _ = gettext.gettext
+except:
+       def _ (s):
+               return s
+       
+program_name = os.path.basename (sys.argv[0])
+print os.getcwd()
+def usage():
+       sys.stdout.write ('Usage: %s FILE:LINE:COLUMN' % program_name)
+       sys.stdout.write ('\n\n')
+       sys.stdout.write ('Call remote editor given Mozilla remote link command')
+       sys.stdout.write ('\n\n')
+       sys.stdout.write (_ ("Report bugs to %s.") % "bug-lilypond@gnu.org")
+       sys.stdout.write ('\n')
+
+def print_version ():
+       sys.stdout.write (program_id ())
+       sys.stdout.write ('\n')
+       sys.stdout.write (_ ("""\
+This program is free software.  It is covered by the GNU General Public
+License and you are welcome to change it and/or distribute copies of it
+under certain conditions.  Invoke as `%s --warranty' for more
+information.
+""") % "lilypond")
+
+def program_id ():
+       return '%s (GNU LilyPond) %s' % (program_name, version)
+
+################################################################
+(options, files) = getopt.getopt (sys.argv[1:], 'hv', ['help','version'])
+
+for opt in options:
+       o = opt[0]
+       a = opt[1]
+       if o == '--help' or o == '-h':
+               usage ()
+               sys.exit (0)
+       if o == '--version' or o == '-v':
+               print_version ()
+               sys.exit (0)
+
+
+if not files:
+       usage()
+       sys.exit (1)
+       
+
+################################################################
+
+match = re.match ('([^:]+):([^:]+):(.*)', files[0])
+if not match:
+       sys.stderr.write (_("Not in FILE:LINE:COL format: ")
+                         + files[0])
+       sys.exit (1)
+
+(file, line, column) = tuple (match.groups())
+
+editor = os.environ['EDITOR']
+ly_pc_editor = None
+try:
+       ly_pc_editor = os.environ['LYEDITOR']
+except KeyError:
+       pass
+
+
+if ly_pc_editor == None:
+       if  re.search ("emacs", editor):
+               ly_pc_editor = 'emacsclient --no-wait +%(line)s:%(column)s %(file)s'
+       elif re.search ('gvim', editor):
+               ly_pc_editor = 'gvim --remote +:%(line)s:norm%(column)s %(file)s'
+       elif re.search ('nedit', editor):
+               ly_pc_editor = 'nc -noask +%(line)s %(file)s'
+
+command = ly_pc_editor % vars()
+
+status = os.system (command)
+if status:
+       sys.stderr.write (_("Command failed: `%s' (status %d)") % (command, status) + '\n')
+
+
+