From ce10179cc28986d9260d0f66f42499e66b96e82d Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Fri, 1 May 2020 15:00:47 +0200 Subject: [PATCH] table: `org-table-to-lisp' does not check if point is at a table * lisp/org-table.el (org-table-to-lisp): Do not check if point is at a table. Leave it to the caller. See . --- etc/ORG-NEWS | 6 ++++++ lisp/org-table.el | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index ae5aad529..c10e82f53 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -324,6 +324,12 @@ From ~org-enable-priority-commands~ to ~org-priority-enable-commands~. From ~org-show-priority~ to ~org-priority-show~. ** Miscellaneous +*** ~org-table-to-lisp~ no longer checks if point is at a table +The caller is now responsible for the check. It can use, e.g., +~org-at-table-p~. + +The function is also much more efficient than it used to, even on very +large tables. *** New function : ~org-collect-keywords~ *** Drawers' folding use an API similar to block's diff --git a/lisp/org-table.el b/lisp/org-table.el index 735c3d732..3b47d27b2 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -5463,6 +5463,7 @@ a radio table." ;;;###autoload (defun org-table-to-lisp (&optional txt) "Convert the table at point to a Lisp structure. + The structure will be a list. Each item is either the symbol `hline' for a horizontal separator line, or a list of field values as strings. The table is taken from the parameter TXT, or from the buffer at point." @@ -5471,7 +5472,6 @@ The table is taken from the parameter TXT, or from the buffer at point." (insert txt) (goto-char (point-min)) (org-table-to-lisp)) - (unless (org-at-table-p) (user-error "No table at point")) (save-excursion (goto-char (org-table-begin)) (let ((table nil))