]> git.donarmstrong.com Git - lilypond.git/blobdiff - lilypond-mode.el
patch::: 1.3.128.jcn4
[lilypond.git] / lilypond-mode.el
index 5f570c77fd06d1743d234fc7e5d3828623c45619..15dc21ae6e24dc4aa4317b9b17a509399bfcb961 100644 (file)
@@ -7,6 +7,12 @@
 
 ;;; Inspired on auctex
 
+;;;
+;;; Add this to your .emacs.el
+;;;     (load-library "lilypond-mode.el")
+;;;     (setq auto-mode-alist
+;;;      (append '(("\\.ly$" . LilyPond-mode) auto-mode-alist)))
+;;; 
 
 (load-library "lilypond-font-lock")
 
@@ -99,7 +105,11 @@ in LilyPond-include-path."
 
 
 ;; Should check whether in command-alist?
-(defvar LilyPond-command-default "LilyPond")
+(defcustom LilyPond-command-default "LilyPond"
+  "Default command. Must identify a member of LilyPond-command-alist."
+
+  :group 'LilyPond
+  :type 'string)
 ;;;(make-variable-buffer-local 'LilyPond-command-last)
 
 (defvar LilyPond-command-current 'LilyPond-command-master)
@@ -110,18 +120,28 @@ in LilyPond-include-path."
 ;; variable instead of quering the user. 
 (defvar LilyPond-command-force nil)
 
+(defcustom LilyPond-xdvi-command "xdvik"
+  "Command used to display DVI files."
+
+  :group 'LilyPond
+  :type 'string)
 
 ;; This is the major configuration variable.
 (defcustom LilyPond-command-alist
-  '(
+  `(
     ("LilyPond" . ("lilypond %s" . "TeX"))
     ("TeX" . ("tex '\\nonstopmode\\input %t'" . "View"))
-    
+
+    ("2Dvi" . ("ly2dvi %s" . "View"))
+
+    ("Book" . ("lilypond-book %x" . "LaTeX"))
+    ("LaTeX" . ("latex '\\nonstopmode\\input %l'" . "View"))
+
     ;; point-n-click (arg: exits upop USR1)
     ("SmartView" . ("xdvi %d" . "LilyPond"))
     
     ;; refreshes when kicked USR1
-    ("View" . ("xdvik %d" . "LilyPond"))
+    ("View" . (,(concat LilyPond-xdvi-command " %d") . "LilyPond"))
     )
 
   "AList of commands to execute on the current document.
@@ -133,15 +153,11 @@ success.  The expansion is done using the information found in
 LilyPond-expand-list.
 "
   :group 'LilyPond
-  :type '(repeat (group (string :tag "Name")
+  :type '(repeat (cons :tag "Command Item"
+                      (string :tag "Key")
+                      (cons :tag "How"
                        (string :tag "Command")
-                       (choice :tag "How"
-                               :value LilyPond-run-command
-                               (function-item LilyPond-run-command)
-                               (function-item LilyPond-run-LilyPond)
-                               (function :tag "Other"))
-                       (boolean :tag "Prompt")
-                       (sexp :format "End\n"))))
+                       (string :tag "Next Key")))))
 
 ;; drop this?
 (defcustom LilyPond-file-extensions '(".ly" ".sly" ".fly")
@@ -156,20 +172,20 @@ LilyPond-expand-list.
     ("%t" . ".tex")
     ("%d" . ".dvi")
     ("%p" . ".ps")
+    ("%l" . ".latex")
+    ("%x" . ".tely")
     )
     
   "Alist of expansion strings for LilyPond command names."
   :group 'LilyPond
-  :type '(repeat (group (string :tag "Key")
-                       (sexp :tag "Expander")
-                       (repeat :inline t
-                               :tag "Arguments"
-                               (sexp :format "%v")))))
+  :type '(repeat (cons :tag "Alist item"
+                 (string :tag "Symbol")
+                 (string :tag "Expansion")))) 
 
 
 (defcustom LilyPond-command-Show "View"
   "*The default command to show (view or print) a LilyPond file.
-Must be the car of an entry in LilyPond-command-alist."
+Must be the car of an entry in `LilyPond-command-alist'."
   :group 'LilyPond
   :type 'string)
   (make-variable-buffer-local 'LilyPond-command-Show)
@@ -324,10 +340,10 @@ command."
 (if LilyPond-mode-map
     ()
   (setq LilyPond-mode-map (make-sparse-keymap))
-  (define-key LilyPond-mode-map "\C-c\C-c" 'LilyPond-command-master)
   (define-key LilyPond-mode-map "\C-c\C-r" 'LilyPond-command-region)
   (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)
   )
 
 ;;; Menu Support
@@ -392,7 +408,18 @@ command."
     (funcall LilyPond-command-current)))
 
 (defun LilyPond-mode ()
-  "Major mode for editing LilyPond music files."
+  "Major mode for editing LilyPond music files.
+
+This mode knows about LilyPond keywords and line comments, not about
+indentation or block comments.  It features easy compilation, error
+finding and viewing of a LilyPond source buffer or region.
+
+COMMANDS
+\\{LilyPond-mode-map}
+VARIABLES
+
+LilyPond-command-alist\t\talist from name to command
+LilyPond-xdvi-command\t\tcommand to display dvi files -- bit superfluous"
   (interactive)
   ;; set up local variables
   (kill-all-local-variables)