From de196f0127f3abf9e85c71b88263cba9de4b1b64 Mon Sep 17 00:00:00 2001 From: Elle Najt Date: Wed, 12 Feb 2025 21:13:58 -0500 Subject: [PATCH] Go to end of source block before org-table-align This is necessary because otherwise blocks like this: x | x Will turn into x | x x | x | Since org-table-align will get called on | x, and turn it into | x | I'm noticing this problem because of the automatic black formatting, which frequently puts |'s at the start of lines. --- ob-python-extras.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ob-python-extras.el b/ob-python-extras.el index f9e65e6..57132f7 100644 --- a/ob-python-extras.el +++ b/ob-python-extras.el @@ -315,7 +315,9 @@ with open(exec_file, 'r') as file: (save-excursion (with-current-buffer (current-buffer) (goto-char top-of-src-block) - (forward-line 1) + (if (re-search-forward "^#\\+end_src" nil t) + (forward-line 1) + ()) (let ((in-table nil)) (while (and (= (forward-line) 0) (not (looking-at "^[ \t]*:END:[ \t]*$")))