;;; 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, 2011 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
;; 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 3, 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
;; 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:
(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
(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:
Turning on SIMULA mode calls the value of the variable simula-mode-hook
with no arguments, if that value is non-nil."
- (make-local-variable 'comment-column)
- (setq comment-column 40)
-; (make-local-variable 'end-comment-column)
-; (setq end-comment-column 75)
- (make-local-variable 'paragraph-start)
- (setq paragraph-start "[ \t]*$\\|\\f")
- (make-local-variable 'paragraph-separate)
- (setq paragraph-separate paragraph-start)
- (make-local-variable 'indent-line-function)
- (setq indent-line-function 'simula-indent-line)
- (make-local-variable 'require-final-newline)
- (setq require-final-newline mode-require-final-newline)
- (make-local-variable 'comment-start)
- (setq comment-start "! ")
- (make-local-variable 'comment-end)
- (setq comment-end " ;")
- (make-local-variable 'comment-start-skip)
- (setq comment-start-skip "!+ *")
- (make-local-variable 'parse-sexp-ignore-comments)
- (setq parse-sexp-ignore-comments nil)
- (make-local-variable 'comment-multi-line)
- (setq comment-multi-line t)
- (make-local-variable 'font-lock-defaults)
- (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)))
+ (set (make-local-variable 'comment-column) 40)
+ ;; (set (make-local-variable 'end-comment-column) 75)
+ (set (make-local-variable 'paragraph-start) "[ \t]*$\\|\\f")
+ (set (make-local-variable 'paragraph-separate) paragraph-start)
+ (set (make-local-variable 'indent-line-function) 'simula-indent-line)
+ (set (make-local-variable 'comment-start) "! ")
+ (set (make-local-variable 'comment-end) " ;")
+ (set (make-local-variable 'comment-start-skip) "!+ *")
+ (set (make-local-variable 'parse-sexp-ignore-comments) nil)
+ (set (make-local-variable 'comment-multi-line) t)
+ (set (make-local-variable '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"))))
+ (set (make-local-variable 'syntax-propertize-function)
+ simula-syntax-propertize-function)
(abbrev-mode 1))
(defun simula-indent-exp ()
(simula-previous-statement 1)
(simula-skip-comment-backward)))
(setq start-line
- (save-excursion (beginning-of-line) (point))
+ (line-beginning-position)
;; - perhaps this is a continued statement
continued
(save-excursion
(car simula-continued-statement-offset)
simula-continued-statement-offset))))
(setq start-line
- (save-excursion (beginning-of-line) (point))
+ (line-beginning-position)
continued nil))
;; search failed .. point is at beginning of line
;; determine if we should continue searching
simula-continued-statement-offset))))
;; while ends if point is at beginning of line at loop test
(if (not temp)
- (setq start-line (save-excursion (beginning-of-line) (point)))
+ (setq start-line (line-beginning-position))
(beginning-of-line))))
;;
;; return indentation
;; 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))
(provide 'simula)
-;; arch-tag: 488c1bb0-eebf-4f06-93df-1df603f06255
;;; simula.el ends here