]> git.donarmstrong.com Git - lilypond.git/blobdiff - mudela-mode.el
patch::: 1.3.17.jcn1
[lilypond.git] / mudela-mode.el
index f2c879d4288aa0e57165eef2824e2fae329887cb..b059317a69ebb51186b0e96464d2d981fe1ffe81 100644 (file)
 ;; * fontlock: \melodic \melodic
 ;; 
 
+(defconst mu-version "1.2.16-dk1"
+  "`mudela-mode' version number.")
+
+(defconst mu-help-address "hanwen@cs.uu.nl"
+  "Address accepting submission of bug reports.")
+
 (defconst mudela-font-lock-keywords
-  (let* ((keywords '(
-                  "accepts" "break" "bar" "cadenza" "clear" "clef" "cm" "consists" "contains"
-                  "duration" "absdynamic" "in" "translator" "type" "lyric" "key"
-                  "maininput" "melodic" "musical_pitch" "meter" "midi" "mm" "multi" "header"
-                  "notenames" "octave" "output" "partial" "paper" "plet" "property" "pt" "shape"
-                  "include"
-                  "score" "script" "skip" "staff" "table" "spandynamic" "symboltables"
-                  "tempo" "texid" "textstyle" "transpose" "version" "grouping"
-                  ))
+  (let* ((keywords '("spanrequest" "simultaneous" "sequential" "accepts"
+                    "alternative" "bar" "breathe"
+                    "cadenza" "chordmodifiers" "chords" "clef" "cm" "consists"
+                    "consistsend" "context"
+                    "duration" "font" "grace" "header" "in" "lyrics"
+                    "key" "keysignature" "mark" "musicalpitch"
+                    "time" "times" "midi" "mm" "name" "notenames"
+                    "notes" "partial" "paper" "penalty" "property" "pt"
+                    "relative" "remove" "repeat" "repetitions" "addlyrics"
+                    "scm" "scmfile" "score" "script"
+                    "shape" "skip" "textscript" "tempo" "translator" "transpose"
+                    "type" "version" 
+                    ))
        (kwregex (mapconcat (lambda (x) (concat "\\\\" x))  keywords "\\|")))
 
     (list 
-     (cons (concat ".\\(" kwregex "\\)[^a-zA-Z]") 1)
-     (cons (concat "^\\(" kwregex "\\)[^a-zA-Z]") 1)
-     '(".\\(\\\\[a-zA-Z][a-zA-Z]*\\)" 1 font-lock-variable-name-face)
-     '("^[\t ]*\\([a-zA-Z][_a-zA-Z]*\\) *=" 1 font-lock-variable-name-face)     
+      (concat ".\\(" kwregex "\\)[^a-zA-Z]")
+      (concat "^\\(" kwregex "\\)[^a-zA-Z]")
+      '(".\\(\\\\[a-zA-Z][a-zA-Z]*\\)" 1 font-lock-variable-name-face)
+      '("^[\t ]*\\([a-zA-Z][_a-zA-Z]*\\) *=" 1 font-lock-variable-name-face)     
     ))
   "Additional expressions to highlight in Mudela mode.")
 
 (defvar mu-mode-map ()
   "Keymap used in `mudela-mode' buffers.")
 
