comparison lisp/progmodes/simula.el @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents 36beaccb197a
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
1 ;;; simula.el --- SIMULA 87 code editing commands for Emacs 1 ;;; simula.el --- SIMULA 87 code editing commands for Emacs
2 2
3 ;; Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc. 3 ;; Copyright (C) 1992, 1994, 1996 2001, 2002, 2003, 2004, 2005
4 ;; Free Software Foundation, Inc.
4 5
5 ;; Author: Hans Henrik Eriksen <hhe@ifi.uio.no> 6 ;; Author: Hans Henrik Eriksen <hhe@ifi.uio.no>
6 ;; Maintainer: simula-mode@ifi.uio.no 7 ;; Maintainer: simula-mode@ifi.uio.no
7 ;; Adapted-By: ESR 8 ;; Adapted-By: ESR
8 ;; Keywords: languages 9 ;; Keywords: languages
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details. 21 ;; GNU General Public License for more details.
21 22
22 ;; You should have received a copy of the GNU General Public License 23 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 ;; Boston, MA 02111-1307, USA. 26 ;; Boston, MA 02110-1301, USA.
26 27
27 ;;; Commentary: 28 ;;; Commentary:
28 29
29 ;; A major mode for editing the Simula language. It knows about Simula 30 ;; A major mode for editing the Simula language. It knows about Simula
30 ;; syntax and standard indentation commands. It also provides convenient 31 ;; syntax and standard indentation commands. It also provides convenient
37 ;;; Code: 38 ;;; Code:
38 39
39 40
40 (defgroup simula nil 41 (defgroup simula nil
41 "Major mode for editing Simula code." 42 "Major mode for editing Simula code."
43 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
42 :prefix "simula-" 44 :prefix "simula-"
43 :group 'languages) 45 :group 'languages)
44 46
45 (defconst simula-tab-always-indent-default nil 47 (defconst simula-tab-always-indent-default nil
46 "Non-nil means TAB in SIMULA mode should always reindent the current line. 48 "Non-nil means TAB in SIMULA mode should always reindent the current line.
378 (make-local-variable 'paragraph-separate) 380 (make-local-variable 'paragraph-separate)
379 (setq paragraph-separate paragraph-start) 381 (setq paragraph-separate paragraph-start)
380 (make-local-variable 'indent-line-function) 382 (make-local-variable 'indent-line-function)
381 (setq indent-line-function 'simula-indent-line) 383 (setq indent-line-function 'simula-indent-line)
382 (make-local-variable 'require-final-newline) 384 (make-local-variable 'require-final-newline)
383 (setq require-final-newline t) 385 (setq require-final-newline mode-require-final-newline)
384 (make-local-variable 'comment-start) 386 (make-local-variable 'comment-start)
385 (setq comment-start "! ") 387 (setq comment-start "! ")
386 (make-local-variable 'comment-end) 388 (make-local-variable 'comment-end)
387 (setq comment-end " ;") 389 (setq comment-end " ;")
388 (make-local-variable 'comment-start-skip) 390 (make-local-variable 'comment-start-skip)
396 '((simula-font-lock-keywords simula-font-lock-keywords-1 398 '((simula-font-lock-keywords simula-font-lock-keywords-1
397 simula-font-lock-keywords-2 simula-font-lock-keywords-3) 399 simula-font-lock-keywords-2 simula-font-lock-keywords-3)
398 nil t ((?_ . "w")) nil 400 nil t ((?_ . "w")) nil
399 (font-lock-syntactic-keywords . simula-font-lock-syntactic-keywords))) 401 (font-lock-syntactic-keywords . simula-font-lock-syntactic-keywords)))
400 (abbrev-mode 1)) 402 (abbrev-mode 1))
401
402 (if simula-abbrev-file
403 (read-abbrev-file simula-abbrev-file))
404 (let (abbrevs-changed)
405 (simula-install-standard-abbrevs))
406 403
407 (defun simula-indent-exp () 404 (defun simula-indent-exp ()
408 "Indent SIMULA expression following point." 405 "Indent SIMULA expression following point."
409 (interactive) 406 (interactive)
410 (let ((here (point)) 407 (let ((here (point))
1376 1373
1377 (defun simula-install-standard-abbrevs () 1374 (defun simula-install-standard-abbrevs ()
1378 "Define Simula keywords, procedures and classes in local abbrev table." 1375 "Define Simula keywords, procedures and classes in local abbrev table."
1379 ;; procedure and class names are as of the SIMULA 87 standard. 1376 ;; procedure and class names are as of the SIMULA 87 standard.
1380 (interactive) 1377 (interactive)
1381 (mapcar (function (lambda (args) 1378 (dolist (args
1382 (apply 'define-abbrev simula-mode-abbrev-table args)))
1383 '(("abs" "Abs" simula-expand-stdproc) 1379 '(("abs" "Abs" simula-expand-stdproc)
1384 ("accum" "Accum" simula-expand-stdproc) 1380 ("accum" "Accum" simula-expand-stdproc)
1385 ("activate" "ACTIVATE" simula-expand-keyword) 1381 ("activate" "ACTIVATE" simula-expand-keyword)
1386 ("addepsilon" "AddEpsilon" simula-expand-stdproc) 1382 ("addepsilon" "AddEpsilon" simula-expand-stdproc)
1387 ("after" "AFTER" simula-expand-keyword) 1383 ("after" "AFTER" simula-expand-keyword)
1607 ("upperbound" "UpperBound" simula-expand-stdproc) 1603 ("upperbound" "UpperBound" simula-expand-stdproc)
1608 ("value" "VALUE" simula-expand-keyword) 1604 ("value" "VALUE" simula-expand-keyword)
1609 ("virtual" "VIRTUAL" simula-expand-keyword) 1605 ("virtual" "VIRTUAL" simula-expand-keyword)
1610 ("wait" "Wait" simula-expand-stdproc) 1606 ("wait" "Wait" simula-expand-stdproc)
1611 ("when" "WHEN" simula-electric-keyword) 1607 ("when" "WHEN" simula-electric-keyword)
1612 ("while" "WHILE" simula-expand-keyword)))) 1608 ("while" "WHILE" simula-expand-keyword)))
1609 (define-abbrev simula-mode-abbrev-table
1610 (nth 0 args) (nth 1 args) (nth 2 args) nil 'system)))
1611
1612 (if simula-abbrev-file
1613 (read-abbrev-file simula-abbrev-file))
1614 (let (abbrevs-changed)
1615 (simula-install-standard-abbrevs))
1613 1616
1614 ;; Hilit mode support. 1617 ;; Hilit mode support.
1615 (if (and (fboundp 'hilit-set-mode-patterns) 1618 (if (and (fboundp 'hilit-set-mode-patterns)
1616 (boundp 'hilit-patterns-alist) 1619 (boundp 'hilit-patterns-alist)
1617 (not (assoc 'simula-mode hilit-patterns-alist))) 1620 (not (assoc 'simula-mode hilit-patterns-alist)))
1653 'simula-tab-always-indent 1656 'simula-tab-always-indent
1654 )))) 1657 ))))
1655 1658
1656 (provide 'simula) 1659 (provide 'simula)
1657 1660
1661 ;;; arch-tag: 488c1bb0-eebf-4f06-93df-1df603f06255
1658 ;;; simula.el ends here 1662 ;;; simula.el ends here