7 version = '@TOPLEVEL_VERSION@'
9 localedir = '@localedir@'
12 gettext.bindtextdomain ('lilypond', localedir)
13 gettext.textdomain ('lilypond')
19 program_name = os.path.basename (sys.argv[0])
22 sys.stdout.write ('Usage: %s FILE:LINE:COLUMN' % program_name)
23 sys.stdout.write ('\n\n')
24 sys.stdout.write ('Call remote editor given Mozilla remote link command')
25 sys.stdout.write ('\n\n')
26 sys.stdout.write (_ ("Report bugs to %s.") % "bug-lilypond@gnu.org")
27 sys.stdout.write ('\n')
30 sys.stdout.write (program_id ())
31 sys.stdout.write ('\n')
32 sys.stdout.write (_ ("""\
33 This program is free software. It is covered by the GNU General Public
34 License and you are welcome to change it and/or distribute copies of it
35 under certain conditions. Invoke as `%s --warranty' for more
40 return '%s (GNU LilyPond) %s' % (program_name, version)
42 ################################################################
43 (options, files) = getopt.getopt (sys.argv[1:], 'hv', ['help','version'])
48 if o == '--help' or o == '-h':
51 if o == '--version' or o == '-v':
61 ################################################################
63 match = re.match ('([^:]+):([^:]+):(.*)', files[0])
65 sys.stderr.write (_("Not in FILE:LINE:COL format: ")
69 (file, line, column) = tuple (match.groups())
71 editor = os.environ['EDITOR']
74 ly_pc_editor = os.environ['LYEDITOR']
79 if ly_pc_editor == None:
80 if re.search ("emacs", editor):
81 ly_pc_editor = 'emacsclient --no-wait +%(line)s:%(column)s %(file)s'
82 elif re.search ('gvim', editor):
83 ly_pc_editor = 'gvim --remote +:%(line)s:norm%(column)s %(file)s'
84 elif re.search ('nedit', editor):
85 ly_pc_editor = 'nc -noask +%(line)s %(file)s'
87 command = ly_pc_editor % vars()
89 status = os.system (command)
91 sys.stderr.write (_("Command failed: `%s' (status %d)") % (command, status) + '\n')