Bladeren bron

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 <http://lists.gnu.org/r/emacs-orgmode/2020-05/msg00000.html>.
Nicolas Goaziou 5 jaren geleden
bovenliggende
commit
ce10179cc2
2 gewijzigde bestanden met toevoegingen van 7 en 1 verwijderingen
  1. 6 0
      etc/ORG-NEWS
  2. 1 1
      lisp/org-table.el

+ 6 - 0
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~.
 From ~org-show-priority~ to ~org-priority-show~.
 
 
 ** Miscellaneous
 ** 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~
 *** New function : ~org-collect-keywords~
 *** Drawers' folding use an API similar to block's
 *** Drawers' folding use an API similar to block's
 
 

+ 1 - 1
lisp/org-table.el

@@ -5463,6 +5463,7 @@ a radio table."
 ;;;###autoload
 ;;;###autoload
 (defun org-table-to-lisp (&optional txt)
 (defun org-table-to-lisp (&optional txt)
   "Convert the table at point to a Lisp structure.
   "Convert the table at point to a Lisp structure.
+
 The structure will be a list.  Each item is either the symbol `hline'
 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.
 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."
 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)
         (insert txt)
         (goto-char (point-min))
         (goto-char (point-min))
         (org-table-to-lisp))
         (org-table-to-lisp))
-    (unless (org-at-table-p) (user-error "No table at point"))
     (save-excursion
     (save-excursion
       (goto-char (org-table-begin))
       (goto-char (org-table-begin))
       (let ((table nil))
       (let ((table nil))