Function: icon-indent-command

icon-indent-command is an interactive and byte-compiled function defined in icon.el.gz.

Signature

(icon-indent-command &optional WHOLE-EXP)

Documentation

Indent current line as Icon code, or in some cases insert a tab character.

If icon-tab-always-indent is non-nil (the default), always indent current line. Otherwise, indent the current line only if point is at the left margin or in the line's indentation; otherwise insert a tab.

A numeric argument, regardless of its value, means indent rigidly all the lines of the expression starting after point so that this line becomes properly indented. The relative indentation among the lines of the expression are preserved.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/icon.el.gz
(defun icon-indent-command (&optional whole-exp)
  "Indent current line as Icon code, or in some cases insert a tab character.
If `icon-tab-always-indent' is non-nil (the default), always indent current
line.  Otherwise, indent the current line only if point is at the left margin
or in the line's indentation; otherwise insert a tab.

A numeric argument, regardless of its value, means indent rigidly all the
lines of the expression starting after point so that this line becomes
properly indented.  The relative indentation among the lines of the
expression are preserved."
  (interactive "P")
  (if whole-exp
      ;; If arg, always indent this line as Icon
      ;; and shift remaining lines of expression the same amount.
      (let ((shift-amt (icon-indent-line))
	    beg end)
	(save-excursion
	  (if icon-tab-always-indent
	      (beginning-of-line))
	  (setq beg (point))
	  (forward-sexp 1)
	  (setq end (point))
	  (goto-char beg)
	  (forward-line 1)
	  (setq beg (point)))
	(if (> end beg)
	    (indent-code-rigidly beg end shift-amt "#")))
    (if (and (not icon-tab-always-indent)
	     (save-excursion
	       (skip-chars-backward " \t")
	       (not (bolp))))
	(insert-tab)
      (icon-indent-line))))