Function: m2-mode

m2-mode is an autoloaded, interactive and byte-compiled function defined in modula2.el.gz.

Signature

(m2-mode)

Documentation

This is a mode intended to support program development in Modula-2.

All control constructs of Modula-2 can be reached by typing C-c followed by the first character of the construct.
  C-c b (m2-begin) begin C-c c (m2-case) case
  C-c d (m2-definition) definition C-c e (m2-else) else
  C-c f (m2-for) for C-c h (m2-header) header
  C-c i (m2-if) if C-c m (m2-module) module
  C-c l (m2-loop) loop C-c o (m2-or) or
  C-c p (m2-procedure) procedure Control-c Control-w with
  C-c r (m2-record) record C-c s (m2-stdio) stdio
  C-c t (m2-type) type C-c u (m2-until) until
  C-c v (m2-var) var C-c w (m2-while) while
  C-c x (m2-export) export C-c y (m2-import) import
  C-c { (m2-begin-comment) begin-comment C-c } (m2-end-comment) end-comment
  C-c C-z (suspend-emacs) suspend Emacs C-c C-t (m2-toggle) toggle
  C-c C-c (m2-compile) compile M-x m2-next-error (m2-next-error) next-error
  C-c C-l (m2-link) link

   m2-indent controls the number of spaces for each indentation.
   m2-compile-command holds the command to compile a Modula-2 program.
   m2-link-command holds the command to link a Modula-2 program.

In addition to any hooks its parent mode prog-mode might have run, this mode runs the hook m2-mode-hook, as the final or penultimate step during initialization.

Key Bindings

Aliases

modula-2-mode

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/modula2.el.gz
;;;###autoload
(define-derived-mode m2-mode prog-mode "Modula-2"
  "This is a mode intended to support program development in Modula-2.
All control constructs of Modula-2 can be reached by typing C-c
followed by the first character of the construct.
\\<m2-mode-map>
  \\[m2-begin] begin         \\[m2-case] case
  \\[m2-definition] definition    \\[m2-else] else
  \\[m2-for] for           \\[m2-header] header
  \\[m2-if] if            \\[m2-module] module
  \\[m2-loop] loop          \\[m2-or] or
  \\[m2-procedure] procedure     Control-c Control-w with
  \\[m2-record] record        \\[m2-stdio] stdio
  \\[m2-type] type          \\[m2-until] until
  \\[m2-var] var           \\[m2-while] while
  \\[m2-export] export        \\[m2-import] import
  \\[m2-begin-comment] begin-comment \\[m2-end-comment] end-comment
  \\[suspend-emacs] suspend Emacs     \\[m2-toggle] toggle
  \\[m2-compile] compile           \\[m2-next-error] next-error
  \\[m2-link] link

   `m2-indent' controls the number of spaces for each indentation.
   `m2-compile-command' holds the command to compile a Modula-2 program.
   `m2-link-command' holds the command to link a Modula-2 program."
  (setq-local paragraph-start (concat "$\\|" page-delimiter))
  (setq-local paragraph-separate paragraph-start)
  (setq-local paragraph-ignore-fill-prefix t)
  (setq-local comment-start "(* ")
  (setq-local comment-end " *)")
  (setq-local comment-start-skip "\\(?:(\\*+\\|//+\\) *")
  (setq-local parse-sexp-ignore-comments t)
  (setq-local font-lock-defaults
	'((m3-font-lock-keywords
	   m3-font-lock-keywords-1 m3-font-lock-keywords-2)
	  nil nil ((?_ . "w") (?. . "w") (?< . ". 1") (?> . ". 4")) nil
	  ))
  (smie-setup m2-smie-grammar #'m2-smie-rules
              :forward-token #'m2-smie-forward-token
              :backward-token #'m2-smie-backward-token))