aboutsummaryrefslogtreecommitdiffhomepage
path: root/contrib
diff options
context:
space:
mode:
authorGravatar David Aspinall <da@inf.ed.ac.uk>2010-08-27 11:24:36 +0000
committerGravatar David Aspinall <da@inf.ed.ac.uk>2010-08-27 11:24:36 +0000
commitd6adb3e230eced24e99933c13265a9447beb1026 (patch)
tree73826259431a3576150153a7befe0b189761a1db /contrib
parent942b02fa2589aa86cdf9a710bd1a7a9d4f9739bb (diff)
Renamed file contrib/mmm/mmm-cweb.el, formerly mmm/mmm-cweb.el
Diffstat (limited to 'contrib')
-rw-r--r--contrib/mmm/mmm-cweb.el101
1 files changed, 101 insertions, 0 deletions
diff --git a/contrib/mmm/mmm-cweb.el b/contrib/mmm/mmm-cweb.el
new file mode 100644
index 00000000..ac976344
--- /dev/null
+++ b/contrib/mmm/mmm-cweb.el
@@ -0,0 +1,101 @@
+;;; mmm-cweb.el --- MMM submode class for CWeb programs
+
+;; Copyright (C) 2001 by Alan Shutko
+
+;; Author: Alan Shutko <ats@acm.org>
+;; Version: $Id$
+
+;;{{{ GPL
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to
+;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;}}}
+
+;;; Commentary:
+
+;; This file contains the definition of an MMM Mode submode class for
+;; editing CWeb programs.
+
+;;; Code:
+
+(require 'mmm-compat)
+(require 'mmm-vars)
+(require 'mmm-auto)
+
+(defvar mmm-cweb-section-tags
+ '("@ " "@*"))
+
+(defvar mmm-cweb-section-regexp
+ (concat "^" (mmm-regexp-opt mmm-cweb-section-tags t)))
+
+(defvar mmm-cweb-c-part-tags
+ '("@c" "@>=" "@>+=" "@p"))
+
+(defvar mmm-cweb-c-part-regexp
+ (concat (mmm-regexp-opt mmm-cweb-c-part-tags t)))
+
+(defun mmm-cweb-in-limbo (pos)
+ "Check to see if POS is in limbo, ie before any cweb sections."
+ (save-match-data
+ (save-excursion
+ (goto-char pos)
+ (not (re-search-backward mmm-cweb-section-regexp nil t)))))
+
+(defun mmm-cweb-verify-brief-c ()
+ "Verify function for cweb-brief-c class.
+Checks whether the match is in limbo."
+ (not (mmm-cweb-in-limbo (match-beginning 0))))
+
+(mmm-add-group
+ 'cweb
+ `(
+ (cweb-c-part
+ :submode c-mode
+ :front ,mmm-cweb-c-part-regexp
+ :back ,mmm-cweb-section-regexp)
+ (cweb-label
+ :submode tex-mode
+ :front "@<"
+ :back "@>"
+ :face mmm-comment-submode-face
+ :insert ((?l cweb-label nil @ "@<" @ "@>")))
+ (cweb-brief-c
+ :submode c-mode
+ :front "[^\\|]\\(|\\)[^|]"
+ :front-match 1
+ :front-verify mmm-cweb-verify-brief-c
+; :front-offset -1
+ :back "[^\\|]\\(|\\)"
+ :back-match 1
+; :back-offset 1
+ :end-not-begin t
+ :insert ((?| cweb-c-in-tex nil "|" @ "|")))
+ (cweb-comment
+ :submode tex-mode
+ :front "/[*]"
+ :back "[*]/"
+ :face mmm-comment-submode-face)
+))
+
+;; (add-to-list 'mmm-mode-ext-classes-alist
+;; '(plain-tex-mode "\\.w\\'" cweb))
+;; (add-to-list 'mmm-mode-ext-classes-alist
+;; '(latex-mode "\\.w\\'" cweb))
+;; (add-to-list 'auto-mode-alist '("\\.w\\'" . tex-mode))
+
+(provide 'mmm-cweb)
+
+;;; mmm-cweb.el ends here \ No newline at end of file