From b6cea347b3f98e33f7da5062bb94427b0471e12f Mon Sep 17 00:00:00 2001
From: Han-Wen Nienhuys <hanwen@xs4all.nl>
Date: Tue, 10 May 2005 08:29:09 +0000
Subject: [PATCH] (ly_pc_editor): robustness.

---
 ChangeLog                        |  4 ++++
 scripts/lilypond-pdfpc-helper.py | 11 ++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index abb2e764ec..3c44eb15c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-05-10  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+	* scripts/lilypond-pdfpc-helper.py (ly_pc_editor): robustness.
+
 2005-05-10  Jan Nieuwenhuizen  <janneke@gnu.org>
 
 	* scm/backend-library.scm (postscript->pdf): Invoke gs instead of
diff --git a/scripts/lilypond-pdfpc-helper.py b/scripts/lilypond-pdfpc-helper.py
index 25a7259107..cfd086fe2f 100644
--- a/scripts/lilypond-pdfpc-helper.py
+++ b/scripts/lilypond-pdfpc-helper.py
@@ -75,7 +75,12 @@ if not match:
 
 (file, line, column) = tuple (match.groups())
 
-editor = os.environ['EDITOR']
+
+editor = ''
+try:
+	editor = os.environ['EDITOR']
+except KeyError:
+	pass
 ly_pc_editor = None
 try:
 	ly_pc_editor = os.environ['LYEDITOR']
@@ -91,6 +96,10 @@ if ly_pc_editor == None:
 	elif re.search ('nedit', editor):
 		ly_pc_editor = 'nc -noask +%(line)s %(file)s'
 
+if not ly_pc_editor:
+	sys.stderr.write ("Need to set EDITOR or LYEDITOR")
+	sys.exit (1)
+
 command = ly_pc_editor % vars()
 
 print 'invoked with %s\ncalling %s\n' % (string.join (sys.argv),command)
-- 
2.39.5