From 9dbdb854b98611451e746c2100fa1577bb924802 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 29 Jan 2022 18:42:20 +0100 Subject: [PATCH] fix(org): bounds for inline images in babel results org-babel-result-end can return the wrong position if cursor is in a src block (which is where it will be when org-babel-after-execute-hook triggers). Amend: 451be94fb8c7 --- modules/lang/org/config.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 9e5001851..709fb87f5 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -314,9 +314,10 @@ Also adds support for a `:sync' parameter to override `:async'." ;; ...and not while tangling org buffers (which happens in a temp ;; buffer where `buffer-file-name' is nil). (string-match-p "^ \\*temp" (buffer-name))) - (when-let ((beg (org-babel-where-is-src-block-result)) - (end (org-babel-result-end))) - (org-display-inline-images nil nil (min beg end) (max beg end)))))) + (save-excursion + (when-let ((beg (org-babel-where-is-src-block-result)) + (end (progn (goto-char beg) (forward-line) (org-babel-result-end))))) + (org-display-inline-images nil nil (min beg end) (max beg end)))))) (after! python (unless org-babel-python-command