branch: externals/org-modern commit 4cac2a4b18296f48e022c4a935cb66da99eda426 Author: Steven Allen <ste...@stebalien.com> Commit: Daniel Mendler <m...@daniel-mendler.de>
Fix out-of-range error when formatting tables in truncated files When a file/buffer has no trailing newline, org-modern signals an error here. Obviously this is an issue with the file itself, but we might as well handle it gracefully. --- org-modern.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org-modern.el b/org-modern.el index e4605a66ab..d524c9d73f 100644 --- a/org-modern.el +++ b/org-modern.el @@ -593,7 +593,7 @@ whole buffer; otherwise, for the line at point." (when separator (when (numberp org-modern-table-horizontal) (add-face-text-property tbeg tend org-modern--table-overline 'append) - (add-face-text-property beg (1+ end) `(:height ,org-modern-table-horizontal) 'append)) + (add-face-text-property beg (min (1+ end) (point-max)) `(:height ,org-modern-table-horizontal) 'append)) (while (re-search-forward "[^|+]+" tend 'noerror) (let ((a (match-beginning 0)) (b (match-end 0)))