(defun indent-relative (&optional unindented-ok) "Space out to under next indent point in previous nonblank line. An indent point is a non-whitespace character following whitespace. The following line shows the indentation points in this line. ^ ^ ^ ^ ^ ^ ^ ^ ^ If the previous nonblank line has no indent points beyond the column point starts at, `tab-to-tab-stop' is done instead, unless this command is invoked with a numeric argument, in which case it does nothing. See also `indent-relative-maybe'." (interactive "P") (if (and abbrev-mode (eq (char-syntax (preceding-char)) ?w)) (expand-abbrev)) (let ((start-column (current-column)) indent) (save-excursion (beginning-of-line) (if (re-search-backward "^[^\n]" nil t) (let ((end (save-excursion (forward-line 1) (point)))) (move-to-column start-column) ;; Is start-column inside a tab on this line? (if (> (current-column) start-column) (backward-char 1)) (or (looking-at "[ \t]") unindented-ok (skip-chars-forward "^ \t" end)) (skip-chars-forward " \t" end) (or (= (point) end) (setq indent (current-column)))))) (if indent (let ((opoint (point-marker))) (delete-region (point) (progn (skip-chars-backward " \t") (point))) (indent-to indent 0) (if (> opoint (point)) (goto-char opoint)) (move-marker opoint nil)) (tab-to-tab-stop))))
How would I modify this function so that it aligns the current line with the indentation point in the next, as opposed to the previous, line?