Function: rst-indent-line

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

Signature

(rst-indent-line &optional DFLT)

Documentation

Indent current line to next best reStructuredText tab.

The next best tab is taken from the tab list returned by rst-compute-tabs which is used in a cyclic manner. If the current indentation does not end on a tab use the first one. If the current indentation is on a tab use the next tab. This allows a repeated use of TAB (indent-for-tab-command) to cycle through all possible tabs. If no indentation is possible return noindent or use DFLT. Return the indentation indented to. When point is in indentation it ends up at its end. Otherwise the point is kept relative to the content.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/rst.el.gz
(defun rst-indent-line (&optional dflt)
  "Indent current line to next best reStructuredText tab.
The next best tab is taken from the tab list returned by
`rst-compute-tabs' which is used in a cyclic manner.  If the
current indentation does not end on a tab use the first one.  If
the current indentation is on a tab use the next tab.  This allows
a repeated use of \\[indent-for-tab-command] to cycle through all
possible tabs.  If no indentation is possible return `noindent' or
use DFLT.  Return the indentation indented to.  When point is in
indentation it ends up at its end.  Otherwise the point is kept
relative to the content."
  (let* ((pt (point-marker))
	 (cur (current-indentation))
	 (clm (current-column))
	 (tabs (rst-compute-tabs (point)))
	 (fnd (cl-position cur tabs :test #'equal))
	 ind)
    (if (and (not tabs) (not dflt))
	'noindent
      (if (not tabs)
	  (setq ind dflt)
	(if (not fnd)
	    (setq fnd 0)
	  (setq fnd (1+ fnd))
	  (if (>= fnd (length tabs))
	      (setq fnd 0)))
	(setq ind (nth fnd tabs)))
      (indent-line-to ind)
      (if (> clm cur)
	  (goto-char pt))
      (set-marker pt nil)
      ind)))