Function: table--update-cell

table--update-cell is a byte-compiled function defined in table.el.gz.

Signature

(table--update-cell &optional NOW)

Documentation

Update the table cell contents.

When the optional parameter NOW is nil it only sets up the update timer. If it is non-nil the function copies the contents of the cell cache buffer into the designated cell in the table buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/table.el.gz
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Cell updating functions
;;

(defun table--update-cell (&optional now)
  "Update the table cell contents.
When the optional parameter NOW is nil it only sets up the update
timer.  If it is non-nil the function copies the contents of the cell
cache buffer into the designated cell in the table buffer."
  (if (null table-update-timer) nil
    (cancel-timer table-update-timer)
    (setq table-update-timer nil))
  (if (or (not now)
	  (and (boundp 'quail-converting)
	       quail-converting) ;; defer operation while current quail work is not finished.
	  (and (boundp 'quail-translating)
	       quail-translating))
      (setq table-update-timer
            (run-with-idle-timer table-time-before-update
                                 nil
                                 (function table--update-cell)
                                 'now))
    (save-current-buffer
      (set-buffer table-cell-buffer)
      (let ((cache-buffer (get-buffer-create table-cache-buffer-name))
	    (org-coord (table--get-coordinate))
            (fixed table-fixed-width-mode)
	    (in-cell (equal (table--cell-to-coord (table--probe-cell))
			    (cons table-cell-info-lu-coordinate table-cell-info-rb-coordinate)))
	    rectangle)
	(set-buffer cache-buffer)
        (setq-local table-fixed-width-mode fixed)
	(setq rectangle
	      (extract-rectangle
	       1
	       (table--goto-coordinate (cons table-cell-info-width (1- table-cell-info-height)))))
	(set-buffer table-cell-buffer)
	(delete-rectangle (table--goto-coordinate table-cell-info-lu-coordinate)
			  (table--goto-coordinate table-cell-info-rb-coordinate))
	(table--goto-coordinate table-cell-info-lu-coordinate)
	(table--insert-rectangle rectangle)
	(let* ((cell (table--probe-cell))) ; must probe again in case of wide characters
	  (table--put-cell-property cell)
	  (table--put-cell-justify-property cell table-cell-info-justify)
	  (table--put-cell-valign-property cell table-cell-info-valign))
	(table--goto-coordinate
	 (if in-cell
	     (table--transcoord-cache-to-table table-cell-cache-point-coordinate)
	   org-coord))))
    ;; simulate undo behavior under overwrite-mode
    (if (and overwrite-mode (not (eq buffer-undo-list t)))
	(setq buffer-undo-list (cons nil buffer-undo-list)))))