41 |
;; package or as a separate Emacs Lisp package. |
;; package or as a separate Emacs Lisp package. |
42 |
|
|
43 |
;; Installation: |
;; Installation: |
44 |
;; |
;; |
45 |
;; An interface to running Metafont or MetaPost as a shell process |
;; An interface to running Metafont or MetaPost as a shell process |
46 |
;; from within Emacs is currently under development as a separate |
;; from within Emacs is currently under development as a separate |
47 |
;; Emacs Lisp package (meta-buf.el). In order to have that package |
;; Emacs Lisp package (meta-buf.el). In order to have that package |
48 |
;; loaded automatically when first entering Metafont or MetaPost mode, |
;; loaded automatically when first entering Metafont or MetaPost mode, |
49 |
;; you might use the load-hook provided in this package by adding |
;; you might use the load-hook provided in this package by adding |
50 |
;; these lines to your startup file: |
;; these lines to your startup file: |
51 |
;; |
;; |
52 |
;; (add-hook 'meta-mode-load-hook |
;; (add-hook 'meta-mode-load-hook |
53 |
;; '(lambda () (require 'meta-buf))) |
;; '(lambda () (require 'meta-buf))) |
54 |
;; |
;; |
55 |
;; The add-on package loaded this way may in turn make use of the |
;; The add-on package loaded this way may in turn make use of the |
72 |
;; global-font-lock-mode or font-lock-support-mode, you can also |
;; global-font-lock-mode or font-lock-support-mode, you can also |
73 |
;; activate fontification in Metafont and/or MetaPost mode by adding |
;; activate fontification in Metafont and/or MetaPost mode by adding |
74 |
;; the following lines to your startup file: |
;; the following lines to your startup file: |
75 |
;; |
;; |
76 |
;; (add-hook 'meta-common-mode-hook 'turn-on-font-lock) |
;; (add-hook 'meta-common-mode-hook 'turn-on-font-lock) |
77 |
;; (add-hook 'meta-common-mode-hook 'turn-on-lazy-lock) |
;; (add-hook 'meta-common-mode-hook 'turn-on-lazy-lock) |
78 |
|
|
109 |
;; Improved and debbuged indentation function. |
;; Improved and debbuged indentation function. |
110 |
;; v 0.4 -- 1997/02/18 UV Added functions to indent regions for M-C-q, |
;; v 0.4 -- 1997/02/18 UV Added functions to indent regions for M-C-q, |
111 |
;; also added a preliminary mode-specific menu. |
;; also added a preliminary mode-specific menu. |
112 |
;; v 0.5 -- 1997/02/19 UV Added functions to skip to next or previous |
;; v 0.5 -- 1997/02/19 UV Added functions to skip to next or previous |
113 |
;; defun and to re-indent or comment-out defuns. |
;; defun and to re-indent or comment-out defuns. |
114 |
;; v 0.6 -- 1997/02/20 UV More debugging, testing and clean-up. |
;; v 0.6 -- 1997/02/20 UV More debugging, testing and clean-up. |
115 |
;; v 0.7 -- 1997/02/22 UV Use easymenu to define mode-specific menu. |
;; v 0.7 -- 1997/02/22 UV Use easymenu to define mode-specific menu. |
247 |
'((1 font-lock-keyword-face) |
'((1 font-lock-keyword-face) |
248 |
(2 font-lock-constant-face))) |
(2 font-lock-constant-face))) |
249 |
;; embedded Metafont/MetaPost code in comments |
;; embedded Metafont/MetaPost code in comments |
250 |
(cons "|\\([^|]+\\)|" |
(cons "|\\([^|]+\\)|" |
251 |
'(1 font-lock-constant-face t)) |
'(1 font-lock-constant-face t)) |
252 |
)) |
)) |
253 |
"Default expressions to highlight in Metafont or MetaPost mode.") |
"Default expressions to highlight in Metafont or MetaPost mode.") |
286 |
;; grep '^primitive' texk-7.0/web2c/{mf,mp}.web |\ |
;; grep '^primitive' texk-7.0/web2c/{mf,mp}.web |\ |
287 |
;; sed 's/primitive(\("[a-zA-Z]*"\).*/\1/' > {mf,mp}_prim.list |
;; sed 's/primitive(\("[a-zA-Z]*"\).*/\1/' > {mf,mp}_prim.list |
288 |
;; |
;; |
289 |
;; grep '\(let\|def\|vardef\|primarydef\|secondarydef\|tertiarydef\)' |
;; grep '\(let\|def\|vardef\|primarydef\|secondarydef\|tertiarydef\)' |
290 |
;; texmf/meta{font,post}/plain.{mf,mp} > {mf,mp}_plain.list |
;; texmf/meta{font,post}/plain.{mf,mp} > {mf,mp}_plain.list |
291 |
|
|
292 |
(defconst meta-common-primitives-list |
(defconst meta-common-primitives-list |
293 |
'("ASCII" "addto" "also" "and" "angle" "atleast" "batchmode" |
'("ASCII" "addto" "also" "and" "angle" "atleast" "batchmode" |
294 |
"begingroup" "boolean" "boundarychar" "char" "charcode" "chardp" |
"begingroup" "boolean" "boundarychar" "char" "charcode" "chardp" |
295 |
"charexists" "charext" "charht" "charic" "charlist" "charwd" |
"charexists" "charext" "charht" "charic" "charlist" "charwd" |
317 |
"transform" "transformed" "true" "turningnumber" "uniformdeviate" |
"transform" "transformed" "true" "turningnumber" "uniformdeviate" |
318 |
"unknown" "until" "vardef" "warningcheck" "withpen" "xpart" |
"unknown" "until" "vardef" "warningcheck" "withpen" "xpart" |
319 |
"xscaled" "xxpart" "xypart" "year" "ypart" "yscaled" "yxpart" |
"xscaled" "xxpart" "xypart" "year" "ypart" "yscaled" "yxpart" |
320 |
"yypart" "zscaled") |
"yypart" "zscaled") |
321 |
"List of primitives common to Metafont and MetaPost.") |
"List of primitives common to Metafont and MetaPost.") |
322 |
|
|
323 |
(defconst metafont-primitives-list |
(defconst metafont-primitives-list |
324 |
'("at" "autorounding" "chardx" "chardy" "cull" "display" |
'("at" "autorounding" "chardx" "chardy" "cull" "display" |
325 |
"dropping" "fillin" "from" "granularity" "hppp" "inwindow" |
"dropping" "fillin" "from" "granularity" "hppp" "inwindow" |
326 |
"keeping" "numspecial" "openwindow" "proofing" "smoothing" |
"keeping" "numspecial" "openwindow" "proofing" "smoothing" |
328 |
"withweight" "xoffset" "yoffset") |
"withweight" "xoffset" "yoffset") |
329 |
"List of primitives only defined in Metafont.") |
"List of primitives only defined in Metafont.") |
330 |
|
|
331 |
(defconst metapost-primitives-list |
(defconst metapost-primitives-list |
332 |
'("arclength" "arctime" "bluepart" "bounded" "btex" "clip" |
'("arclength" "arctime" "bluepart" "bounded" "btex" "clip" |
333 |
"clipped" "color" "dashed" "dashpart" "etex" "filled" "fontpart" |
"clipped" "color" "dashed" "dashpart" "etex" "filled" "fontpart" |
334 |
"fontsize" "greenpart" "infont" "linecap" "linejoin" "llcorner" |
"fontsize" "greenpart" "infont" "linecap" "linejoin" "llcorner" |
338 |
"verbatimtex" "withcolor" "within" "write") |
"verbatimtex" "withcolor" "within" "write") |
339 |
"List of primitives only defined in MetaPost.") |
"List of primitives only defined in MetaPost.") |
340 |
|
|
341 |
(defconst meta-common-plain-macros-list |
(defconst meta-common-plain-macros-list |
342 |
'( "abs" "bot" "bye" "byte" "ceiling" "clear_pen_memory" |
'( "abs" "bot" "bye" "byte" "ceiling" "clear_pen_memory" |
343 |
"clearit" "clearpen" "clearxy" "counterclockwise" "cutdraw" "decr" |
"clearit" "clearpen" "clearxy" "counterclockwise" "cutdraw" "decr" |
344 |
"dir" "direction" "directionpoint" "div" "dotprod" "downto" "draw" |
"dir" "direction" "directionpoint" "div" "dotprod" "downto" "draw" |
353 |
"unitvector" "upto" "whatever") |
"unitvector" "upto" "whatever") |
354 |
"List of macros common to plain Metafont and MetaPost.") |
"List of macros common to plain Metafont and MetaPost.") |
355 |
|
|
356 |
(defconst metafont-plain-macros-list |
(defconst metafont-plain-macros-list |
357 |
'("beginchar" "change_width" "culldraw" "cullit" "cutoff" |
'("beginchar" "change_width" "culldraw" "cullit" "cutoff" |
358 |
"define_blacker_pixels" "define_corrected_pixels" |
"define_blacker_pixels" "define_corrected_pixels" |
359 |
"define_good_x_pixels" "define_good_y_pixels" |
"define_good_x_pixels" "define_good_y_pixels" |
370 |
"mode_proof" "mode_setup" "mode_smoke" "nodisplays" "notransforms" |
"mode_proof" "mode_setup" "mode_smoke" "nodisplays" "notransforms" |
371 |
"openit" "penrazor" "pensquare" "proofoffset" "proofrule" |
"openit" "penrazor" "pensquare" "proofoffset" "proofrule" |
372 |
"proofrulethickness" "screenchars" "screenrule" "screenstrokes" |
"proofrulethickness" "screenchars" "screenrule" "screenstrokes" |
373 |
"showit" "slantfont" "smode" "titlefont" "vround") |
"showit" "slantfont" "smode" "titlefont" "vround") |
374 |
"List of macros only defined in plain Metafont.") |
"List of macros only defined in plain Metafont.") |
375 |
|
|
376 |
(defconst metapost-plain-macros-list |
(defconst metapost-plain-macros-list |
377 |
'("arrowhead" "bbox" "beginfig" "buildcycle" "center" "cutafter" |
'("arrowhead" "bbox" "beginfig" "buildcycle" "center" "cutafter" |
378 |
"cutbefore" "dashpattern" "dotlabel" "dotlabels" "drawarrow" |
"cutbefore" "dashpattern" "dotlabel" "dotlabels" "drawarrow" |
379 |
"drawdblarrow" "drawoptions" "endfig" "image" "label" "off" "on" |
"drawdblarrow" "drawoptions" "endfig" "image" "label" "off" "on" |
380 |
"thelabel") |
"thelabel") |
381 |
"List of macros only defined in plain MetaPost.") |
"List of macros only defined in plain MetaPost.") |
382 |
|
|
383 |
(defconst metapost-graph-macros-list |
(defconst metapost-graph-macros-list |
384 |
'("augment" "auto.x" "auto.y" "autogrid" "begingraph" "endgraph" |
'("augment" "auto.x" "auto.y" "autogrid" "begingraph" "endgraph" |
385 |
"format" "frame" "gdata" "gdotlabel" "gdraw" "gdrawarrow" |
"format" "frame" "gdata" "gdotlabel" "gdraw" "gdrawarrow" |
386 |
"gdrawdblarrow" "gfill" "glabel" "grid" "itick" "otick" "plot" |
"gdrawdblarrow" "gfill" "glabel" "grid" "itick" "otick" "plot" |
387 |
"setcoords" "setrange") |
"setcoords" "setrange") |
388 |
"List of macros only defined in MetaPost \"graph\" package.") |
"List of macros only defined in MetaPost \"graph\" package.") |
389 |
|
|
390 |
(defconst metapost-boxes-macros-list |
(defconst metapost-boxes-macros-list |
391 |
'("boxit" "boxjoin" "bpath" "circleit" "drawboxed" "drawboxes" |
'("boxit" "boxjoin" "bpath" "circleit" "drawboxed" "drawboxes" |
392 |
"drawunboxed" "fixpos" "fixsize" "pic" "rboxit") |
"drawunboxed" "fixpos" "fixsize" "pic" "rboxit") |
393 |
"List of macros only defined in MetaPost \"boxes\" package.") |
"List of macros only defined in MetaPost \"boxes\" package.") |
413 |
(defvar meta-symbol-list nil |
(defvar meta-symbol-list nil |
414 |
"List of known symbols to complete in Metafont or MetaPost mode.") |
"List of known symbols to complete in Metafont or MetaPost mode.") |
415 |
|
|
416 |
(defvar meta-symbol-changed nil |
(defvar meta-symbol-changed nil |
417 |
"Flag indicating whether `meta-symbol-list' has been initialized.") |
"Flag indicating whether `meta-symbol-list' has been initialized.") |
418 |
|
|
419 |
(defvar meta-complete-list nil |
(defvar meta-complete-list nil |
517 |
;; utility function used in `meta-complete-symbol' |
;; utility function used in `meta-complete-symbol' |
518 |
(let ((pos (point))) |
(let ((pos (point))) |
519 |
(save-excursion |
(save-excursion |
520 |
(and (re-search-backward |
(and (re-search-backward |
521 |
regexp (if limit (max (point-min) (- (point) limit))) t) |
regexp (if limit (max (point-min) (- (point) limit))) t) |
522 |
(eq (match-end 0) pos))))) |
(eq (match-end 0) pos))))) |
523 |
|
|
585 |
(looking-at meta-left-comment-regexp)) |
(looking-at meta-left-comment-regexp)) |
586 |
(current-column) |
(current-column) |
587 |
(skip-chars-backward "\t ") |
(skip-chars-backward "\t ") |
588 |
(max (if (bolp) 0 (1+ (current-column))) |
(max (if (bolp) 0 (1+ (current-column))) |
589 |
comment-column))) |
comment-column))) |
590 |
|
|
591 |
(defun meta-indent-line () |
(defun meta-indent-line () |
605 |
"Return the indentation of current line of Metafont or MetaPost source." |
"Return the indentation of current line of Metafont or MetaPost source." |
606 |
(save-excursion |
(save-excursion |
607 |
(back-to-indentation) |
(back-to-indentation) |
608 |
(cond |
(cond |
609 |
;; Comments to the left margin. |
;; Comments to the left margin. |
610 |
((and meta-left-comment-regexp |
((and meta-left-comment-regexp |
611 |
(looking-at meta-left-comment-regexp)) |
(looking-at meta-left-comment-regexp)) |
615 |
(looking-at meta-right-comment-regexp)) |
(looking-at meta-right-comment-regexp)) |
616 |
comment-column) |
comment-column) |
617 |
;; Comments best left alone. |
;; Comments best left alone. |
618 |
((and meta-ignore-comment-regexp |
((and meta-ignore-comment-regexp |
619 |
(looking-at meta-ignore-comment-regexp)) |
(looking-at meta-ignore-comment-regexp)) |
620 |
(current-indentation)) |
(current-indentation)) |
621 |
;; Backindent at end of environments. |
;; Backindent at end of environments. |
622 |
((looking-at |
((looking-at |
623 |
(concat "\\<" meta-end-environment-regexp "\\>")) |
(concat "\\<" meta-end-environment-regexp "\\>")) |
624 |
(- (meta-indent-calculate-last) meta-indent-level)) |
(- (meta-indent-calculate-last) meta-indent-level)) |
625 |
;; Backindent at keywords within environments. |
;; Backindent at keywords within environments. |
626 |
((looking-at |
((looking-at |
627 |
(concat "\\<" meta-within-environment-regexp "\\>")) |
(concat "\\<" meta-within-environment-regexp "\\>")) |
628 |
(- (meta-indent-calculate-last) meta-indent-level)) |
(- (meta-indent-calculate-last) meta-indent-level)) |
629 |
(t (meta-indent-calculate-last))))) |
(t (meta-indent-calculate-last))))) |
645 |
(meta-indent-level-count) |
(meta-indent-level-count) |
646 |
(cond |
(cond |
647 |
;; Compensate for backindent at end of environments. |
;; Compensate for backindent at end of environments. |
648 |
((looking-at |
((looking-at |
649 |
(concat "\\<"meta-end-environment-regexp "\\>")) |
(concat "\\<"meta-end-environment-regexp "\\>")) |
650 |
meta-indent-level) |
meta-indent-level) |
651 |
;; Compensate for backindent within environments. |
;; Compensate for backindent within environments. |
652 |
((looking-at |
((looking-at |
653 |
(concat "\\<" meta-within-environment-regexp "\\>")) |
(concat "\\<" meta-within-environment-regexp "\\>")) |
654 |
meta-indent-level) |
meta-indent-level) |
655 |
(t 0))))) |
(t 0))))) |
660 |
(save-excursion |
(save-excursion |
661 |
(save-restriction |
(save-restriction |
662 |
(let ((count 0)) |
(let ((count 0)) |
663 |
(narrow-to-region |
(narrow-to-region |
664 |
(point) (save-excursion |
(point) (save-excursion |
665 |
(re-search-forward "[^\\\\\"]%\\|\n\\|\\'" nil t) |
(re-search-forward "[^\\\\\"]%\\|\n\\|\\'" nil t) |
666 |
(backward-char) (point))) |
(backward-char) (point))) |
669 |
(goto-char (match-beginning 0)) |
(goto-char (match-beginning 0)) |
670 |
(cond |
(cond |
671 |
;; Count number of begin-end keywords within line. |
;; Count number of begin-end keywords within line. |
672 |
((looking-at |
((looking-at |
673 |
(concat "\\<" meta-begin-environment-regexp "\\>")) |
(concat "\\<" meta-begin-environment-regexp "\\>")) |
674 |
(setq count (+ count meta-indent-level))) |
(setq count (+ count meta-indent-level))) |
675 |
((looking-at |
((looking-at |
676 |
(concat "\\<" meta-end-environment-regexp "\\>")) |
(concat "\\<" meta-end-environment-regexp "\\>")) |
677 |
(setq count (- count meta-indent-level))) |
(setq count (- count meta-indent-level))) |
678 |
;; Count number of open-close parentheses within line. |
;; Count number of open-close parentheses within line. |
679 |
((looking-at "(") |
((looking-at "(") |
680 |
(setq count (+ count meta-indent-level))) |
(setq count (+ count meta-indent-level))) |
685 |
|
|
686 |
|
|
687 |
|
|
|
;;; Filling paragraphs. |
|
|
|
|
|
(defun meta-fill-paragraph (&optional justify) |
|
|
"Like \\[fill-paragraph], but handle Metafont or MetaPost comments. |
|
|
If any part of the current line is a comment, fill the comment or the |
|
|
paragraph of it that point is in, preserving the comment's indentation |
|
|
and initial semicolons." |
|
|
(interactive "P") |
|
|
(let (has-comment ; Non-nil if line contains a comment. |
|
|
has-code-and-comment ; Non-nil if line contains code and a comment. |
|
|
comment-fill-prefix ; If has-comment, fill-prefix for the comment. |
|
|
) |
|
|
;; Figure out what kind of comment we are looking at. |
|
|
(save-excursion |
|
|
(beginning-of-line) |
|
|
(cond |
|
|
;; A line with nothing but a comment on it? |
|
|
((looking-at (concat "[ \t]*" comment-start-skip)) |
|
|
(setq has-comment t) |
|
|
(setq comment-fill-prefix |
|
|
(buffer-substring (match-beginning 0) (match-end 0)))) |
|
|
;; A line with some code, followed by a comment? |
|
|
((condition-case nil |
|
|
(save-restriction |
|
|
(narrow-to-region (point-min) |
|
|
(save-excursion (end-of-line) (point))) |
|
|
(while (not (looking-at (concat comment-start "\\|$"))) |
|
|
(skip-chars-forward (concat "^" comment-start "\n\"\\\\")) |
|
|
(cond |
|
|
((eq (char-after (point)) ?\\) (forward-char 2)) |
|
|
((eq (char-after (point)) ?\") (forward-sexp 1)))) |
|
|
(looking-at comment-start-skip)) |
|
|
(error nil)) |
|
|
(setq has-comment t |
|
|
has-code-and-comment t) |
|
|
(setq comment-fill-prefix |
|
|
(concat (make-string (/ (current-column) 8) ?\t) |
|
|
(make-string (% (current-column) 8) ?\ ) |
|
|
(buffer-substring (match-beginning 0) (match-end 0))))) |
|
|
)) |
|
|
(if (not has-comment) |
|
|
(fill-paragraph justify) |
|
|
;; Narrow to include only the comment, and then fill the region. |
|
|
(save-excursion |
|
|
(save-restriction |
|
|
(beginning-of-line) |
|
|
(narrow-to-region |
|
|
;; Find the first line we should include in the region to fill. |
|
|
(save-excursion |
|
|
(while (and (zerop (forward-line -1)) |
|
|
(looking-at (concat "^[ \t]*" comment-start)))) |
|
|
(or (looking-at (concat ".*" comment-start)) |
|
|
(forward-line 1)) |
|
|
(point)) |
|
|
;; Find the beginning of the first line past the region to fill. |
|
|
(save-excursion |
|
|
(while (progn (forward-line 1) |
|
|
(looking-at (concat "^[ \t]*" comment-start)))) |
|
|
(point))) |
|
|
(let* ((paragraph-start |
|
|
(concat paragraph-start "\\|[ \t%]*$")) |
|
|
(paragraph-separate |
|
|
(concat paragraph-start "\\|[ \t%]*$")) |
|
|
(paragraph-ignore-fill-prefix nil) |
|
|
(fill-prefix comment-fill-prefix) |
|
|
(after-line (if has-code-and-comment |
|
|
(save-excursion (forward-line 1) (point)))) |
|
|
(end (progn (forward-paragraph) |
|
|
(or (bolp) (newline 1)) |
|
|
(point))) |
|
|
(beg (progn (backward-paragraph) |
|
|
(if (eq (point) after-line) (forward-line -1)) |
|
|
(point))) |
|
|
(after-pos (save-excursion |
|
|
(goto-char beg) |
|
|
(if (not (looking-at fill-prefix)) |
|
|
(progn |
|
|
(re-search-forward comment-start-skip) |
|
|
(point))))) |
|
|
) |
|
|
(fill-region-as-paragraph beg end justify nil after-pos)) |
|
|
))) |
|
|
t)) |
|
|
|
|
|
|
|
|
|
|
688 |
;;; Editing commands. |
;;; Editing commands. |
689 |
|
|
690 |
(defcustom meta-begin-defun-regexp |
(defcustom meta-begin-defun-regexp |
703 |
|
|
704 |
(defun meta-beginning-of-defun (&optional arg) |
(defun meta-beginning-of-defun (&optional arg) |
705 |
"Move backward to beginnning of a defun in Metafont or MetaPost code. |
"Move backward to beginnning of a defun in Metafont or MetaPost code. |
706 |
With numeric argument, do it that many times. |
With numeric argument, do it that many times. |
707 |
Negative arg -N means move forward to Nth following beginning of defun. |
Negative arg -N means move forward to Nth following beginning of defun. |
708 |
Returns t unless search stops due to beginning or end of buffer." |
Returns t unless search stops due to beginning or end of buffer." |
709 |
(interactive "p") |
(interactive "p") |
710 |
(if (or (null arg) (= 0 arg)) (setq arg 1)) |
(if (or (null arg) (= 0 arg)) (setq arg 1)) |
711 |
(and arg (< arg 0) (not (eobp)) (forward-char 1)) |
(and arg (< arg 0) (not (eobp)) (forward-char 1)) |
712 |
(and (re-search-backward |
(and (re-search-backward |
713 |
(concat "\\<" meta-begin-defun-regexp "\\>") nil t arg) |
(concat "\\<" meta-begin-defun-regexp "\\>") nil t arg) |
714 |
(progn (goto-char (match-beginning 0)) |
(progn (goto-char (match-beginning 0)) |
715 |
(skip-chars-backward "%") |
(skip-chars-backward "%") |
716 |
(skip-chars-backward " \t") t))) |
(skip-chars-backward " \t") t))) |
717 |
|
|
718 |
(defun meta-end-of-defun (&optional arg) |
(defun meta-end-of-defun (&optional arg) |
719 |
"Move forward to end of a defun in Metafont or MetaPost code. |
"Move forward to end of a defun in Metafont or MetaPost code. |
720 |
With numeric argument, do it that many times. |
With numeric argument, do it that many times. |
721 |
Negative argument -N means move back to Nth preceding end of defun. |
Negative argument -N means move back to Nth preceding end of defun. |
722 |
Returns t unless search stops due to beginning or end of buffer." |
Returns t unless search stops due to beginning or end of buffer." |
723 |
(interactive "p") |
(interactive "p") |
840 |
() |
() |
841 |
(setq meta-mode-map (make-sparse-keymap)) |
(setq meta-mode-map (make-sparse-keymap)) |
842 |
(define-key meta-mode-map "\t" 'meta-indent-line) |
(define-key meta-mode-map "\t" 'meta-indent-line) |
843 |
(define-key meta-mode-map "\C-m" 'reindent-then-newline-and-indent) |
(define-key meta-mode-map "\C-m" 'reindent-then-newline-and-indent) |
844 |
;; Comment Paragraphs: |
;; Comment Paragraphs: |
845 |
; (define-key meta-mode-map "\M-a" 'backward-sentence) |
; (define-key meta-mode-map "\M-a" 'backward-sentence) |
846 |
; (define-key meta-mode-map "\M-e" 'forward-sentence) |
; (define-key meta-mode-map "\M-e" 'forward-sentence) |
864 |
(define-key meta-mode-map "\M-\t" 'meta-complete-symbol) |
(define-key meta-mode-map "\M-\t" 'meta-complete-symbol) |
865 |
;; Shell Commands: |
;; Shell Commands: |
866 |
; (define-key meta-mode-map "\C-c\C-c" 'meta-command-file) |
; (define-key meta-mode-map "\C-c\C-c" 'meta-command-file) |
867 |
; (define-key meta-mode-map "\C-c\C-k" 'meta-kill-job) |
; (define-key meta-mode-map "\C-c\C-k" 'meta-kill-job) |
868 |
; (define-key meta-mode-map "\C-c\C-l" 'meta-recenter-output) |
; (define-key meta-mode-map "\C-c\C-l" 'meta-recenter-output) |
869 |
) |
) |
870 |
|
|
871 |
(easy-menu-define |
(easy-menu-define |
872 |
meta-mode-menu meta-mode-map |
meta-mode-menu meta-mode-map |
873 |
"Menu used in Metafont or MetaPost mode." |
"Menu used in Metafont or MetaPost mode." |
874 |
(list "Meta" |
(list "Meta" |
877 |
"--" |
"--" |
878 |
["Indent Line" meta-indent-line t] |
["Indent Line" meta-indent-line t] |
879 |
["Indent Environment" meta-indent-defun t] |
["Indent Environment" meta-indent-defun t] |
880 |
["Indent Region" meta-indent-region |
["Indent Region" meta-indent-region |
881 |
:active (meta-mark-active)] |
:active (meta-mark-active)] |
882 |
["Indent Buffer" meta-indent-buffer t] |
["Indent Buffer" meta-indent-buffer t] |
883 |
"--" |
"--" |
884 |
["Comment Out Environment" meta-comment-defun t] |
["Comment Out Environment" meta-comment-defun t] |
885 |
["Uncomment Environment" meta-uncomment-defun t] |
["Uncomment Environment" meta-uncomment-defun t] |
886 |
["Comment Out Region" meta-comment-region |
["Comment Out Region" meta-comment-region |
887 |
:active (meta-mark-active)] |
:active (meta-mark-active)] |
888 |
["Uncomment Region" meta-uncomment-region |
["Uncomment Region" meta-uncomment-region |
889 |
:active (meta-mark-active)] |
:active (meta-mark-active)] |
890 |
"--" |
"--" |
891 |
["Complete Symbol" meta-complete-symbol t] |
["Complete Symbol" meta-complete-symbol t] |
933 |
|
|
934 |
(make-local-variable 'paragraph-start) |
(make-local-variable 'paragraph-start) |
935 |
(make-local-variable 'paragraph-separate) |
(make-local-variable 'paragraph-separate) |
936 |
(setq paragraph-start |
(setq paragraph-start |
937 |
(concat page-delimiter "\\|$")) |
(concat page-delimiter "\\|$")) |
938 |
(setq paragraph-separate |
(setq paragraph-separate |
939 |
(concat page-delimiter "\\|$")) |
(concat page-delimiter "\\|$")) |
940 |
|
|
941 |
(make-local-variable 'paragraph-ignore-fill-prefix) |
(make-local-variable 'paragraph-ignore-fill-prefix) |
955 |
|
|
956 |
(make-local-variable 'comment-indent-function) |
(make-local-variable 'comment-indent-function) |
957 |
(setq comment-indent-function 'meta-comment-indent) |
(setq comment-indent-function 'meta-comment-indent) |
|
(make-local-variable 'fill-paragraph-function) |
|
|
(setq fill-paragraph-function 'meta-fill-paragraph) |
|
958 |
(make-local-variable 'indent-line-function) |
(make-local-variable 'indent-line-function) |
959 |
(setq indent-line-function 'meta-indent-line) |
(setq indent-line-function 'meta-indent-line) |
960 |
;; No need to define a mode-specific 'indent-region-function. |
;; No need to define a mode-specific 'indent-region-function. |