Function: icon-indent-line
icon-indent-line is a byte-compiled function defined in icon.el.gz.
Signature
(icon-indent-line)
Documentation
Indent current line as Icon code.
Return the amount the indentation changed by.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/icon.el.gz
(defun icon-indent-line ()
"Indent current line as Icon code.
Return the amount the indentation changed by."
(let ((indent (calculate-icon-indent nil))
beg shift-amt
(case-fold-search nil)
(pos (- (point-max) (point))))
(beginning-of-line)
(setq beg (point))
(cond ((eq indent nil)
(setq indent (current-indentation)))
((looking-at "^#")
(setq indent 0))
(t
(skip-chars-forward " \t")
(if (listp indent) (setq indent (car indent)))
(cond ((and (looking-at "else\\b")
(not (looking-at "else\\s_")))
(setq indent (save-excursion
(icon-backward-to-start-of-if)
(current-indentation))))
((or (= (following-char) ?})
(looking-at "end\\b"))
(setq indent (- indent icon-indent-level)))
((= (following-char) ?{)
(setq indent (+ indent icon-brace-offset))))))
(skip-chars-forward " \t")
(setq shift-amt (- indent (current-column)))
(if (zerop shift-amt)
(if (> (- (point-max) pos) (point))
(goto-char (- (point-max) pos)))
(delete-region beg (point))
(indent-to indent)
;; If initial point was within line's indentation,
;; position after the indentation. Else stay at same point in text.
(if (> (- (point-max) pos) (point))
(goto-char (- (point-max) pos))))
shift-amt))