orgtbl-gather-send-defs: Fix infinite loop when table is at bob

* lisp/org-table.el (orgtbl-gather-send-defs): Avoid infinite loop
when table is at the beginning of buffer.

Reported-by: Rustom Mody <rustompmody@gmail.com>
Link: https://orgmode.org/list/CAJ+Teoehk30LKVCTwMy0uREBHkNVBvrOLDZYboUQ4wBV6Fnwzw@mail.gmail.com
This commit is contained in:
Ihor Radchenko 2024-06-12 15:31:45 +02:00
parent a0950e9432
commit 84945f9de0
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 10 additions and 8 deletions

View File

@ -5477,14 +5477,16 @@ a radio table."
(goto-char (org-table-begin))
(let (rtn)
(forward-line -1)
(while (looking-at "[ \t]*#\\+ORGTBL[: \t][ \t]*SEND[ \t]+\\([^ \t\r\n]+\\)[ \t]+\\([^ \t\r\n]+\\)\\([ \t]+.*\\)?")
(let ((name (org-no-properties (match-string 1)))
(transform (intern (match-string 2)))
(params (if (match-end 3)
(read (concat "(" (match-string 3) ")")))))
(push (list :name name :transform transform :params params)
rtn)
(forward-line -1)))
(catch :bob
(while (looking-at "[ \t]*#\\+ORGTBL[: \t][ \t]*SEND[ \t]+\\([^ \t\r\n]+\\)[ \t]+\\([^ \t\r\n]+\\)\\([ \t]+.*\\)?")
(let ((name (org-no-properties (match-string 1)))
(transform (intern (match-string 2)))
(params (if (match-end 3)
(read (concat "(" (match-string 3) ")")))))
(push (list :name name :transform transform :params params)
rtn)
(when (bobp) (throw :bob nil))
(forward-line -1))))
rtn)))
(defun orgtbl-send-replace-tbl (name text)