rougier / nano-emacs

GNU Emacs / N Λ N O - Emacs made simple
GNU General Public License v3.0
2.5k stars 191 forks source link

[Bug] Org-mode headings in source code blocks override indentation and formatting from src code block #136

Closed wakatara closed 1 year ago

wakatara commented 1 year ago

Sorry, another bug report. Pretty sure this is nano-emacs since I disabled my mods and org-bullets.

It appears that when you have org-mode headings inside a source code block, nano overrides the formatting of the source code block with org-mode formatting (and left indents everything rather than honouring the source code block format and indent level.

Steps to reproduce

Paste the following into an org-mode document under nano.

#+begin_src elisp

("r" "Rez" plain "%?"
     :target (file+head "~/Documents/org/refs/rez/${slug}.org"
"#+TITLE: ${title}
#+CREATED: %u
#+MODIFIED:

* ${title}
:PROPERTIES:
:Type:
:Start:
:Fin:
:Killed:
:Rating:
:Digested:
:Creator:
:URL:
:END:

** Actions

** Key Ideas
...
#+end_src

What Happens

Org-mode formatting and indenting overrides the source code block. Bullets and left indents heavily.

What Should Happen

nano should honour the source code block formatting and syntax highlighting.

(as always, thanks for doing such an amazing job on nano. It really does make my emacs experience soooo much better) 😍

wakatara commented 1 year ago

Sorry, one other thing I should mention, the overall document "sees" those org-mode headings as proper headings in terms of fold/reveal etc etc... so really messes with long documents with any code in them that has a '*' in the starting line.

wakatara commented 1 year ago

Hmmm... also just noticed that I get this Warning as well :

 Warning (org-element-cache): org-element--cache: Org parser error in 2023-01-16-emacs-gtd-and-crm-flow-revisited.org::#<marker at 47012 in 2023-01-16-emacs-gtd-and-crm-flow-revisited.org>
  The error was: (error "Invalid search bound (wrong side of point)")
 Backtrace:
nil
 Please report this to Org mode mailing list (M-x org-submit-bug-report).
wakatara commented 1 year ago

This is apparently nothing to do with nano and an actual issue with the way org-mode parses docs. You are apparently supposed to add a comma in front of lines inside blocks like this. Was surprised to find this out and unfortunately think this was a bad call on the org-mode syntax front by the devs. But hey...

closing ticket.

rougier commented 1 year ago

Thanks for the report. For the actual theme, you might want to give a try to nano-theme which is on elpa and is a standard theme that be customized more easily.