]> git.donarmstrong.com Git - lilypond.git/blobdiff - lilypond-mode.el
release: 1.5.10
[lilypond.git] / lilypond-mode.el
index e0b7de1c765c696256f5634f988ddafce8225c92..565aa0494366d96947e62b827805fa02509af34f 100644 (file)
@@ -7,6 +7,8 @@
 ;;; 
 ;;; Changed 29th Aug 2001 Heikki Junes <heikki.junes@hut.fi>
 ;;;    * Add PS-compilation, PS-viewing and MIDI-play
+;;; Changed 12th Sep 2001 Heikki Junes
+;;;    * Keyboard shortcuts
 
 ;;; Inspired on auctex
 
@@ -273,6 +275,42 @@ Must be the car of an entry in `LilyPond-command-alist'."
   (LilyPond-command (LilyPond-command-query (LilyPond-master-file))
                    'LilyPond-master-file))
 
+(defun LilyPond-command-formatdvi ()
+  "Format the dvi output of the current document."
+  (interactive)
+  (LilyPond-command (LilyPond-command-menu "2Dvi") 'LilyPond-master-file)
+)
+
+(defun LilyPond-command-formatps ()
+  "Format the ps output of the current document."
+  (interactive)
+  (LilyPond-command (LilyPond-command-menu "2PS") 'LilyPond-master-file)
+)
+
+(defun LilyPond-command-smartview ()
+  "View the dvi output of current document."
+  (interactive)
+  (LilyPond-command (LilyPond-command-menu "SmartView") 'LilyPond-master-file)
+)
+
+(defun LilyPond-command-view ()
+  "View the dvi output of current document."
+  (interactive)
+  (LilyPond-command (LilyPond-command-menu "View") 'LilyPond-master-file)
+)
+
+(defun LilyPond-command-viewps ()
+  "View the ps output of current document."
+  (interactive)
+  (LilyPond-command (LilyPond-command-menu "ViewPS") 'LilyPond-master-file)
+)
+
+(defun LilyPond-command-midi ()
+  "View the ps output of current document."
+  (interactive)
+  (LilyPond-command (LilyPond-command-menu "Midi") 'LilyPond-master-file)
+)
+
 ;; FIXME, this is broken
 (defun LilyPond-region-file (begin end)
   (let (
@@ -382,6 +420,12 @@ command."
   (define-key LilyPond-mode-map "\C-c\C-b" 'LilyPond-command-buffer)
   (define-key LilyPond-mode-map "\C-c\C-k" 'LilyPond-kill-job)
   (define-key LilyPond-mode-map "\C-c\C-c" 'LilyPond-command-master)
+  (define-key LilyPond-mode-map "\C-c\C-d" 'LilyPond-command-formatdvi)
+  (define-key LilyPond-mode-map "\C-c\C-f" 'LilyPond-command-formatps)
+  (define-key LilyPond-mode-map "\C-c\C-s" 'LilyPond-command-smartview)
+  (define-key LilyPond-mode-map "\C-c\C-v" 'LilyPond-command-view)
+  (define-key LilyPond-mode-map "\C-c\C-p" 'LilyPond-command-viewps)
+  (define-key LilyPond-mode-map "\C-c\C-m" 'LilyPond-command-midi)
   )
 
 ;;; Menu Support
@@ -414,8 +458,20 @@ command."
             [ "Region" LilyPond-command-select-region
               :keys "C-c C-r" :style radio
               :selected (eq LilyPond-command-current 'LilyPond-command-region) ]))
-         (let ((file 'LilyPond-command-on-current))
-           (mapcar 'LilyPond-command-menu-entry LilyPond-command-alist))))
+;        (let ((file 'LilyPond-command-on-current))
+;          (mapcar 'LilyPond-command-menu-entry LilyPond-command-alist))
+;;; Some kind of mapping which includes :keys might be more elegant
+         '([ "LilyPond" (LilyPond-command (LilyPond-command-menu "ViewPS") 'LilyPond-master-file) ])
+         '([ "TeX" (LilyPond-command (LilyPond-command-menu "TeX") 'LilyPond-master-file) ])
+         '([ "2Dvi" (LilyPond-command (LilyPond-command-menu "2Dvi") 'LilyPond-master-file) :keys "C-c C-d"])
+         '([ "2PS" (LilyPond-command (LilyPond-command-menu "2PS") 'LilyPond-master-file) :keys "C-c C-f"])
+         '([ "Book" (LilyPond-command (LilyPond-command-menu "Book") 'LilyPond-master-file) ])
+         '([ "LaTeX" (LilyPond-command (LilyPond-command-menu "LaTeX") 'LilyPond-master-file) ])
+         '([ "SmartView" (LilyPond-command (LilyPond-command-menu "SmartView") 'LilyPond-master-file) :keys "C-c C-s"])
+         '([ "View" (LilyPond-command (LilyPond-command-menu "View") 'LilyPond-master-file) :keys "C-c C-v"])
+         '([ "ViewPS" (LilyPond-command (LilyPond-command-menu "ViewPS") 'LilyPond-master-file) :keys "C-c C-p"])
+         '([ "Midi" (LilyPond-command (LilyPond-command-menu "Midi") 'LilyPond-master-file) :keys "C-c C-m"])
+  ))
 
 
 (defconst LilyPond-imenu-generic-re "^\\([a-zA-Z_][a-zA-Z0-9_]*\\) *="
@@ -438,7 +494,7 @@ command."
 (defun LilyPond-command-select-region ()
   (interactive)
   (message "Next command will be on the region")
-  (setq LilyPond-command-current 'LilPond-command-region))
+  (setq LilyPond-command-current 'LilyPond-command-region))
 
 (defun LilyPond-command-menu (name)
   ;; Execute LilyPond-command-alist NAME from a menu.