Function: table-recognize
table-recognize is an autoloaded, interactive and byte-compiled
function defined in table.el.gz.
Signature
(table-recognize &optional ARG)
Documentation
Recognize all tables within the current buffer and activate them.
Scans the entire buffer and recognizes valid table cells. If the optional numeric prefix argument ARG is negative the tables in the buffer become inactive, meaning the tables become plain text and loses all the table specific features.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/table.el.gz
;;;###autoload
(defun table-recognize (&optional arg)
"Recognize all tables within the current buffer and activate them.
Scans the entire buffer and recognizes valid table cells. If the
optional numeric prefix argument ARG is negative the tables in the
buffer become inactive, meaning the tables become plain text and loses
all the table specific features."
(interactive "P")
(setq arg (prefix-numeric-value arg))
(let* ((inhibit-read-only t))
(table-recognize-region (point-min) (point-max) -1)
(if (>= arg 0)
(save-excursion
(goto-char (point-min))
(let* ((border (format "[%s%c%c]"
table-cell-horizontal-chars
table-cell-vertical-char
table-cell-intersection-char))
(border3 (concat border border border))
(non-border (format "^[^%s%c%c]*$"
table-cell-horizontal-chars
table-cell-vertical-char
table-cell-intersection-char)))
;; `table-recognize-region' is an expensive function so minimize
;; the search area. A minimum table at least consists of three consecutive
;; table border characters to begin with such as
;; +-+
;; |A|
;; +-+
;; and any tables end with a line containing no table border characters
;; or the end of buffer.
(while (and (re-search-forward border3 (point-max) t)
(not (and (input-pending-p)
table-abort-recognition-when-input-pending)))
(message "Recognizing tables...(%d%%)"
(floor (* 100.0 (match-beginning 0))
(- (point-max) (point-min))))
(let ((beg (match-beginning 0))
end)
(if (re-search-forward non-border (point-max) t)
(setq end (match-beginning 0))
(setq end (goto-char (point-max))))
(table-recognize-region beg end arg)))
(message "Recognizing tables...done"))))))