New syntax-propertize functionality.
[bpt/emacs.git] / lisp / progmodes / simula.el
index 89074dc..34c50b6 100644 (file)
@@ -1,19 +1,20 @@
 ;;; simula.el --- SIMULA 87 code editing commands for Emacs
 
-;; Copyright (C) 1992, 1994, 1996, 2001, 2002, 2003, 2004, 2005, 2006, 2007
-;; 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>
 ;; Maintainer: simula-mode@ifi.uio.no
+;;   (above email addresses invalid as of April 2008)
 ;; Adapted-By: ESR
 ;; Keywords: languages
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs 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.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -21,9 +22,7 @@
 ;; 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., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -164,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
@@ -331,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:
@@ -397,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 ()
@@ -1198,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))
@@ -1615,9 +1616,9 @@ If not nil and not t, move to limit of search and return nil."
   (simula-install-standard-abbrevs))
 
 ;; Hilit mode support.
-(if (and (fboundp 'hilit-set-mode-patterns)
-        (boundp 'hilit-patterns-alist)
-        (not (assoc 'simula-mode hilit-patterns-alist)))
+(when (fboundp 'hilit-set-mode-patterns)
+  (when (and (boundp 'hilit-patterns-alist)
+            (not (assoc 'simula-mode hilit-patterns-alist)))
     (hilit-set-mode-patterns
      'simula-mode
      '(
@@ -1626,11 +1627,11 @@ If not nil and not t, move to limit of search and return nil."
        ("\"[^\"\n]*\"\\|'.'\\|'![0-9]+!'" nil string)
        ("\\<\\(ACTIVATE\\|AFTER\\|AND\\|ARRAY\\|AT\\|BEFORE\\|BEGIN\\|BOOLEAN\\|CHARACTER\\|CLASS\\|DELAY\\|DO\\|ELSE\\|END\\|EQ\\|EQV\\|EXTERNAL\\|FALSE\\|FOR\\|GE\\|GO\\|GOTO\\|GT\\|HIDDEN\\|IF\\|IMP\\|IN\\|INNER\\|INSPECT\\|INTEGER\\|IS\\|LABEL\\|LE\\|LONG\\|LT\\|NAME\\|NE\\|NEW\\|NONE\\|NOT\\|NOTEXT\\|OR\\|OTHERWISE\\|PRIOR\\|PROCEDURE\\|PROTECTED\\|QUA\\|REACTIVATE\\|REAL\\|REF\\|SHORT\\|STEP\\|SWITCH\\|TEXT\\|THEN\\|THIS\\|TO\\|TRUE\\|UNTIL\\|VALUE\\|VIRTUAL\\|WHEN\\|WHILE\\)\\>" nil keyword)
        ("!\\|\\<COMMENT\\>" ";" comment))
-     nil 'case-insensitive))
+     nil 'case-insensitive)))
 \f
 ;; defuns for submitting bug reports
 
-(defconst simula-mode-help-address "simula-mode@ifi.uio.no"
+(defconst simula-mode-help-address "bug-gnu-emacs@gnu.org"
   "Address accepting submission of `simula-mode' bug reports.")
 
 (defun simula-submit-bug-report ()
@@ -1658,5 +1659,5 @@ If not nil and not t, move to limit of search and return nil."
 
 (provide 'simula)
 
-;;; arch-tag: 488c1bb0-eebf-4f06-93df-1df603f06255
+;; arch-tag: 488c1bb0-eebf-4f06-93df-1df603f06255
 ;;; simula.el ends here