Permalink
Browse files

Added ly-toggle-midi-play () and ly-toggle-pdf-display and modified

naming convention
  • Loading branch information...
1 parent 613be09 commit 3c7389c99c33984ba54c7fc9b55515c7209058ca @mjago committed Jun 12, 2011
Showing with 25 additions and 15 deletions.
  1. +25 −15 lib/ob-lilypond.el
View
@@ -4,29 +4,29 @@
(defalias 'lilypond-mode 'LilyPond-mode)
(add-to-list 'org-babel-tangle-lang-exts '("LilyPond" . "ly"))
-(defvar ob-ly-compile-post-tangle t
+(defvar ly-compile-post-tangle t
"Following the org-babel-tangle (C-c C-v t) command,
-OB-LY-COMPILE-POST-TANGLE determines whether ob-lilypond should
+LY-COMPILE-POST-TANGLE determines whether ob-lilypond should
automatically attempt to compile the resultant tangled file.
If the value is nil, no automated compilation takes place.
Default value is t")
-(defvar ob-ly-draw-pdf-post-tangle t
+(defvar ly-display-pdf-post-tangle t
"Following a successful LilyPond compilation
-OB-LY-DRAW-PDF-POST-TANGLE determines whether to automate the
+LY-DISPLAY-PDF-POST-TANGLE determines whether to automate the
drawing / redrawing of the resultant pdf. If the value is nil,
the pdf is not automatically redrawn. Default value is t")
-(defvar ob-ly-play-midi-post-tangle t
+(defvar ly-play-midi-post-tangle t
"Following a successful LilyPond compilation
-OB-LY-PLAY-MIDI-POST-TANGLE determines whether to automate the
+LY-PLAY-MIDI-POST-TANGLE determines whether to automate the
playing of the resultant midi file. If the value is nil,
the midi file is not automatically played. Default value is t")
-(defvar ob-ly-OSX-app-path
+(defvar ly-OSX-app-path
"/Applications/lilypond.app/Contents/Resources/bin/lilypond")
-(defvar ob-ly-unix-app-path "")
-(defvar ob-ly-win32-app-path "")
+(defvar ly-unix-app-path "")
+(defvar ly-win32-app-path "")
(defvar org-babel-default-header-args:lilypond
'((:results . "file") (:exports . "results"))
@@ -68,7 +68,7 @@ This function is called by `org-babel-execute-src-block'."
(defun org-babel-execute-tangled-ly ()
(interactive)
- (when ob-ly-compile-post-tangle
+ (when ly-compile-post-tangle
(let ((ly-tangled-file (concat
(file-name-nondirectory
(file-name-sans-extension
@@ -114,7 +114,7 @@ This function is called by `org-babel-execute-src-block'."
(if (not (search-forward "error:" nil t)) t nil))))
(defun ly-attempt-to-open-pdf (file-name)
- (when ob-ly-draw-pdf-post-tangle
+ (when ly-display-pdf-post-tangle
(let ((pdf-file (concat
(file-name-sans-extension
file-name)
@@ -124,7 +124,7 @@ This function is called by `org-babel-execute-src-block'."
(error "No pdf file generated so can't display!")))))
(defun ly-attempt-to-play-midi (file-name)
- (when ob-ly-play-midi-post-tangle
+ (when ly-play-midi-post-tangle
(let ((midi-file (concat
(file-name-sans-extension
file-name)
@@ -135,10 +135,20 @@ This function is called by `org-babel-execute-src-block'."
(defun ly-determine-app-path ()
(cond ((string= system-type "darwin")
- ob-ly-OSX-app-path)
+ ly-OSX-app-path)
((string= system-type "win32")
- ob-ly-win32-app-path)
- (t ob-ly-unix-app-path)))
+ ly-win32-app-path)
+ (t ly-unix-app-path)))
+
+(defun ly-toggle-midi-play ()
+ (interactive)
+ (setq ly-play-midi-post-tangle
+ (not ly-play-midi-post-tangle)))
+
+(defun ly-toggle-pdf-display ()
+ (interactive)
+ (setq ly-display-pdf-post-tangle
+ (not ly-display-pdf-post-tangle)))
;;; ob-lilypond.el ends here

0 comments on commit 3c7389c

Please sign in to comment.