Function: table--generate-source-cell-contents

table--generate-source-cell-contents is a byte-compiled function defined in table.el.gz.

Signature

(table--generate-source-cell-contents DEST-BUFFER LANGUAGE CELL)

Documentation

Generate and insert source cell contents of a CELL into DEST-BUFFER.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/table.el.gz
(defun table--generate-source-cell-contents (dest-buffer language cell)
  "Generate and insert source cell contents of a CELL into DEST-BUFFER."
  (let ((cell-contents (extract-rectangle (car cell) (cdr cell))))
    (with-temp-buffer
      (table--insert-rectangle cell-contents)
      (table--remove-cell-properties (point-min) (point-max))
      (goto-char (point-min))
      (cond
       ((eq language 'html)
	(if table-html-delegate-spacing-to-user-agent
	    (progn
	      (table--remove-eol-spaces (point-min) (point-max))
	      (if (re-search-forward "\\s +\\'" nil t)
		  (replace-match "")))
	  (while (search-forward " " nil t)
	    (replace-match " "))
	  (goto-char (point-min))
	  (while (and (re-search-forward "$" nil t)
		      (not (eobp)))
	    (insert "<br />")
	    (forward-char 1))))
       ((eq language 'cals)
	(table--remove-eol-spaces (point-min) (point-max))
	(if (re-search-forward "\\s +\\'" nil t)
	    (replace-match "")))
       )
      (setq cell-contents (buffer-substring (point-min) (point-max))))
    (with-current-buffer dest-buffer
      (let ((beg (point)))
	(insert cell-contents)
	(when (memq language '(html cals))
	  (indent-rigidly beg (point)
			  (cond
			   ((eq language 'html) 6)
			   ((eq language 'cals) 10)))
	(insert ?\n))))))