Unfold subtree before evaluating all source blocks

This is meant to mitigate an issue with table alignment when those tables are
results of source blocks, contain links in cells and are hidden (i.e., folded):
in those circumstances, the table alignment seems to be broken, because the cell
width does not take into account that links are shorter than their textual
representation.

I am not quite sure whether this is a bug in my configuration or a bug in Org
mode itself.  The function to compute cell width is `org-string-width`, but
maybe this function does not get passed the correct input when tables are folded
and need to be aligned?
This commit is contained in:
Daniel - 2023-07-17 20:14:09 +02:00
parent 0c0009b655
commit 1d33039dde
Signed by: dbo
GPG Key ID: 784AA8DF0CCDF625
1 changed files with 9 additions and 2 deletions

View File

@ -861,8 +861,15 @@ With given ARG, force reevaluation as described for
(interactive)
(unless (derived-mode-p 'org-mode)
(user-error "Not in Org buffer, aborting"))
(let ((org-confirm-babel-evaluate nil))
(org-babel-execute-subtree arg)))
;; Since Org 9.6, we expand all folding before evaluating the current subtree,
;; because `org-string-width' (called by `org-table-align') sometimes computes
;; the wrong cell width in tables if those contain links. Is this a bug in
;; Org mode? Maybe the input to `org-string-width' is not correct?
(org-fold-core-save-visibility :use-markers
(org-fold-show-all)
(let ((org-confirm-babel-evaluate nil))
(org-babel-execute-subtree arg))))
;;; Custom link handlers