[email protected] archives
 help / color / mirror / Atom feed
From: Ihor Radchenko <[email protected]>
To: Steinar Bang <[email protected]>
Cc: [email protected]
Subject: Re: [BUG] Got error opening existing org file in emacs 30.1 [9.7.11 (release_9.7.11 @ /usr/share/emacs/30.1/lisp/org/)]
Date: Sun, 16 Mar 2025 07:36:02 +0000	[thread overview]
Message-ID: <87o6y1e8bh.fsf@localhost> (raw)
In-Reply-To: <[email protected]>

[-- Attachment #1: Type: text/plain, Size: 491 bytes --]

Steinar Bang <[email protected]> writes:

>> As for Org mode, may you try another version of the patch (attached)?
>
> No change in behaviour with the patch compared to org-mode HEAD.
>
> I rebuilt org-mode with "make autoloads" and started a fresh emacs.
>
> When I open:
>  emacs ~/git/bang-bompom/README.org
> and then press TAB on the top item, the error occurs.
>
> The README above can be found here:
>  https://github.com/steinarb/bang-bompom/blob/master/README.org

What about the attached?

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v3-0001-org-mode-Be-more-aggressive-setting-tab-width-to-.patch --]
[-- Type: text/x-patch, Size: 2058 bytes --]

From 4d27f5ca930e38a72e44e15368c84db985adbcd4 Mon Sep 17 00:00:00 2001
Message-ID: <4d27f5ca930e38a72e44e15368c84db985adbcd4.1742110532.git.yantar92@posteo.net>
From: Ihor Radchenko <[email protected]>
Date: Wed, 12 Mar 2025 18:45:11 +0100
Subject: [PATCH v3] 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 <[email protected]>
Link: https://orgmode.org/list/[email protected]
---
 lisp/org.el | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index bc61a7c462..24c33d9cc0 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 (&rest _)
+  "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,16 @@ (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-local-variables-hook
+            #'org--set-tab-width 90 'local)
+  ;; In Emacs <30, editorconfig-mode uses advices, so we cannot rely
+  ;; upon `hack-local-variables-hook' to run after editorconfig
+  ;; tab-width settings are applied.
+  (add-hook 'editorconfig-after-apply-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


[-- Attachment #3: Type: text/plain, Size: 223 bytes --]


-- 
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>

  reply	other threads:[~2025-03-16  7:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-28 20:40 [BUG] Got error opening existing org file in emacs 30.1 [9.7.11 (release_9.7.11 @ /usr/share/emacs/30.1/lisp/org/)] Steinar Bang
2025-02-28 23:10 ` Rohit Patnaik
2025-03-11 18:32 ` Ihor Radchenko
2025-03-11 22:40   ` Steinar Bang
2025-03-12 17:47     ` Ihor Radchenko
2025-03-14 17:23       ` Steinar Bang
2025-03-14 18:15         ` Ihor Radchenko
2025-03-14 22:52           ` Steinar Bang
2025-03-15  7:42             ` Ihor Radchenko
2025-03-15 20:50               ` Steinar Bang
2025-03-16  7:36                 ` Ihor Radchenko [this message]
2025-03-17 18:23                   ` Steinar Bang
2025-03-22  8:23                     ` Ihor Radchenko
2025-09-27  7:07                       ` Steinar Bang
2025-09-27  7:29                         ` Steinar Bang
2025-09-27  8:28                         ` Steinar Bang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o6y1e8bh.fsf@localhost \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).