emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org headings trigger is code blocks
@ 2024-07-31  5:21 the_wurfkreuz
  2024-07-31  6:04 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: the_wurfkreuz @ 2024-07-31  5:21 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

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

For instance, i have a command that starts with an asterisk, and i want
to put it in a source block. However, doing so creates a heading.
Shouldn't the code block serve as a clear logical indicator that i don't
intend for that line to become a heading?

Example:

#+BEGIN_SRC
* hard nofile 20000
#+END_SRC

Emacs : GNU Emacs 30.0.60 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.0)
of 2024-07-16
Package: Org mode version 9.8-pre (release_9.7.6-106-g240eb9 @ /home/wurfkreuz/.emacs.d/straight/build/org/)

[-- Attachment #2: Type: text/html, Size: 1003 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Org headings trigger is code blocks
  2024-07-31  5:21 Org headings trigger is code blocks the_wurfkreuz
@ 2024-07-31  6:04 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2024-07-31  6:04 UTC (permalink / raw)
  To: the_wurfkreuz; +Cc: emacs-orgmode@gnu.org

the_wurfkreuz <the_wurfkreuz@proton.me> writes:

> For instance, i have a command that starts with an asterisk, and i want
> to put it in a source block. However, doing so creates a heading.
> Shouldn't the code block serve as a clear logical indicator that i don't
> intend for that line to become a heading?
>
> Example:
>
> #+BEGIN_SRC
> * hard nofile 20000
> #+END_SRC

Headline syntax has the highest priority, so that you do not
accidentally invalidate a bunch of headings simply by having a
#+begin_src deeply inside some text:

...
#+begin_src
(unclosed #+begin-src)
...
* many headings here
#+begin_src
...<everything up to the first unclosed #+begin_src would be considered
a part of src block if what you suggest were the case>
#+end_src

You need to escape headings inside src blocks or literal examples like

#+BEGIN_SRC
,* hard nofile 20000
#+END_SRC

or simply by having an indentation

 #+BEGIN_SRC
 * hard nofile 20000
 #+END_SRC

See "12.6 Literal Examples" section of Org mode manual.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
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>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-31  6:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-31  5:21 Org headings trigger is code blocks the_wurfkreuz
2024-07-31  6:04 ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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