New syntax-propertize functionality.
[bpt/emacs.git] / lisp / progmodes / simula.el
index 56924a0..34c50b6 100644 (file)
@@ -1,10 +1,11 @@
 ;;; simula.el --- SIMULA 87 code editing commands for Emacs
 
-;; Copyright (C) 1992, 1994, 1996, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-;; Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1994, 1996, 2001, 2002, 2003, 2004, 2005, 2006,
+;;   2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
-;; Author: Hans Henrik Eriksen <hhe@ifi.uio.no> (invalid email address, checked April 2008)
-;; Maintainer: simula-mode@ifi.uio.no (invalid email address, checked April 2008)
+;; Author: Hans Henrik Eriksen <hhe@ifi.uio.no>
+;; Maintainer: simula-mode@ifi.uio.no
+;;   (above email addresses invalid as of April 2008)
 ;; Adapted-By: ESR
 ;; Keywords: languages
 
@@ -162,17 +163,18 @@ for SIMULA mode to function correctly."
 (defvar simula-mode-syntax-table nil
   "Syntax table in SIMULA mode buffers.")
 
-(defconst simula-font-lock-syntactic-keywords
-  `(;; `comment' directive.
-    ("\\<\\(c\\)omment\\>" 1 "<")
-    ;; end comments
-    (,(concat "\\<end\\>\\([^;\n]\\).*?\\(\n\\|\\(.\\)\\(;\\|"
-             (regexp-opt '("end" "else" "when" "otherwise"))
-             "\\)\\)")
-     (1 "< b")
-     (3 "> b" nil t))
-    ;; non-quoted single-quote char.
-    ("'\\('\\)'" 1 ".")))
+(defconst simula-syntax-propertize-function
+  (syntax-propertize-rules
+   ;; `comment' directive.
+   ("\\<\\(c\\)omment\\>" (1 "<"))
+   ;; end comments
+   ((concat "\\<end\\>\\([^;\n]\\).*?\\(\n\\|\\(.\\)\\(;\\|"
+            (regexp-opt '("end" "else" "when" "otherwise"))
+            "\\)\\)")
+    (1 "< b")
+    (3 "> b"))
+   ;; non-quoted single-quote char.
+   ("'\\('\\)'" (1 "."))))
 
 ;; Regexps written with help from Alf-Ivar Holm <alfh@ifi.uio.no>.
 (defconst simula-font-lock-keywords-1
@@ -329,7 +331,7 @@ for SIMULA mode to function correctly."
   (popup-menu (cons (concat mode-name " Mode Commands") simula-mode-menu)))
 
 ;;;###autoload
-(define-derived-mode simula-mode nil "Simula"
+(define-derived-mode simula-mode prog-mode "Simula"
   "Major mode for editing SIMULA code.
 \\{simula-mode-map}
 Variables controlling indentation style:
@@ -395,8 +397,9 @@ with no arguments, if that value is non-nil."
   (setq font-lock-defaults
        '((simula-font-lock-keywords simula-font-lock-keywords-1
           simula-font-lock-keywords-2 simula-font-lock-keywords-3)
-         nil t ((?_ . "w")) nil
-         (font-lock-syntactic-keywords . simula-font-lock-syntactic-keywords)))
+         nil t ((?_ . "w"))))
+  (set (make-local-variable 'syntax-propertize-function)
+       simula-syntax-propertize-function)
   (abbrev-mode 1))
 
 (defun simula-indent-exp ()
@@ -1196,7 +1199,7 @@ If COUNT is negative, move backward instead."
     ;; to have the line inserted after the begin-end match.
     (if show-char
        (progn
-         (insert-char last-command-char 1)
+         (insert-char last-command-event 1)
          (sit-for 0)
          (backward-char 1)))
     (if (let ((where (simula-context))