;; package or as a separate Emacs Lisp package.
;; Installation:
-;;
-;; Install this file (meta-mode.el) in your personal or system-wide
-;; Emacs Lisp directory and add these lines to your startup files:
-;;
-;; (autoload 'metafont-mode "meta-mode" "Metafont editing mode." t)
-;; (autoload 'metapost-mode "meta-mode" "MetaPost editing mode." t)
-;;
-;; (setq auto-mode-alist
-;; (append '(("\\.mf\\'" . metafont-mode)
-;; ("\\.mp\\'" . metapost-mode)) auto-mode-alist))
;;
;; An interface to running Metafont or MetaPost as a shell process
;; from within Emacs is currently under development as a separate
(require 'easymenu)
+(defgroup meta-font nil
+ "Major mode for editing Metafont or MetaPost sources."
+ :group 'languages)
+
;;; Fontification.
(defvar meta-font-lock-keywords
(cons (concat "\\<" input-keywords "\\>"
"[ \t]+\\(\\sw+\\)")
'((1 font-lock-keyword-face)
- (2 font-lock-reference-face)))
+ (2 font-lock-constant-face)))
;; embedded Metafont/MetaPost code in comments
(cons "|\\([^|]+\\)|"
- '(1 font-lock-reference-face t))
+ '(1 font-lock-constant-face t))
))
"Default expressions to highlight in Metafont or MetaPost mode.")
\f
;;; Indentation.
-(defvar meta-indent-level 2
- "*Indentation of begin-end blocks in Metafont or MetaPost mode.")
+(defcustom meta-indent-level 2
+ "*Indentation of begin-end blocks in Metafont or MetaPost mode."
+ :type 'integer
+ :group 'meta-font)
-(defvar meta-left-comment-regexp "%%+"
- "*Regexp matching comments that should be placed on the left margin.")
+(defcustom meta-left-comment-regexp "%%+"
+ "*Regexp matching comments that should be placed on the left margin."
+ :type 'regexp
+ :group 'meta-font)
-(defvar meta-right-comment-regexp nil
- "*Regexp matching comments that should be placed to the right margin.")
+(defcustom meta-right-comment-regexp nil
+ "*Regexp matching comments that should be placed to the right margin."
+ :type '(choice regexp
+ (const :tag "None" nil))
+ :group 'meta-font)
-(defvar meta-ignore-comment-regexp "%[^%]"
- "*Regexp matching comments that whose indentation should not be touched.")
+(defcustom meta-ignore-comment-regexp "%[^%]"
+ "*Regexp matching comments that whose indentation should not be touched."
+ :type 'regexp
+ :group 'meta-font)
-(defvar meta-begin-environment-regexp
+(defcustom meta-begin-environment-regexp
(concat "\\(begin\\(char\\|fig\\|gr\\(aph\\|oup\\)\\|logochar\\)\\|"
"def\\|for\\(\\|ever\\|suffixes\\)\\|if\\|mode_def\\|"
"primarydef\\|secondarydef\\|tertiarydef\\|vardef\\)")
- "*Regexp matching the beginning of environments to be indented.")
+ "*Regexp matching the beginning of environments to be indented."
+ :type 'regexp
+ :group 'meta-font)
-(defvar meta-end-environment-regexp
+(defcustom meta-end-environment-regexp
(concat "\\(end\\(char\\|def\\|f\\(ig\\|or\\)\\|gr\\(aph\\|oup\\)\\)"
"\\|fi\\)")
- "*Regexp matching the end of environments to be indented.")
+ "*Regexp matching the end of environments to be indented."
+ :type 'regexp
+ :group 'meta-font)
-(defvar meta-within-environment-regexp
+(defcustom meta-within-environment-regexp
; (concat "\\(e\\(lse\\(\\|if\\)\\|xit\\(if\\|unless\\)\\)\\)")
(concat "\\(else\\(\\|if\\)\\)")
- "*Regexp matching keywords within environments not to be indented.")
+ "*Regexp matching keywords within environments not to be indented."
+ :type 'regexp
+ :group 'meta-font)
(defun meta-comment-indent ()
\f
;;; Editing commands.
-(defvar meta-begin-defun-regexp
+(defcustom meta-begin-defun-regexp
(concat "\\(begin\\(char\\|fig\\|logochar\\)\\|def\\|mode_def\\|"
"primarydef\\|secondarydef\\|tertiarydef\\|vardef\\)")
- "*Regexp matching beginning of defuns in Metafont or MetaPost mode.")
+ "*Regexp matching beginning of defuns in Metafont or MetaPost mode."
+ :type 'regexp
+ :group 'meta-font)
-(defvar meta-end-defun-regexp
+(defcustom meta-end-defun-regexp
(concat "\\(end\\(char\\|def\\|fig\\)\\)")
- "*Regexp matching the end of defuns in Metafont or MetaPost mode.")
+ "*Regexp matching the end of defuns in Metafont or MetaPost mode."
+ :type 'regexp
+ :group 'meta-font)
(defun meta-beginning-of-defun (&optional arg)
\f
;;; Hook variables.
-(defvar meta-mode-load-hook nil
- "*Hook evaluated when first loading Metafont or MetaPost mode.")
-
-(defvar meta-common-mode-hook nil
- "*Hook evaluated by both `metafont-mode' and `metapost-mode'.")
-
-(defvar metafont-mode-hook nil
- "*Hook evaluated by `metafont-mode' after `meta-common-mode-hook'.")
-(defvar metapost-mode-hook nil
- "*Hook evaluated by `metapost-mode' after `meta-common-mode-hook'.")
+(defcustom meta-mode-load-hook nil
+ "*Hook evaluated when first loading Metafont or MetaPost mode."
+ :type 'hook
+ :group 'meta-font)
+
+(defcustom meta-common-mode-hook nil
+ "*Hook evaluated by both `metafont-mode' and `metapost-mode'."
+ :type 'hook
+ :group 'meta-font)
+
+(defcustom metafont-mode-hook nil
+ "*Hook evaluated by `metafont-mode' after `meta-common-mode-hook'."
+ :type 'hook
+ :group 'meta-font)
+(defcustom metapost-mode-hook nil
+ "*Hook evaluated by `metapost-mode' after `meta-common-mode-hook'."
+ :type 'hook
+ :group 'meta-font)
\f