From: hjunes <hjunes>
Date: Tue, 17 Dec 2002 23:10:05 +0000 (+0000)
Subject: propose 2midi if midi is invoked for old midi, wait for killing.
X-Git-Tag: release/1.7.25~527
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e0d2a4949c06fe41f4a9d0d809c9b7181bff1165;p=lilypond.git

propose 2midi if midi is invoked for old midi, wait for killing.
---

diff --git a/ChangeLog b/ChangeLog
index ce0b6a5d38..da3b051432 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-12-18  Heikki Junes <hjunes@cc.hut.fi>
+
+	* lilypond-mode.el (LilyPond-command): propose 2midi if midi is
+	invoked for old midi, wait for killing.
+
 2002-12-16  Heikki Junes <hjunes@cc.hut.fi>
 
 	* Documentation/user/music-glossary.tely: Finnishing.
diff --git a/lilypond-mode.el b/lilypond-mode.el
index 5946def565..0bf1523305 100644
--- a/lilypond-mode.el
+++ b/lilypond-mode.el
@@ -583,6 +583,16 @@ command."
 		      (LilyPond-shell-process name buffer-xdvi command)))
 		  (LilyPond-shell-process name buffer-xdvi command)))
 	    (progn
+	      (if (member name (list "Midi" "MidiAll"))
+		  (if (file-newer-than-file-p
+		       (LilyPond-master-file)
+		       (concat (substring (LilyPond-master-file) 0 -3) ".midi"))
+		      (if (y-or-n-p "Midi older than source. Reformat midi?")
+			  (progn
+			    (LilyPond-command-formatmidi)
+			    (while (LilyPond-running)
+			      (message "Starts playing midi once it is built.")
+			      (sit-for 0 100))))))
 	      (if (string-equal name "Midi")
 		  (progn
 		    (setq command (concat LilyPond-midi-command " " (LilyPond-string-current-midi)))
@@ -604,7 +614,8 @@ command."
 			    (progn
 			      (setq job-string "no jobs")
 			      (LilyPond-kill-jobs)
-			      (sit-for 0 500 nil)) ; should wait killing
+			      (while (LilyPond-running)
+				(sit-for 0 100)))
 			  (setq job-string nil)))))
 
 	      (setq LilyPond-command-default name)