Function: orgtbl-send-replace-tbl

orgtbl-send-replace-tbl is a byte-compiled function defined in org-table.el.gz.

Signature

(orgtbl-send-replace-tbl NAME TEXT)

Documentation

Find and replace table NAME with TEXT.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-table.el.gz
(defun orgtbl-send-replace-tbl (name text)
  "Find and replace table NAME with TEXT."
  (save-excursion
    (goto-char (point-min))
    (let* ((location-flag nil)
	   (name (regexp-quote name))
	   (begin-re (format "BEGIN +RECEIVE +ORGTBL +%s\\([ \t]\\|$\\)" name))
	   (end-re (format "END +RECEIVE +ORGTBL +%s\\([ \t]\\|$\\)" name)))
      (while (re-search-forward begin-re nil t)
	(unless location-flag (setq location-flag t))
	(let ((beg (line-beginning-position 2)))
	  (unless (re-search-forward end-re nil t)
	    (user-error "Cannot find end of receiver location at %d" beg))
	  (beginning-of-line)
	  (delete-region beg (point))
	  (insert text "\n")))
      (unless location-flag
	(user-error "No valid receiver location found in the buffer")))))