aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/simula.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/simula.el')
-rw-r--r--lisp/progmodes/simula.el99
1 files changed, 36 insertions, 63 deletions
diff --git a/lisp/progmodes/simula.el b/lisp/progmodes/simula.el
index f92f4468098..7c0de9fc359 100644
--- a/lisp/progmodes/simula.el
+++ b/lisp/progmodes/simula.el
@@ -1,4 +1,4 @@
1;;; simula.el --- SIMULA 87 code editing commands for Emacs 1;;; simula.el --- SIMULA 87 code editing commands for Emacs -*- lexical-binding: t; -*-
2 2
3;; Copyright (C) 1992, 1994, 1996, 2001-2021 Free Software Foundation, 3;; Copyright (C) 1992, 1994, 1996, 2001-2021 Free Software Foundation,
4;; Inc. 4;; Inc.
@@ -52,6 +52,7 @@ the run of whitespace at the beginning of the line.")
52Otherwise TAB indents only when point is within 52Otherwise TAB indents only when point is within
53the run of whitespace at the beginning of the line." 53the run of whitespace at the beginning of the line."
54 :type 'boolean) 54 :type 'boolean)
55(make-obsolete-variable 'simula-tab-always-indent 'tab-always-indent "28.1")
55 56
56(defconst simula-indent-level-default 3 57(defconst simula-indent-level-default 3
57 "Indentation of SIMULA statements with respect to containing block.") 58 "Indentation of SIMULA statements with respect to containing block.")
@@ -148,7 +149,24 @@ Please note that the standard definitions are required
148for SIMULA mode to function correctly." 149for SIMULA mode to function correctly."
149 :type '(choice file (const nil))) 150 :type '(choice file (const nil)))
150 151
151(defvar simula-mode-syntax-table nil 152(defvar simula-mode-syntax-table
153 (let ((st (copy-syntax-table (standard-syntax-table))))
154 (modify-syntax-entry ?! "<" st)
155 (modify-syntax-entry ?$ "." st)
156 (modify-syntax-entry ?% "< b" st)
157 (modify-syntax-entry ?\n "> b" st)
158 (modify-syntax-entry ?' "\"" st)
159 (modify-syntax-entry ?\( "()" st)
160 (modify-syntax-entry ?\) ")(" st)
161 (modify-syntax-entry ?\; ">" st)
162 (modify-syntax-entry ?\[ "." st)
163 (modify-syntax-entry ?\\ "." st)
164 (modify-syntax-entry ?\] "." st)
165 (modify-syntax-entry ?_ "_" st)
166 (modify-syntax-entry ?\| "." st)
167 (modify-syntax-entry ?\{ "." st)
168 (modify-syntax-entry ?\} "." st)
169 st)
152 "Syntax table in SIMULA mode buffers.") 170 "Syntax table in SIMULA mode buffers.")
153 171
154(defconst simula-syntax-propertize-function 172(defconst simula-syntax-propertize-function
@@ -237,39 +255,20 @@ for SIMULA mode to function correctly."
237 ["Forward Statement" simula-next-statement t] 255 ["Forward Statement" simula-next-statement t]
238 ["Backward Up Level" simula-backward-up-level t] 256 ["Backward Up Level" simula-backward-up-level t]
239 ["Forward Down Statement" simula-forward-down-level t]) 257 ["Forward Down Statement" simula-forward-down-level t])
240 "Lucid Emacs menu for SIMULA mode.") 258 "Emacs menu for SIMULA mode.")
241
242(if simula-mode-syntax-table
243 ()
244 (setq simula-mode-syntax-table (copy-syntax-table (standard-syntax-table)))
245 (modify-syntax-entry ?! "<" simula-mode-syntax-table)
246 (modify-syntax-entry ?$ "." simula-mode-syntax-table)
247 (modify-syntax-entry ?% "< b" simula-mode-syntax-table)
248 (modify-syntax-entry ?\n "> b" simula-mode-syntax-table)
249 (modify-syntax-entry ?' "\"" simula-mode-syntax-table)
250 (modify-syntax-entry ?\( "()" simula-mode-syntax-table)
251 (modify-syntax-entry ?\) ")(" simula-mode-syntax-table)
252 (modify-syntax-entry ?\; ">" simula-mode-syntax-table)
253 (modify-syntax-entry ?\[ "." simula-mode-syntax-table)
254 (modify-syntax-entry ?\\ "." simula-mode-syntax-table)
255 (modify-syntax-entry ?\] "." simula-mode-syntax-table)
256 (modify-syntax-entry ?_ "_" simula-mode-syntax-table)
257 (modify-syntax-entry ?\| "." simula-mode-syntax-table)
258 (modify-syntax-entry ?\{ "." simula-mode-syntax-table)
259 (modify-syntax-entry ?\} "." simula-mode-syntax-table))
260 259
261(defvar simula-mode-map 260(defvar simula-mode-map
262 (let ((map (make-sparse-keymap))) 261 (let ((map (make-sparse-keymap)))
263 (define-key map "\C-c\C-u" 'simula-backward-up-level) 262 (define-key map "\C-c\C-u" #'simula-backward-up-level)
264 (define-key map "\C-c\C-p" 'simula-previous-statement) 263 (define-key map "\C-c\C-p" #'simula-previous-statement)
265 (define-key map "\C-c\C-d" 'simula-forward-down-level) 264 (define-key map "\C-c\C-d" #'simula-forward-down-level)
266 (define-key map "\C-c\C-n" 'simula-next-statement) 265 (define-key map "\C-c\C-n" #'simula-next-statement)
267 ;; (define-key map "\C-c\C-g" 'simula-goto-definition) 266 ;; (define-key map "\C-c\C-g" #'simula-goto-definition)
268 ;; (define-key map "\C-c\C-h" 'simula-standard-help) 267 ;; (define-key map "\C-c\C-h" #'simula-standard-help)
269 (define-key map "\177" 'backward-delete-char-untabify) 268 (define-key map "\177" #'backward-delete-char-untabify)
270 (define-key map ":" 'simula-electric-label) 269 (define-key map ":" #'simula-electric-label)
271 (define-key map "\e\C-q" 'simula-indent-exp) 270 (define-key map "\e\C-q" #'simula-indent-exp)
272 (define-key map "\t" 'simula-indent-command) 271 ;; (define-key map "\t" #'simula-indent-command)
273 map) 272 map)
274 "Keymap used in `simula-mode'.") 273 "Keymap used in `simula-mode'.")
275 274
@@ -285,8 +284,8 @@ for SIMULA mode to function correctly."
285 ["Previous Statement" simula-previous-statement 284 ["Previous Statement" simula-previous-statement
286 :enable (not (bobp))] 285 :enable (not (bobp))]
287 "---" 286 "---"
288 ["Indent Line" simula-indent-command 287 ;; ["Indent Line" simula-indent-command
289 :enable (not buffer-read-only)] 288 ;; :enable (not buffer-read-only)]
290 ["Indent Expression" simula-indent-exp 289 ["Indent Expression" simula-indent-exp
291 :enable (not buffer-read-only)])) 290 :enable (not buffer-read-only)]))
292 291
@@ -295,9 +294,6 @@ for SIMULA mode to function correctly."
295 "Major mode for editing SIMULA code. 294 "Major mode for editing SIMULA code.
296\\{simula-mode-map} 295\\{simula-mode-map}
297Variables controlling indentation style: 296Variables controlling indentation style:
298 `simula-tab-always-indent'
299 Non-nil means TAB in SIMULA mode should always reindent the current line,
300 regardless of where in the line point is when the TAB command is used.
301 `simula-indent-level' 297 `simula-indent-level'
302 Indentation of SIMULA statements with respect to containing block. 298 Indentation of SIMULA statements with respect to containing block.
303 `simula-substatement-offset' 299 `simula-substatement-offset'
@@ -335,7 +331,7 @@ with no arguments, if that value is non-nil."
335 ;; (setq-local end-comment-column 75) 331 ;; (setq-local end-comment-column 75)
336 (setq-local paragraph-start "[ \t]*$\\|\f") 332 (setq-local paragraph-start "[ \t]*$\\|\f")
337 (setq-local paragraph-separate paragraph-start) 333 (setq-local paragraph-separate paragraph-start)
338 (setq-local indent-line-function 'simula-indent-line) 334 (setq-local indent-line-function #'simula-indent-line)
339 (setq-local comment-start "! ") 335 (setq-local comment-start "! ")
340 (setq-local comment-end " ;") 336 (setq-local comment-end " ;")
341 (setq-local comment-start-skip "!+ *") 337 (setq-local comment-start-skip "!+ *")
@@ -415,6 +411,7 @@ A numeric argument, regardless of its value, means indent rigidly
415all the lines of the SIMULA statement after point so that this line 411all the lines of the SIMULA statement after point so that this line
416becomes properly indented. 412becomes properly indented.
417The relative indentation among the lines of the statement are preserved." 413The relative indentation among the lines of the statement are preserved."
414 (declare (obsolete indent-for-tab-command "28.1"))
418 (interactive "P") 415 (interactive "P")
419 (let ((case-fold-search t)) 416 (let ((case-fold-search t))
420 (if (or whole-exp simula-tab-always-indent 417 (if (or whole-exp simula-tab-always-indent
@@ -1564,30 +1561,6 @@ If not nil and not t, move to limit of search and return nil."
1564 (simula-install-standard-abbrevs)) 1561 (simula-install-standard-abbrevs))
1565 1562
1566;; Hilit mode support. 1563;; Hilit mode support.
1567(when (fboundp 'hilit-set-mode-patterns)
1568 (when (and (boundp 'hilit-patterns-alist)
1569 (not (assoc 'simula-mode hilit-patterns-alist)))
1570 (hilit-set-mode-patterns
1571 'simula-mode
1572 '(
1573 ("^%\\([ \t\f].*\\)?$" nil comment)
1574 ("^%include\\>" nil include)
1575 ("\"[^\"\n]*\"\\|'.'\\|'![0-9]+!'" nil string)
1576 ((regexp-opt '("ACTIVATE" "AFTER" "AND" "ARRAY" "AT" "BEFORE"
1577 "BEGIN" "BOOLEAN" "CHARACTER" "CLASS" "DELAY"
1578 "DO" "ELSE" "END" "EQ" "EQV" "EXTERNAL" "FALSE"
1579 "FOR" "GE" "GO" "GOTO" "GT" "HIDDEN" "IF" "IMP"
1580 "IN" "INNER" "INSPECT" "INTEGER" "IS" "LABEL"
1581 "LE" "LONG" "LT" "NAME" "NE" "NEW" "NONE" "NOT"
1582 "NOTEXT" "OR" "OTHERWISE" "PRIOR" "PROCEDURE"
1583 "PROTECTED" "QUA" "REACTIVATE" "REAL" "REF"
1584 "SHORT" "STEP" "SWITCH" "TEXT" "THEN" "THIS"
1585 "TO" "TRUE" "UNTIL" "VALUE" "VIRTUAL" "WHEN"
1586 "WHILE")
1587 'words)
1588 nil keyword)
1589 ("!\\|\\<COMMENT\\>" ";" comment))
1590 nil 'case-insensitive)))
1591 1564
1592;; obsolete 1565;; obsolete
1593 1566
@@ -1598,7 +1571,7 @@ If not nil and not t, move to limit of search and return nil."
1598 "24.4") 1571 "24.4")
1599 1572
1600(define-obsolete-function-alias 'simula-submit-bug-report 1573(define-obsolete-function-alias 'simula-submit-bug-report
1601 'report-emacs-bug "24.4") 1574 #'report-emacs-bug "24.4")
1602 1575
1603(defun simula-popup-menu (_e) 1576(defun simula-popup-menu (_e)
1604 "Pops up the SIMULA menu." 1577 "Pops up the SIMULA menu."