aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1991-01-28 19:24:32 +0000
committerRichard M. Stallman1991-01-28 19:24:32 +0000
commitc8a628964cf23597538d54984dcd25932225ad3a (patch)
treed8fd0f1dd4c6680d97a475e9b30e820b4fa53696
parent26cbfa53f6e123569e94c9414d04af992554711a (diff)
downloademacs-c8a628964cf23597538d54984dcd25932225ad3a.tar.gz
emacs-c8a628964cf23597538d54984dcd25932225ad3a.zip
*** empty log message ***
-rw-r--r--lisp/ada.el109
1 files changed, 57 insertions, 52 deletions
diff --git a/lisp/ada.el b/lisp/ada.el
index 7b88fab8d6c..bf5eee473b7 100644
--- a/lisp/ada.el
+++ b/lisp/ada.el
@@ -168,8 +168,9 @@ Variable ada-indent controls the number of spaces for indent/undent.
168 (run-hooks 'ada-mode-hook)) 168 (run-hooks 'ada-mode-hook))
169 169
170(defun ada-tabsize (s) 170(defun ada-tabsize (s)
171 "changes spacing used for indentation. Reads spacing from minibuffer." 171 "Changes spacing used for indentation.
172 (interactive "nnew indentation spacing: ") 172Reads spacing from minibuffer."
173 (interactive "nNew indentation spacing: ")
173 (setq ada-indent s)) 174 (setq ada-indent s))
174 175
175(defun ada-newline () 176(defun ada-newline ()
@@ -190,9 +191,9 @@ Variable ada-indent controls the number of spaces for indent/undent.
190 (backward-delete-char-untabify ada-indent nil)) 191 (backward-delete-char-untabify ada-indent nil))
191 192
192(defun ada-go-to-this-indent (step indent-level) 193(defun ada-go-to-this-indent (step indent-level)
193 "Move point repeatedly by <step> lines till the current line 194 "Move point repeatedly by STEP lines until the current line has
194has given indent-level or less, or the start/end of the buffer is hit. 195given INDENT-LEVEL or less, or the start or end of the buffer is reached.
195Ignore blank lines, statement labels, block/loop names." 196Ignore blank lines, statement labels and block or loop names."
196 (while (and 197 (while (and
197 (zerop (forward-line step)) 198 (zerop (forward-line step))
198 (or (looking-at "^[ ]*$") 199 (or (looking-at "^[ ]*$")
@@ -204,21 +205,21 @@ Ignore blank lines, statement labels, block/loop names."
204 205
205(defun ada-backward-to-same-indent () 206(defun ada-backward-to-same-indent ()
206 "Move point backwards to nearest line with same indentation or less. 207 "Move point backwards to nearest line with same indentation or less.
207If not found, point is left at top of buffer." 208If not found, point is left at the top of the buffer."
208 (interactive) 209 (interactive)
209 (ada-go-to-this-indent -1 (current-indentation)) 210 (ada-go-to-this-indent -1 (current-indentation))
210 (back-to-indentation)) 211 (back-to-indentation))
211 212
212(defun ada-forward-to-same-indent () 213(defun ada-forward-to-same-indent ()
213 "Move point forwards to nearest line with same indentation or less. 214 "Move point forwards to nearest line with same indentation or less.
214If not found, point is left at start of last line in buffer." 215If not found, point is left at the start of the last line in the buffer."
215 (interactive) 216 (interactive)
216 (ada-go-to-this-indent 1 (current-indentation)) 217 (ada-go-to-this-indent 1 (current-indentation))
217 (back-to-indentation)) 218 (back-to-indentation))
218 219
219(defun ada-array () 220(defun ada-array ()
220 "Insert array type definition, prompting for component type, 221 "Insert array type definition. Uses the minibuffer to prompt
221leaving the user to type in the index subtypes." 222for component type and index subtypes."
222 (interactive) 223 (interactive)
223 (insert "array ()") 224 (insert "array ()")
224 (backward-char) 225 (backward-char)
@@ -230,8 +231,9 @@ leaving the user to type in the index subtypes."
230 (end-of-line)) 231 (end-of-line))
231 232
232(defun ada-case () 233(defun ada-case ()
233 "Build skeleton case statment, prompting for the selector expression. 234 "Build skeleton case statement.
234starts up the first when clause, too." 235Uses the minibuffer to prompt for the selector expression.
236Also builds the first when clause."
235 (interactive) 237 (interactive)
236 (insert "case ") 238 (insert "case ")
237 (insert (read-string "selector expression: ") " is") 239 (insert (read-string "selector expression: ") " is")
@@ -244,57 +246,59 @@ starts up the first when clause, too."
244 (ada-when)) 246 (ada-when))
245 247
246(defun ada-declare-block () 248(defun ada-declare-block ()
247 "Insert a block with a declare part and indent for the 1st declaration." 249 "Insert a block with a declare part.
250Indent for the first declaration."
248 (interactive) 251 (interactive)
249 (let ((ada-block-name (read-string "[block name]: "))) 252 (let ((ada-block-name (read-string "[block name]: ")))
250 (insert "declare") 253 (insert "declare")
251 (cond 254 (cond
252 ( (not (string-equal ada-block-name "")) 255 ( (not (string-equal ada-block-name ""))
253 (beginning-of-line) 256 (beginning-of-line)
254 (open-line 1) 257 (open-line 1)
255 (insert ada-block-name ":") 258 (insert ada-block-name ":")
256 (next-line 1) 259 (next-line 1)
257 (end-of-line))) 260 (end-of-line)))
258 (ada-newline) 261 (ada-newline)
259 (ada-newline) 262 (ada-newline)
260 (insert "begin") 263 (insert "begin")
261 (ada-newline) 264 (ada-newline)
262 (ada-newline) 265 (ada-newline)
263 (if (string-equal ada-block-name "") 266 (if (string-equal ada-block-name "")
264 (insert "end;") 267 (insert "end;")
265 (insert "end " ada-block-name ";")) 268 (insert "end " ada-block-name ";"))
266 ) 269 )
267 (end-of-line -2) 270 (end-of-line -2)
268 (ada-tab)) 271 (ada-tab))
269 272
270(defun ada-exception-block () 273(defun ada-exception-block ()
271 "Insert a block with an exception part and indent for the 1st line of code." 274 "Insert a block with an exception part.
275Indent for the first line of code."
272 (interactive) 276 (interactive)
273 (let ((block-name (read-string "[block name]: "))) 277 (let ((block-name (read-string "[block name]: ")))
274 (insert "begin") 278 (insert "begin")
275 (cond 279 (cond
276 ( (not (string-equal block-name "")) 280 ( (not (string-equal block-name ""))
277 (beginning-of-line) 281 (beginning-of-line)
278 (open-line 1) 282 (open-line 1)
279 (insert block-name ":") 283 (insert block-name ":")
280 (next-line 1) 284 (next-line 1)
281 (end-of-line))) 285 (end-of-line)))
282 (ada-newline) 286 (ada-newline)
283 (ada-newline) 287 (ada-newline)
284 (insert "exception") 288 (insert "exception")
285 (ada-newline) 289 (ada-newline)
286 (ada-newline) 290 (ada-newline)
287 (cond 291 (cond
288 ( (string-equal block-name "") 292 ( (string-equal block-name "")
289 (insert "end;")) 293 (insert "end;"))
290 ( t 294 ( t
291 (insert "end " block-name ";"))) 295 (insert "end " block-name ";")))
292 ) 296 )
293 (end-of-line -2) 297 (end-of-line -2)
294 (ada-tab)) 298 (ada-tab))
295 299
296(defun ada-exception () 300(defun ada-exception ()
297 "Undent and insert an exception part into a block. Reindent." 301 "Insert an indented exception part into a block."
298 (interactive) 302 (interactive)
299 (ada-untab) 303 (ada-untab)
300 (insert "exception") 304 (insert "exception")
@@ -384,7 +388,7 @@ starts up the first when clause, too."
384 (ada-tab)) 388 (ada-tab))
385 389
386(defun ada-loop () 390(defun ada-loop ()
387 "insert a skeleton loop statement. exit statement added by hand." 391 "Insert a skeleton loop statement. exit statement added by hand."
388 (interactive) 392 (interactive)
389 (insert "loop ") 393 (insert "loop ")
390 (let* ((ada-loop-name (read-string "[loop name]: ")) 394 (let* ((ada-loop-name (read-string "[loop name]: "))
@@ -439,10 +443,10 @@ starts up the first when clause, too."
439 (ada-tab)) 443 (ada-tab))
440 444
441(defun ada-get-arg-list () 445(defun ada-get-arg-list ()
442 "Read from user a procedure or function argument list. 446 "Read from the user a procedure or function argument list.
443Add parens unless arguments absent, and insert into buffer. 447Add parens unless arguments absent, and insert into buffer.
444Individual arguments are arranged vertically if entered one-at-a-time. 448Individual arguments are arranged vertically if entered one at a time.
445Arguments ending with ';' are presumed single and stacked." 449Arguments ending with `;' are presumed single and stacked."
446 (insert " (") 450 (insert " (")
447 (let ((ada-arg-indent (current-column)) 451 (let ((ada-arg-indent (current-column))
448 (ada-args (read-string "[arguments]: "))) 452 (ada-args (read-string "[arguments]: ")))
@@ -473,9 +477,9 @@ Arguments ending with ';' are presumed single and stacked."
473 (ada-get-arg-list)) 477 (ada-get-arg-list))
474 478
475(defun get-ada-subprogram-name () 479(defun get-ada-subprogram-name ()
476 "Return (without moving point or mark) a pair whose CAR is 480 "Return (without moving point or mark) a pair whose CAR is the name of
477the name of the function or procedure whose spec immediately precedes point, 481the function or procedure whose spec immediately precedes point, and whose
478and whose CDR is the column nbr the procedure/function keyword was found at." 482CDR is the column number where the procedure/function keyword was found."
479 (save-excursion 483 (save-excursion
480 (let ((ada-proc-indent 0)) 484 (let ((ada-proc-indent 0))
481 (if (re-search-backward 485 (if (re-search-backward
@@ -494,7 +498,7 @@ and whose CDR is the column nbr the procedure/function keyword was found at."
494 498
495(defun ada-subprogram-body () 499(defun ada-subprogram-body ()
496 "Insert frame for subprogram body. 500 "Insert frame for subprogram body.
497Invoke right after ada-function-spec or ada-procedure-spec." 501Invoke right after `ada-function-spec' or `ada-procedure-spec'."
498 (interactive) 502 (interactive)
499 (insert " is") 503 (insert " is")
500 (let ((ada-subprogram-name-col (get-ada-subprogram-name))) 504 (let ((ada-subprogram-name-col (get-ada-subprogram-name)))
@@ -509,7 +513,7 @@ Invoke right after ada-function-spec or ada-procedure-spec."
509 (ada-tab)) 513 (ada-tab))
510 514
511(defun ada-separate () 515(defun ada-separate ()
512 "Finish a body stub with 'is separate'." 516 "Finish a body stub with `is separate'."
513 (interactive) 517 (interactive)
514 (insert " is") 518 (insert " is")
515 (ada-newline) 519 (ada-newline)
@@ -585,8 +589,9 @@ Invoke right after ada-function-spec or ada-procedure-spec."
585 (backward-char)) 589 (backward-char))
586 590
587(defun ada-inline-comment () 591(defun ada-inline-comment ()
588 "Start a comment after the end of the line, indented at least COMMENT-COLUMN. 592 "Start a comment after the end of the line, indented at least
589If starting after END-COMMENT-COLUMN, start a new line." 593`comment-column' spaces. If starting after `end-comment-column',
594start a new line."
590 (interactive) 595 (interactive)
591 (end-of-line) 596 (end-of-line)
592 (if (> (current-column) end-comment-column) (newline)) 597 (if (> (current-column) end-comment-column) (newline))
@@ -594,30 +599,30 @@ If starting after END-COMMENT-COLUMN, start a new line."
594 (insert " -- ")) 599 (insert " -- "))
595 600
596(defun ada-display-comment () 601(defun ada-display-comment ()
597"Inserts 3 comment lines, making a display comment." 602"Inserts three comment lines, making a display comment."
598 (interactive) 603 (interactive)
599 (insert "--\n-- \n--") 604 (insert "--\n-- \n--")
600 (end-of-line 0)) 605 (end-of-line 0))
601 606
602;; Much of this is specific to Ada-Ed 607;; Much of this is specific to Ada-Ed
603 608
604(defvar ada-lib-dir-name "lib" "*Current ada program library directory.") 609(defvar ada-lib-dir-name "lib" "*Current Ada program library directory.")
605(defvar ada-bind-opts "" "*Options to supply for binding.") 610(defvar ada-bind-opts "" "*Options to supply for binding.")
606 611
607(defun ada-library-name (ada-lib-name) 612(defun ada-library-name (ada-lib-name)
608 "Specify name of ada library directory for later compilations." 613 "Specify name of Ada library directory for later compilations."
609 (interactive "Dname of ada library directory: ") 614 (interactive "DName of Ada library directory: ")
610 (setq ada-lib-dir-name ada-lib-name)) 615 (setq ada-lib-dir-name ada-lib-name))
611 616
612(defun ada-options-for-bind () 617(defun ada-options-for-bind ()
613 "Specify options, such as -m and -i, needed for adabind." 618 "Specify options, such as -m and -i, needed for `ada-bind'."
614 (setq ada-bind-opts (read-string "-m and -i options for adabind: "))) 619 (setq ada-bind-opts (read-string "-m and -i options for `ada-bind': ")))
615 620
616(defun ada-compile (ada-prefix-arg) 621(defun ada-compile (arg)
617 "Save the current buffer and compile it into the current program library. 622 "Save the current buffer and compile it into the current program library.
618Initialize the library if a prefix arg is given." 623Initialize the library if a prefix arg is given."
619 (interactive "P") 624 (interactive "P")
620 (let* ((ada-init (if (null ada-prefix-arg) "" "-n ")) 625 (let* ((ada-init (if (null arg) "" "-n "))
621 (ada-source-file (buffer-name))) 626 (ada-source-file (buffer-name)))
622 (compile 627 (compile
623 (concat "adacomp " ada-init "-l " ada-lib-dir-name " " ada-source-file)))) 628 (concat "adacomp " ada-init "-l " ada-lib-dir-name " " ada-source-file))))