Function: markdown-table-move-column

markdown-table-move-column is an interactive and byte-compiled function defined in markdown-mode.el.

Signature

(markdown-table-move-column &optional LEFT)

Documentation

Move table column at point to the right.

With optional argument LEFT, move it to the left.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-table-move-column (&optional left)
  "Move table column at point to the right.
With optional argument LEFT, move it to the left."
  (interactive "P")
  (unless (markdown-table-at-point-p)
    (user-error "Not at a table"))
  (let* ((col (markdown-table-get-column))
         (col1 (if left (1- col) col))
         (colpos (if left (1- col) (1+ col)))
         (begin (markdown-table-begin))
         (end (copy-marker (markdown-table-end))))
    (when (and left (= col 1))
      (user-error "Cannot move column further left"))
    (when (and (not left) (looking-at "[^|\n]*|[^|\n]*$"))
      (user-error "Cannot move column further right"))
    (markdown-table-save-cell
     (goto-char begin)
     (while (< (point) end)
       (markdown-table-goto-column col1 t)
       (when (looking-at "|\\(\\(?:\\\\|\\|[^|\n]\\|\\)+\\)|\\(\\(?:\\\\|\\|[^|\n]\\|\\)+\\)|")
         (replace-match "|\\2|\\1|"))
       (forward-line)))
    (set-marker end nil)
    (markdown-table-goto-column colpos)
    (when markdown-table-align-p
      (markdown-table-align))))