Function: table-recognize-cell
table-recognize-cell is an autoloaded, interactive and byte-compiled
function defined in table.el.gz.
Signature
(table-recognize-cell &optional FORCE NO-COPY ARG)
Documentation
Recognize a table cell that contains current point.
Probe the cell dimension and prepare the cell information. The optional two arguments FORCE and NO-COPY are for internal use only and must not be specified. When the optional numeric prefix argument ARG is negative the cell becomes inactive, meaning that the cell becomes 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-cell (&optional force no-copy arg)
"Recognize a table cell that contains current point.
Probe the cell dimension and prepare the cell information. The
optional two arguments FORCE and NO-COPY are for internal use only and
must not be specified. When the optional numeric prefix argument ARG
is negative the cell becomes inactive, meaning that the cell becomes
plain text and loses all the table specific features."
(interactive "i\ni\np")
(table--make-cell-map)
(if (or force (not (memq real-last-command table-command-list)))
(let* ((cell (table--probe-cell (called-interactively-p 'interactive)))
(cache-buffer (get-buffer-create table-cache-buffer-name))
(modified-flag (buffer-modified-p))
(inhibit-read-only t))
(unwind-protect
(unless (null cell)
;; initialize the cell info variables
(let ((lu-coordinate (table--get-coordinate (car cell)))
(rb-coordinate (table--get-coordinate (cdr cell))))
;; update the previous cell if this cell is different from the previous one.
;; care only lu but ignore rb since size change does not matter.
(unless (equal table-cell-info-lu-coordinate lu-coordinate)
(table--finish-delayed-tasks))
(setq table-cell-info-lu-coordinate lu-coordinate)
(setq table-cell-info-rb-coordinate rb-coordinate)
(setq table-cell-info-width (- (car table-cell-info-rb-coordinate)
(car table-cell-info-lu-coordinate)))
(setq table-cell-info-height (+ (- (cdr table-cell-info-rb-coordinate)
(cdr table-cell-info-lu-coordinate)) 1))
(setq table-cell-info-justify (table--get-cell-justify-property cell))
(setq table-cell-info-valign (table--get-cell-valign-property cell)))
;; set/remove table cell properties
(if (< (prefix-numeric-value arg) 0)
(let ((coord (table--get-coordinate (car cell)))
(n table-cell-info-height))
(save-excursion
(while (> n 0)
(table--remove-cell-properties
(table--goto-coordinate coord)
(table--goto-coordinate (cons (+ (car coord) table-cell-info-width 1) (cdr coord))))
(setq n (1- n))
(setcdr coord (1+ (cdr coord))))))
(table--put-cell-property cell))
;; copy the cell contents to the cache buffer
;; only if no-copy is nil and timers are not set
(unless no-copy
(setq table-cell-cache-point-coordinate (table--transcoord-table-to-cache))
(setq table-cell-cache-mark-coordinate (table--transcoord-table-to-cache
(table--get-coordinate (marker-position (mark-marker)))))
(setq table-cell-buffer (current-buffer))
(let ((rectangle (extract-rectangle (car cell)
(cdr cell))))
(save-current-buffer
(set-buffer cache-buffer)
(erase-buffer)
(table--insert-rectangle rectangle)))))
(restore-buffer-modified-p modified-flag))
cell)))