Steinar Bang <s...@dod.no> writes: > Bisected my .emacs and this was the culprit: > > ;; editorconfig formatting support > ;;;================================ > (when (locate-library "editorconfig") > (editorconfig-mode 1) > (setq editorconfig-exclude-regexps '("\\.jar$"))) > > Upgrading editorconfig to newest in melpa didn't help. > > Neither did trying to exclude org files from editorconfig. > > But in any case, not a bug in org mode..
This is not the first time we are getting editorconfig clashing with Org settings. May you try the attached patch? It should override editorconfig settings.
>From 23ecab7afe592df54fad0608eeb0888d74f3ba42 Mon Sep 17 00:00:00 2001 Message-ID: <23ecab7afe592df54fad0608eeb0888d74f3ba42.1741801559.git.yanta...@posteo.net> From: Ihor Radchenko <yanta...@posteo.net> Date: Wed, 12 Mar 2025 18:45:11 +0100 Subject: [PATCH] org-mode: Be more aggressive setting tab-width to 8 * lisp/org.el (org--set-tab-width): New helper to set `tab-width'. (org-mode): Override file-local and directory-local settings for `tab-width', if any. With non-standard `tab-width', parser cannot work properly. Reported-by: Steinar Bang <s...@dod.no> Link: https://orgmode.org/list/87msdrw5qt....@dod.no --- lisp/org.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index bc61a7c462..ee2d6eaa32 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4970,6 +4970,10 @@ (defvar org-mode-tags-syntax-table st) "Syntax table including \"@\" and \"_\" as word constituents.") +(defun org--set-tab-width () + "Set `tab-width' to be 8." + (setq-local tab-width 8)) + ;;;###autoload (define-derived-mode org-mode outline-mode "Org" "Outline-based notes management and organizer, alias @@ -4992,7 +4996,11 @@ (define-derived-mode org-mode outline-mode "Org" (setq-local org-mode-loading t) ;; Force tab width - indentation is significant in lists, so we need ;; to make sure that it is consistent across configurations. - (setq-local tab-width 8) + (org--set-tab-width) + ;; Really force it, even if dir-locals or file-locals set it - we + ;; need tab-width = 8 as a part of Org syntax. + (add-hook 'hack-dir-local-get-variables-functions + #'org--set-tab-width -90 'local) (org-load-modules-maybe) (when org-agenda-file-menu-enabled (org-install-agenda-files-menu)) -- 2.47.1
-- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>