+ (progn
+ (setq command (concat LilyPond-all-midi-command " " (LilyPond-string-all-midi)))
+ (LilyPond-kill-midi))) ; stop and start playing
+ (if (and (member name (list "Midi" "MidiAll")) job-string)
+ (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 (member name (list "LilyPond" "TeX" "2Midi" "2PS" "2Dvi"
+ "Book" "LaTeX"))
+ (if (setq jobs (LilyPond-running))
+ (progn
+ (setq job-string "Process") ; could also suggest compiling after process has ended
+ (while jobs
+ (setq job-string (concat job-string " \"" (pop jobs) "\"")))
+ (setq job-string (concat job-string " is already running; kill it to proceed "))
+ (if (y-or-n-p job-string)
+ (progn
+ (setq job-string "no jobs")
+ (LilyPond-kill-jobs)
+ (while (LilyPond-running)
+ (sit-for 0 100)))
+ (setq job-string nil)))))
+