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 ('Call remote editor given Mozilla remote link command')
26 sys.stdout.write ('\n\n')
27 sys.stdout.write (_ ("Report bugs to %s.") % "bug-lilypond@gnu.org")
28 sys.stdout.write ('\n')
31 sys.stdout.write (program_id ())
32 sys.stdout.write ('\n')
33 sys.stdout.write (_ ("""\
34 This program is free software. It is covered by the GNU General Public
35 License and you are welcome to change it and/or distribute copies of it
36 under certain conditions. Invoke as `%s --warranty' for more
41 return '%s (GNU LilyPond) %s' % (program_name, version)
43 ################################################################
44 (options, files) = getopt.getopt (sys.argv[1:], 'hv', ['help','version'])
49 if o == '--help' or o == '-h':
52 if o == '--version' or o == '-v':
62 ################################################################
67 arg = re.sub ('textedit://','', arg)
69 match = re.match ('([^:]+):([^:]+):(.*)', arg)
71 sys.stderr.write (_("Not in FILE:LINE:COL format: ")
75 (file, line, column) = tuple (match.groups())
77 editor = os.environ['EDITOR']
80 ly_pc_editor = os.environ['LYEDITOR']
85 if ly_pc_editor == None:
86 if re.search ("emacs", editor):
87 ly_pc_editor = 'emacsclient --no-wait +%(line)s:%(column)s %(file)s'
88 elif re.search ('gvim', editor):
89 ly_pc_editor = 'gvim --remote +:%(line)s:norm%(column)s %(file)s'
90 elif re.search ('nedit', editor):
91 ly_pc_editor = 'nc -noask +%(line)s %(file)s'
93 command = ly_pc_editor % vars()
95 print 'invoked with %s\ncalling %s\n' % (string.join (sys.argv),command)
97 status = os.system (command)
99 sys.stderr.write (_("Command failed: `%s' (status %d)") % (command, status) + '\n')