branch: externals/org
commit 3232cc16197d91439fc88f92afbce7947b72d449
Merge: e24c2408e7 84945f9de0
Author: Ihor Radchenko <yanta...@posteo.net>
Commit: Ihor Radchenko <yanta...@posteo.net>

    Merge branch 'bugfix'
---
 lisp/ob-core.el   |  6 +++++-
 lisp/org-table.el | 18 ++++++++++--------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index d1984b2d6f..2e0e86f70c 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -893,7 +893,11 @@ guess will be made."
                          (format "at position %S" (nth 5 info)))))
            (setq exec-start-time (current-time)
                   result
-                 (let ((r (save-current-buffer (funcall cmd body params))))
+                 (let ((r
+                         ;; Code block may move point in the buffer.
+                         ;; Make sure that the point remains on the
+                         ;; code block.
+                         (save-excursion (funcall cmd body params))))
                    (if (and (eq (cdr (assq :result-type params)) 'value)
                             (or (member "vector" result-params)
                                 (member "table" result-params))
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 37ce91570d..4a2623b553 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -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)

Reply via email to