Function: tcl-indent-line
tcl-indent-line is a byte-compiled function defined in tcl.el.gz.
Signature
(tcl-indent-line)
Documentation
Indent current line as Tcl code.
Return the amount the indentation changed by.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/tcl.el.gz
(defun tcl-indent-line ()
"Indent current line as Tcl code.
Return the amount the indentation changed by."
(let ((indent (tcl-calculate-indent nil))
beg shift-amt
(case-fold-search nil)
(pos (- (point-max) (point))))
(if (null indent)
'noindent
(beginning-of-line)
(setq beg (point))
(skip-chars-forward " \t")
(if (listp indent) (setq indent (car indent)))
(cond ((= (following-char) ?})
(setq indent (- indent tcl-indent-level)))
((= (following-char) ?\])
(setq indent (- indent 1))))
(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)))