From: Han-Wen Nienhuys Date: Sun, 27 Feb 2005 12:19:13 +0000 (+0000) Subject: new file. Invoke different X-Git-Tag: release/2.5.14~76 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=3f383278764e642a98e15291eae5a6e946beca20;p=lilypond.git new file. Invoke different editors based on EDITOR setting. --- diff --git a/ChangeLog b/ChangeLog index 8eeb7027d1..82b9b511e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-02-27 Han-Wen Nienhuys + + * scripts/lilypond-pdfpc-helper.py: new file. Invoke different + editors based on EDITOR setting. + 2005-02-27 Jan Nieuwenhuizen * scm/*: Oops, more grand 2005 replace bits. diff --git a/VERSION b/VERSION index 3643ac4c4b..4871c881c2 100644 --- 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= diff --git a/ps/music-drawing-routines.ps b/ps/music-drawing-routines.ps index b54622b3bb..36d16ce383 100644 --- a/ps/music-drawing-routines.ps +++ b/ps/music-drawing-routines.ps @@ -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 @@ -18,11 +18,13 @@ [ /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 diff --git a/scm/output-ps.scm b/scm/output-ps.scm index 205fbe8735..d258df8e9e 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -220,7 +220,7 @@ ) (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)) diff --git a/scripts/GNUmakefile b/scripts/GNUmakefile index 2d89889d84..ca11b211d9 100644 --- a/scripts/GNUmakefile +++ b/scripts/GNUmakefile @@ -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 index 0000000000..87f23c0088 --- /dev/null +++ b/scripts/lilypond-pdfpc-helper.py @@ -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') + + +