Function: simula-indent-line

simula-indent-line is a byte-compiled function defined in simula.el.gz.

Signature

(simula-indent-line)

Documentation

Indent this line as SIMULA code.

If simula-electric-indent is non-nil, indent previous line if necessary.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/simula.el.gz
(defun simula-indent-line ()
  "Indent this line as SIMULA code.
If `simula-electric-indent' is non-nil, indent previous line if necessary."
  (let ((origin (- (point-max) (point)))
	(indent (simula-calculate-indent))
	(case-fold-search t))
    (unwind-protect
	(if simula-electric-indent
	    (progn
	      ;;
	      ;; manually expand abbrev on last line, if any
	      ;;
	      (end-of-line 0)
	      (expand-abbrev)
	      ;; now maybe we should reindent that line
	      (beginning-of-line)
	      (skip-chars-forward " \t\f")
	      (if (and
		   (looking-at
		    "\\(end\\|if\\|then\\|else\\|when\\|otherwise\\)\\>")
		   (not (simula-context)))
		  ;; yes - reindent
		  (let ((post-indent (simula-calculate-indent)))
		    (if (eq (current-indentation) post-indent)
			()
		      (delete-horizontal-space)
		      (indent-to post-indent))))))
      (goto-char (- (point-max) origin))
      (if (eq (current-indentation) indent)
	  (back-to-indentation)
	(delete-horizontal-space)
	(indent-to indent)))))