-(defun mu-newline-and-indent ()
-  (interactive)
-  (newline)
-  (indent-relative-maybe)
-  "Newline and copy previous indentation")
-
 (if mu-mode-map
     ()
   (setq mu-mode-map (make-sparse-keymap))
-
-  (mapcar (function (lambda (key)
-                     (define-key
-                       mu-mode-map key 'mu-newline-and-indent)))
-   (where-is-internal 'newline-and-indent))
-
-  (mapcar (function
-          (lambda (x)
-            (define-key mu-mode-map (car x) (cdr x))))
-         '(("\C-c\C-c"  . mu-foo-bar)
-           ))
-  ;; should do all keybindings this way
-  (define-key mu-mode-map [RET] 'mu-newline-and-indent)
+  ;; (define-key mu-mode-map "\C-c\C-c" 'mu-foo-bar)
   ) 
 
 (defvar mu-mode-syntax-table nil
@@ -96,8 +88,8 @@
   (mapcar (function
           (lambda (x) (modify-syntax-entry
                        (car x) (cdr x) mu-mode-syntax-table)))
-         '(( ?\( . "()" ) ( ?\) . ")(" )
-           ( ?\[ . "(]" ) ( ?\] . ")[" )
+         '(( ?\( . "." ) ( ?\) . "." )
+           ( ?\[ . "." ) ( ?\] . "." )
            ( ?\{ . "(}" ) ( ?\} . "){" )
            ( ?\< . "(>" )( ?\> . ")>") 
            ( ?\$ . "." ) ( ?\% . "." ) ( ?\& . "." )
            ( ?\_ . "." )       
            ( ?\' . "w")        
            ( ?\" . "\"" )
-           ( ?\% . "<")        
+           ( ?\% . "<")
            ( ?\n . ">")
 
 ; FIXME
 
   )    
 
-(defconst mu-stringlit-re
-   "\"\\([^\"\n\\]\\|\\\\.\\)*\""      ; double-quoted
-  "Regexp matching a Mudela string literal.")
-
-
-(defconst mu-blank-or-comment-re "[ \t]*\\($\\|%\\)"
-  "Regexp matching blank or comment lines.")
-
 (defconst mu-imenu-generic-re "^\\([a-zA-Z_][a-zA-Z0-9_]*\\) *="
   "Regexp matching Identifier definitions.")
 
 
 (defun mudela-mode ()
   "Major mode for editing Mudela files."
-
   (interactive)
   ;; set up local variables
   (kill-all-local-variables)
+
   (make-local-variable 'font-lock-defaults)
+  (setq font-lock-defaults '(mudela-font-lock-keywords))
+
   (make-local-variable 'paragraph-separate)
+  (setq paragraph-separate "^[ \t]*$")
+
   (make-local-variable 'paragraph-start)
-  (make-local-variable 'require-final-newline)
+  (setq        paragraph-start "^[ \t]*$")
+
   (make-local-variable 'comment-start)
-  (setq comment-start "% ")
-  (setq comment-end "")
-  (make-local-variable 'comment-end)
+  (setq comment-start "%")
+
   (make-local-variable 'comment-start-skip)
-  (setf comment-start-skip "%{")
-  (make-local-variable 'comment-column)
+  (setq comment-start-skip "%{? *")
+
+  (make-local-variable 'comment-end)
+  (setq comment-end "\n")
+
+  (make-local-variable 'block-comment-start)
+  (setq block-comment-start "%{")
+
+  (make-local-variable 'block-comment-end)  
+  (setq block-comment-end   "%}")
+
+  ;; (make-local-variable 'comment-column)
+  ;; (setq comment-column 40)
+
   (make-local-variable 'imenu-generic-expression)
   (setq imenu-generic-expression mu-imenu-generic-expression)
+
   (make-local-variable 'indent-line-function)
+  (setq indent-line-function 'indent-relative-maybe)
  
   ;;
   (set-syntax-table mu-mode-syntax-table)
-  (setq major-mode             'mudela-mode
-       mode-name              "Mudela"
-       local-abbrev-table     mudela-mode-abbrev-table
-       font-lock-defaults     '(mudela-font-lock-keywords)
-       paragraph-separate     "^[ \t]*$"
-       paragraph-start        "^[ \t]*$"
-       require-final-newline  t
-       comment-start          "% "
-       comment-start-skip     "% *"
-       comment-column         40
-       indent-line-function    'indent-relative-maybe
-       )
+  (setq major-mode 'mudela-mode)
+  (setq mode-name "Mudela")
+  (setq local-abbrev-table mudela-mode-abbrev-table)
   (use-local-map mu-mode-map)
 
   ;; run the mode hook. mu-mode-hook use is deprecated
-  (if mudela-mode-hook
-      (run-hooks 'mudela-mode-hook)
-    (run-hooks 'mu-mode-hook)))
+  (run-hooks 'mudela-mode-hook))
+
 
 (defun mu-keep-region-active ()
   ;; do whatever is necessary to keep the region active in XEmacs.
        (setq zmacs-region-stays t)))
 
 
-(defun mu-comment-region (beg end &optional arg)
-  "Like `comment-region' but uses double hash (`#') comment starter."
-  (interactive "r\nP")
-  (let ((comment-start mu-block-comment-prefix))
-    (comment-region beg end arg)))
+;;(defun mu-comment-region (beg end &optional arg)
+;;  "Like `comment-region' but uses double hash (`#') comment starter."
+;;  (interactive "r\nP")
+;;  (let ((comment-start mu-block-comment-prefix))
+;;    (comment-region beg end arg)))
 \f
-(defconst mu-version "0.0.1"
-  "`mudela-mode' version number.")
-(defconst mu-help-address "hanwen@cs.ruu.nl"
-  "Address accepting submission of bug reports.")
-
 (defun mu-version ()
   "Echo the current version of `mudela-mode' in the minibuffer."
   (interactive)