Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BEGIN_EXAMPLE blocks are not being syntax highlighted [org-mode] #7629

Closed
4 tasks done
molok opened this issue Jan 24, 2024 · 6 comments
Closed
4 tasks done

BEGIN_EXAMPLE blocks are not being syntax highlighted [org-mode] #7629

molok opened this issue Jan 24, 2024 · 6 comments
Labels
invalid Unactionable, unrelated, inappropriate, or a pilot error

Comments

@molok
Copy link

molok commented Jan 24, 2024

I confirm that...

  • I have searched the issue tracker, documentation, FAQ, Discourse, and Google, in case this issue has already been reported/resolved.
  • I have read "How to Debug Issues", and will use it to provide as much information about this issue as possible.
  • The issue can be reproduced on the latest available commit of Doom.
  • The issue can be reproduced on a stable release of Emacs, such as 27, 28, or 29. (Unstable versions end in .50, .60, or .9x)

Expected behavior

in a org-mode buffer BEGIN_EXAMPLE blocks should have a working syntax highlight

Current behavior

BEGIN_SRC blocks are syntax highlighted but BEGIN_EXAMPLE blocks are not

Steps to reproduce

  1. create a file with this content
#+BEGIN_SRC javascript
console.log("hi")
#+END_SRC

#+BEGIN_EXAMPLE javascript
console.log("hi")
#+END_EXAMPLE
  1. open it with doom emacs, notice how the BEGIN_EXAMPLE block is NOT highlighted
  2. open it with emacs -Q, notice how the BEGIN_EXAMPLE block IS highlighted

System Information

https://pastebin.com/N0VFuhQa

@molok molok added is:bug Something isn't working as intended needs-triage Issue hasn't been assessed yet labels Jan 24, 2024
@peterhoeg
Copy link
Contributor

That's how it's supposed to be: https://orgmode.org/manual/Literal-Examples.html

@molok
Copy link
Author

molok commented Jan 30, 2024

@peterhoeg then why EXAMPLE blocks are highlighted starting emacs with emacs -Q?

@peterhoeg
Copy link
Contributor

peterhoeg commented Feb 2, 2024 via email

@molok
Copy link
Author

molok commented Feb 2, 2024

@peterhoeg the EXAMPLE blocks are never executed, SRC block might be executed when exporting the document or by org-ctrl-c-ctrl-c. I might argue that unless you intend to execute the code, EXAMPLE blocks are more suited to contain source code than SRC blocks

Having

#+BEGIN_SRC sh
rm -fr ~/*
#+END_SRC

in a org file isn't really something desiderable

@hlissner hlissner added invalid Unactionable, unrelated, inappropriate, or a pilot error and removed is:bug Something isn't working as intended needs-triage Issue hasn't been assessed yet labels Feb 3, 2024
@hlissner
Copy link
Member

hlissner commented Feb 3, 2024

he EXAMPLE blocks are never executed

Use :eval no to inhibit any possible execution of a src block (e.g. by export or C-c C-c).

Or #+property: header-args:javascript :eval no at the top to apply to all (javascript, for example) blocks in a file.

(source)

BEGIN_SRC blocks are syntax highlighted but BEGIN_EXAMPLE blocks are not

I'm not sure what causes the discrepancy, but I suspect it's because Doom installs a newer version of Org than what comes bundled with stable versions of Emacs. I'll test that sometime this week.

In any case, since a lack of syntax highlighting is what's expected (going by the docs), I'll consider this a non-issue (or at the very least a bug in Org rather than Doom) and I'll close this, but feel free to follow up here. I will once I get around to testing it some more.

@hlissner hlissner closed this as not planned Won't fix, can't repro, duplicate, stale Feb 3, 2024
@hlissner hlissner added this to the modules v24.03 milestone Feb 3, 2024
@NightMachinery
Copy link
Contributor

NightMachinery commented Feb 27, 2024

This was solved upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Unactionable, unrelated, inappropriate, or a pilot error
Projects
None yet
Development

No branches or pull requests

4 participants