X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mudela-mode.el;h=b059317a69ebb51186b0e96464d2d981fe1ffe81;hb=59e4ae99bad964d00dc167919779301c5ec2a535;hp=2bbc8bbddc35a8a9a2f768aba18d3d87a3d36c64;hpb=6ae532ffb4350961d3901a42b67d1db620f925a5;p=lilypond.git diff --git a/mudela-mode.el b/mudela-mode.el index 2bbc8bbddc..b059317a69 100644 --- a/mudela-mode.el +++ b/mudela-mode.el @@ -30,16 +30,25 @@ ;; * 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" "accidentals" "break" "bar" "cadenza" - "clef" "cm" "consists" "contains" "duration" "absdynamic" - "in" "translator" "type" "lyric" "key" "maininput" "notes" - "musical_pitch" "time" "midi" "mm" "header" - "notenames" "octave" "output" "partial" "paper" "plet" - "property" "pt" "shape" "relative" "include" "score" - "script" "skip" "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 "\\|"))) @@ -63,28 +72,10 @@ (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 @@ -97,8 +88,8 @@ (mapcar (function (lambda (x) (modify-syntax-entry (car x) (cdr x) mu-mode-syntax-table))) - '(( ?\( . "()" ) ( ?\) . ")(" ) - ( ?\[ . "(]" ) ( ?\] . ")[" ) + '(( ?\( . "." ) ( ?\) . "." ) + ( ?\[ . "." ) ( ?\] . "." ) ( ?\{ . "(}" ) ( ?\} . "){" ) ( ?\< . "(>" )( ?\> . ")>") ( ?\$ . "." ) ( ?\% . "." ) ( ?\& . "." ) @@ -118,9 +109,6 @@ ) -(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.") @@ -137,49 +125,52 @@ (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 "%") + + (make-local-variable 'comment-start-skip) + (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) - (setq comment-end "\n" - comment-start "%" - comment-start-skip "%{? *" - block-comment-start "%{" - block-comment-end "%}" - ) - (make-local-variable 'comment-end) - (make-local-variable 'comment-start-skip) - (setf comment-start-skip "%{") - (make-local-variable 'comment-column) (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-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 - (run-hooks 'mudela-mode-hook) -) + (run-hooks 'mudela-mode-hook)) (defun mu-keep-region-active () @@ -191,17 +182,12 @@ (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))) -(defconst mu-version "0.0.1" - "`mudela-mode' version number.") -(defconst mu-help-address "hanwen@cs.uu.nl" - "Address accepting submission of bug reports.") - (defun mu-version () "Echo the current version of `mudela-mode' in the minibuffer." (interactive)