8 version = '@TOPLEVEL_VERSION@'
10 localedir = '@localedir@'
13 gettext.bindtextdomain ('lilypond', localedir)
14 gettext.textdomain ('lilypond')
20 program_name = os.path.basename (sys.argv[0])
23 sys.stdout.write ('Usage: %s FILE:LINE:COLUMN' % program_name)
24 sys.stdout.write ('\n\n')
25 sys.stdout.write ('''PDF Point & Click helper.
26 Start a text-editor when given textedit:///path/to/file:line:column URI.''')
27 sys.stdout.write ('\n\n')
28 sys.stdout.write (_ ("Report bugs to %s.") % "bug-lilypond@gnu.org")
29 sys.stdout.write ('\n')
32 sys.stdout.write (program_id ())
33 sys.stdout.write ('\n')
34 sys.stdout.write (_ ("""\
35 This program is free software. It is covered by the GNU General Public
36 License and you are welcome to change it and/or distribute copies of it
37 under certain conditions. Invoke as `%s --warranty' for more
42 return '%s (GNU LilyPond) %s' % (program_name, version)
44 ################################################################
45 (options, files) = getopt.getopt (sys.argv[1:], 'hv', ['help','version'])
50 if o == '--help' or o == '-h':
53 if o == '--version' or o == '-v':
63 ################################################################
68 arg = re.sub ('textedit://','', arg)
70 match = re.match ('([^:]+):([^:]+):(.*)', arg)
72 sys.stderr.write (_("Not in FILE:LINE:COL format: ")
76 (file, line, column) = tuple (match.groups())
81 editor = os.environ['EDITOR']
86 ly_pc_editor = os.environ['LYEDITOR']
91 if ly_pc_editor == None:
92 if re.search ("emacs", editor):
93 ly_pc_editor = 'emacsclient --no-wait +%(line)s:%(column)s %(file)s'
94 elif re.search ('gvim', editor):
95 ly_pc_editor = 'gvim --remote +:%(line)s:norm%(column)s %(file)s'
96 elif re.search ('nedit', editor):
97 ly_pc_editor = 'nc -noask +%(line)s %(file)s'
100 sys.stderr.write ("Need to set EDITOR or LYEDITOR")
103 command = ly_pc_editor % vars()
105 print 'invoked with %s\ncalling %s\n' % (string.join (sys.argv),command)
107 status = os.system (command)
109 sys.stderr.write (_("Command failed: `%s' (status %d)") % (command, status) + '\n')