Function: indent-next-tab-stop
indent-next-tab-stop is a byte-compiled function defined in
indent.el.gz.
Signature
(indent-next-tab-stop COLUMN &optional PREV)
Documentation
Return the next tab stop after COLUMN.
If PREV is non-nil, return the previous one instead.
Source Code
;; Defined in /usr/src/emacs/lisp/indent.el.gz
(defun indent-next-tab-stop (column &optional prev)
"Return the next tab stop after COLUMN.
If PREV is non-nil, return the previous one instead."
(let ((tabs tab-stop-list))
(while (and tabs (>= column (car tabs)))
(setq tabs (cdr tabs)))
(if tabs
(if (not prev)
(car tabs)
(let ((prevtabs (cdr (memq (car tabs) (reverse tab-stop-list)))))
(if (null prevtabs) 0
(if (= column (car prevtabs))
(or (nth 1 prevtabs) 0)
(car prevtabs)))))
;; We passed the end of tab-stop-list: guess a continuation.
(let* ((last2 (last tab-stop-list 2))
(step (if (cdr last2) (- (cadr last2) (car last2)) tab-width))
(last (or (cadr last2) (car last2) 0)))
;; Repeat the last tab's length.
(+ last (* step (if prev
(if (<= column last) -1 (/ (- column last 1) step))
(1+ (/ (- column last) step)))))))))