Function: markdown-ts-table-next-row

markdown-ts-table-next-row is an interactive and byte-compiled function defined in markdown-ts-mode.el.gz.

Signature

(markdown-ts-table-next-row &optional N)

Documentation

Move to the next row in the table.

If N is negative, move to the previous row. If point is on the last row of the table, insert a new row below and move into it. With a prefix argument, clone the final row into the new one. If not in a table, do nothing.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/markdown-ts-mode.el.gz
(defun markdown-ts-table-next-row (&optional n)
  "Move to the next row in the table.
If N is negative, move to the previous row.
If point is on the last row of the table, insert a new row below and
move into it.  With a prefix argument, clone the final row into the new
one.
If not in a table, do nothing."
  (interactive)
  (markdown-ts--barf-if-not-mode 'markdown-ts-table-next-row)
  (let ((backwards (and n (< n 0))))
    ;; Don't use `markdown-ts--table-body-row-near-pos' because we want
    ;; to operate in the header.
    (when-let* ((at-table (markdown-ts-at-table-p nil t))
                (pos (car at-table))
                (table (cdr at-table))
                (row (markdown-ts--table-node-row nil pos)))
      ;; If no next or prev sibling, we're on the last/first row.
      (let ((current-column (current-column))
            (next-row (if backwards
                          (treesit-node-prev-sibling row 'named)
                        (treesit-node-next-sibling row 'named))))
        (if next-row
            (goto-char (treesit-node-start next-row))
          (unless backwards
            (markdown-ts-table-insert-row-below current-prefix-arg)))
        (move-to-column current-column)))))