Function: markdown-ts-at-table-p

markdown-ts-at-table-p is a byte-compiled function defined in markdown-ts-mode.el.gz.

Signature

(markdown-ts-at-table-p &optional POS ABUTTING)

Documentation

Return non-nil if POS is at or in a pipe table.

If POS is nil, use point. Return cons (pos . table-node) if POS is within a table, otherwise return nil. if POS is within a table but with parse errors, signal an error. If ABUTTING is non-nil, adjust POS to the nearest non-blank character. If the parsed table is in ERROR, return nil.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/markdown-ts-mode.el.gz
(defun markdown-ts-at-table-p (&optional pos abutting)
  "Return non-nil if POS is at or in a pipe table.
If POS is nil, use point.
Return cons (pos . table-node) if POS is within a table, otherwise
return nil.
if POS is within a table but with parse errors, signal an error.
If ABUTTING is non-nil, adjust POS to the nearest non-blank character.
If the parsed table is in ERROR, return nil."
  (setq pos (or pos (point)))
  (save-excursion
    (goto-char pos)
    ;; If point is on an empty line, it is never a table.
    (unless (and (eolp) (bolp))
      ;; If point is bol or eol it might be abutting a pipe symbol so
      ;; look forwards or backwards one character to test if that pos
      ;; is a table.
      (when abutting
        (setq pos (or (markdown-ts--table-abutting-pos pos) pos)))
      (when-let* ((row (markdown-ts--table-node-row nil pos)))
        (if (markdown-ts--table-parse-error-p row)
            ;; Do not use error or warning here.  Errors interfere with
            ;; the command loop.  Warnings are annoying.
            (progn
              (message "Incorrectly formatted Markdown table (parser error)")
              nil)
          (cons pos (treesit-search-forward
                     row
                     "\\`pipe_table\\'" 'backward)))))))