Mercurial > emacs
comparison lisp/progmodes/simula.el @ 3591:507f64624555
Apply typo patches from Paul Eggert.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Wed, 09 Jun 1993 11:59:12 +0000 |
parents | 9e7ec92a4fdf |
children | b26469d5e812 |
comparison
equal
deleted
inserted
replaced
3590:d5f22061277d | 3591:507f64624555 |
---|---|
57 (defconst simula-label-offset -4711 | 57 (defconst simula-label-offset -4711 |
58 "*Offset of SIMULA label lines relative to usual indentation") | 58 "*Offset of SIMULA label lines relative to usual indentation") |
59 | 59 |
60 (defconst simula-if-indent '(0 . 0) | 60 (defconst simula-if-indent '(0 . 0) |
61 "*Extra indentation of THEN and ELSE with respect to the starting IF. | 61 "*Extra indentation of THEN and ELSE with respect to the starting IF. |
62 Value is a cons cell, the car is extra THEN indention and the cdr | 62 Value is a cons cell, the car is extra THEN indentation and the cdr |
63 extra ELSE indention. IF after ELSE is indented as the starting IF.") | 63 extra ELSE indentation. IF after ELSE is indented as the starting IF.") |
64 | 64 |
65 (defconst simula-inspect-indent '(0 . 0) | 65 (defconst simula-inspect-indent '(0 . 0) |
66 "*Extra indentation of WHEN and OTHERWISE with respect to the | 66 "*Extra indentation of WHEN and OTHERWISE with respect to the |
67 corresponding INSPECT. Value is a cons cell, the car is | 67 corresponding INSPECT. Value is a cons cell, the car is |
68 extra WHEN indention and the cdr extra OTHERWISE indention.") | 68 extra WHEN indentation and the cdr extra OTHERWISE indentation.") |
69 | 69 |
70 (defconst simula-electric-indent nil | 70 (defconst simula-electric-indent nil |
71 "*If this variable is non-nil, the simula-indent-line function | 71 "*If this variable is non-nil, the simula-indent-line function |
72 will check the previous line to see if it has to be reindented.") | 72 will check the previous line to see if it has to be reindented.") |
73 | 73 |
145 with respect to the previous line of the statement. | 145 with respect to the previous line of the statement. |
146 simula-label-offset -4711 | 146 simula-label-offset -4711 |
147 Offset of SIMULA label lines relative to usual indentation | 147 Offset of SIMULA label lines relative to usual indentation |
148 simula-if-indent '(0 . 0) | 148 simula-if-indent '(0 . 0) |
149 Extra indentation of THEN and ELSE with respect to the starting IF. | 149 Extra indentation of THEN and ELSE with respect to the starting IF. |
150 Value is a cons cell, the car is extra THEN indention and the cdr | 150 Value is a cons cell, the car is extra THEN indentation and the cdr |
151 extra ELSE indention. IF after ELSE is indented as the starting IF. | 151 extra ELSE indentation. IF after ELSE is indented as the starting IF. |
152 simula-inspect-indent '(0 . 0) | 152 simula-inspect-indent '(0 . 0) |
153 Extra indentation of WHEN and OTHERWISE with respect to the | 153 Extra indentation of WHEN and OTHERWISE with respect to the |
154 corresponding INSPECT. Value is a cons cell, the car is | 154 corresponding INSPECT. Value is a cons cell, the car is |
155 extra WHEN indention and the cdr extra OTHERWISE indention. | 155 extra WHEN indentation and the cdr extra OTHERWISE indentation. |
156 simula-electric-indent nil | 156 simula-electric-indent nil |
157 If this variable non-nil value, simula-indent-line | 157 If this variable non-nil value, simula-indent-line |
158 will check the previous line to see if it has to be reindented. | 158 will check the previous line to see if it has to be reindented. |
159 simula-abbrev-keyword 'upcase | 159 simula-abbrev-keyword 'upcase |
160 Determine how SIMULA keywords will be expanded. Value is one of | 160 Determine how SIMULA keywords will be expanded. Value is one of |
167 | 167 |
168 Turning on SIMULA mode calls the value of the variable simula-mode-hook | 168 Turning on SIMULA mode calls the value of the variable simula-mode-hook |
169 with no arguments, if that value is non-nil | 169 with no arguments, if that value is non-nil |
170 | 170 |
171 Warning: simula-mode-hook should not read in an abbrev file without calling | 171 Warning: simula-mode-hook should not read in an abbrev file without calling |
172 the function simula-install-standard-abbrevs afterwards, preferrably not | 172 the function simula-install-standard-abbrevs afterwards, preferably not |
173 at all." | 173 at all." |
174 (interactive) | 174 (interactive) |
175 (kill-all-local-variables) | 175 (kill-all-local-variables) |
176 (use-local-map simula-mode-map) | 176 (use-local-map simula-mode-map) |
177 (setq major-mode 'simula-mode) | 177 (setq major-mode 'simula-mode) |
678 temp) | 678 temp) |
679 ;; | 679 ;; |
680 ;; Calculate non-comment indentation | 680 ;; Calculate non-comment indentation |
681 (t | 681 (t |
682 ;; first, find out if this line starts with something that needs | 682 ;; first, find out if this line starts with something that needs |
683 ;; special indention (END/IF/THEN/ELSE/WHEN/OTHERWISE or label) | 683 ;; special indentation (END/IF/THEN/ELSE/WHEN/OTHERWISE or label) |
684 ;; | 684 ;; |
685 (skip-chars-forward " \t\f") | 685 (skip-chars-forward " \t\f") |
686 (cond | 686 (cond |
687 ;; | 687 ;; |
688 ;; END | 688 ;; END |
781 (if (memq temp '(?W ?w)) | 781 (if (memq temp '(?W ?w)) |
782 (car simula-if-indent) | 782 (car simula-if-indent) |
783 (cdr simula-if-indent)))) | 783 (cdr simula-if-indent)))) |
784 (simula-find-inspect))) | 784 (simula-find-inspect))) |
785 ;; found the start of a [sub]statement | 785 ;; found the start of a [sub]statement |
786 ;; add indention for continued statement | 786 ;; add indentation for continued statement |
787 (if continued | 787 (if continued |
788 (setq indent | 788 (setq indent |
789 (+ indent | 789 (+ indent |
790 (if (listp simula-continued-statement-offset) | 790 (if (listp simula-continued-statement-offset) |
791 (car simula-continued-statement-offset) | 791 (car simula-continued-statement-offset) |
819 (backward-word 1) | 819 (backward-word 1) |
820 (not (looking-at | 820 (not (looking-at |
821 "begin\\|then\\|else\\|when\\|otherwise\\|do"))) | 821 "begin\\|then\\|else\\|when\\|otherwise\\|do"))) |
822 (not (memq (preceding-char) '(?: ?\;)))))) | 822 (not (memq (preceding-char) '(?: ?\;)))))) |
823 ;; if we the state of the continued-variable | 823 ;; if we the state of the continued-variable |
824 ;; changed, add indention for continued statement | 824 ;; changed, add indentation for continued statement |
825 (if (or (and prev-cont (not continued)) | 825 (if (or (and prev-cont (not continued)) |
826 (and continued | 826 (and continued |
827 (listp simula-continued-statement-offset))) | 827 (listp simula-continued-statement-offset))) |
828 (setq indent | 828 (setq indent |
829 (+ indent | 829 (+ indent |
833 ;; while ends if point is at beginning of line at loop test | 833 ;; while ends if point is at beginning of line at loop test |
834 (if (not temp) | 834 (if (not temp) |
835 (setq start-line (save-excursion (beginning-of-line) (point))) | 835 (setq start-line (save-excursion (beginning-of-line) (point))) |
836 (beginning-of-line)))) | 836 (beginning-of-line)))) |
837 ;; | 837 ;; |
838 ;; return indention | 838 ;; return indentation |
839 ;; | 839 ;; |
840 indent))))) | 840 indent))))) |
841 | 841 |
842 | 842 |
843 (defun simula-find-if () | 843 (defun simula-find-if () |
907 ;; found something - check it out | 907 ;; found something - check it out |
908 (cond | 908 (cond |
909 ((eq (following-char) ?\;) | 909 ((eq (following-char) ?\;) |
910 (if (zerop parlevel) | 910 (if (zerop parlevel) |
911 (throw 'simula-out nil) | 911 (throw 'simula-out nil) |
912 (error "Parethesis mismatch or misplaced ';'"))) | 912 (error "Parenthesis mismatch or misplaced ';'"))) |
913 ((eq (following-char) ?\() | 913 ((eq (following-char) ?\() |
914 (if (zerop parlevel) | 914 (if (zerop parlevel) |
915 (throw 'simula-out (1+ (current-column))) | 915 (throw 'simula-out (1+ (current-column))) |
916 (setq parlevel (1- parlevel)))) | 916 (setq parlevel (1- parlevel)))) |
917 (t (setq parlevel (1+ parlevel)))) | 917 (t (setq parlevel (1+ parlevel)))) |
945 | 945 |
946 (defun simula-electric-keyword () | 946 (defun simula-electric-keyword () |
947 "Expand SIMULA keyword. If it starts the line, reindent." | 947 "Expand SIMULA keyword. If it starts the line, reindent." |
948 ;; redisplay | 948 ;; redisplay |
949 (let ((show-char (eq this-command 'self-insert-command))) | 949 (let ((show-char (eq this-command 'self-insert-command))) |
950 ;; If the abbrev expansion results in reindention, the user may have | 950 ;; If the abbrev expansion results in reindentation, the user may have |
951 ;; to wait some time before the character he typed is displayed | 951 ;; to wait some time before the character he typed is displayed |
952 ;; (the char causing the expansion is inserted AFTER the hook function | 952 ;; (the char causing the expansion is inserted AFTER the hook function |
953 ;; is called). This is annoying in case of normal characters. | 953 ;; is called). This is annoying in case of normal characters. |
954 ;; However, if the user pressed a key bound to newline, it is better | 954 ;; However, if the user pressed a key bound to newline, it is better |
955 ;; to have the line inserted after the begin-end match. | 955 ;; to have the line inserted after the begin-end match. |