Function: table-release

table-release is an autoloaded, interactive and byte-compiled function defined in table.el.gz.

Signature

(table-release)

Documentation

Convert a table into plain text by removing the frame from a table.

Remove the frame from a table and deactivate the table. This command converts a table into plain text without frames. It is a companion to table-capture which does the opposite process.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/table.el.gz
;;;###autoload
(defun table-release ()
  "Convert a table into plain text by removing the frame from a table.
Remove the frame from a table and deactivate the table.  This command
converts a table into plain text without frames.  It is a companion to
`table-capture' which does the opposite process."
  (interactive)
  (let ((origin-cell (table--probe-cell))
	table-lu table-rb)
    (if origin-cell
	(let ((old-point (point-marker)))
	  ;; save-excursion is not sufficient for this
	  ;; because untabify operation moves point
	  (set-marker-insertion-type old-point t)
	  (unwind-protect
	      (progn
		(while
		    (progn
		      (table-forward-cell 1 nil 'unrecognize)
		      (let ((cell (table--probe-cell)))
			(if (or (null table-lu)
				(< (car cell) table-lu))
			    (setq table-lu (car cell)))
			(if (or (null table-rb)
				(> (cdr cell) table-rb))
			    (setq table-rb (cdr cell)))
			(and cell (not (equal cell origin-cell))))))
		(let* ((lu-coord (table--get-coordinate table-lu))
		       (rb-coord (table--get-coordinate table-rb))
		       (lu (table--goto-coordinate (table--offset-coordinate lu-coord '(-1 . -1)))))
		  (table--spacify-frame)
		  (setcdr rb-coord (1+ (cdr rb-coord)))
		  (delete-rectangle lu (table--goto-coordinate (cons (car lu-coord) (cdr rb-coord))))
		  (table--remove-eol-spaces
		   (table--goto-coordinate (cons 0 (1- (cdr lu-coord))))
		   (table--goto-coordinate rb-coord) nil t)))
	    (goto-char old-point))))))