Function: idlwave-indent-line

idlwave-indent-line is an interactive and byte-compiled function defined in idlwave.el.gz.

Signature

(idlwave-indent-line &optional EXPAND)

Documentation

Indent current IDL line as code or as a comment.

The actions in idlwave-indent-action-table are performed. If the optional argument EXPAND is non-nil then the actions in idlwave-indent-expand-table are performed.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/idlwave.el.gz
(defun idlwave-indent-line (&optional expand)
  "Indent current IDL line as code or as a comment.
The actions in `idlwave-indent-action-table' are performed.
If the optional argument EXPAND is non-nil then the actions in
`idlwave-indent-expand-table' are performed."
  (interactive)
  ;; Move point out of left margin.
  (if (save-excursion
        (skip-chars-backward " \t")
        (bolp))
      (skip-chars-forward " \t"))
  (let ((mloc (point-marker)))
    (save-excursion
      (beginning-of-line)
      (if (looking-at idlwave-comment-line-start-skip)
          ;; Indentation for a line comment
          (progn
            (skip-chars-forward " \t")
            (idlwave-indent-left-margin (idlwave-comment-hook)))
        ;;
        ;; Code Line
        ;;
        ;; Before indenting, run action routines.
        ;;
        (if (and expand idlwave-do-actions)
            (mapc #'idlwave-do-action idlwave-indent-expand-table))
        ;;
        (if idlwave-do-actions
            (mapc #'idlwave-do-action idlwave-indent-action-table))
        ;;
        ;; No longer expand abbrevs on the line.  The user can do this
        ;; manually using expand-region-abbrevs.
        ;;
        ;; Indent for code line
        ;;
        (beginning-of-line)
        (if (or
             ;; a label line
             (looking-at (concat "^" idlwave-label "[ \t]*$"))
             ;; a batch command
             (looking-at "^[ \t]*@"))
            ;; leave flush left
            nil
          ;; indent the line
          (idlwave-indent-left-margin (idlwave-calculate-indent)))
        ;; Adjust parallel comment
	(end-of-line)
	(if (idlwave-in-comment)
            (let ((fill-column (1- (frame-width))))
	      (indent-for-comment)))))
    (goto-char mloc)
    ;; Get rid of marker
    (set-marker mloc nil)))