> When a line in a source block starts with a '*' character (and no > whitespace or other characters before it) it is interpreted as a > headline and the recognition of the source block breaks. Adding a space > or ',' character before the '*' character fixes source block parsing. > This is very unintuitive and, to me, feels more like a bug. I can't > think of any good reason a headline should be able to exist inside a > source block. If that is the intended behavior and adding a ',' > character is the correct workaround then this report can be ignored.
I've noticed this too. This is certainly unintuitive. However, this behavior could technically be useful as you are allowed to create org src blocks, e.g. #+begin_src org * Headline #+end_src. Ihor, would a patch that disabled this behavior outside of org src-blocks be accepted? Is it even possible to implement that feature? Le ven. 19 juin 2026 à 10:54, DifficultBit2901 <[email protected]> a écrit : > When a line in a source block starts with a '*' character (and no > whitespace or other characters before it) it is interpreted as a > headline and the recognition of the source block breaks. Adding a space > or ',' character before the '*' character fixes source block parsing. > This is very unintuitive and, to me, feels more like a bug. I can't > think of any good reason a headline should be able to exist inside a > source block. If that is the intended behavior and adding a ',' > character is the correct workaround then this report can be ignored. > > Steps to reproduce: > 1. Start Emacs using `emacs -Q` > 2. Open any document in Org mode or enable Org mode in a scratch buffer > 3. Create a blank source block > 4. When focusing the first line use M-: (org-element-at-point) > The output should start with "src-block", indicating that the source > block is correctly recognized. > 5. Inside the source block add a line starting with a '*' character. > Example: > #+BEGIN_SRC > * {} > #+END_SRC > 6. When now focusing the first line and using M-: (org-e.ement-at-point) > the output should now start with "paragraph", indicating that the > source block is no longer parsed correctly > > Emacs : GNU Emacs 30.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version > 3.24.52, cairo version 1.18.4) > Package: Org mode version 9.8.4 (9.8.4-??-2f69593 @ > /home/difficult/.config/emacs/.local/straight/build-30.2/org/) > > current state: > ============== > (setq > org-special-ctrl-a/e t > org-yank-image-file-name-function 'org-yank-image-autogen-filename > org-persist-before-write-hook '(org-element--cache-persist-before-write) > org-clock-persist 'history > org-indirect-buffer-display 'current-window > org-preview-latex-image-directory > "/home/difficult/.config/emacs/.local/cache/org/latex/" > org-default-notes-file "/home/difficult/org/notes.org" > org-directory "~/org/" > org-M-RET-may-split-line nil > org-clock-in-resume t > org-clock-out-remove-zero-time-clocks t > org-display-remote-inline-images 'download > org-speed-command-hook '(org-speed-command-activate > org-babel-speed-command-activate) > org-persist-after-read-hook '(org-element--cache-persist-after-read) > org-archive-subtree-save-file-p t > org-id-locations-file "/home/difficult/org/.orgids" > org-agenda-finalize-hook '(+org-exclude-agenda-buffers-from-workspace-h > +org--reload-org-agenda-h) > org-agenda-window-setup 'current-window > org-file-apps '((remote . emacs) (auto-mode . emacs) (directory . emacs) > ("\\.mm\\'" . default) ("\\.x?html?\\'" . default) ("\\.pdf\\'" . default)) > org-mode-hook '(er/add-org-mode-expansions #[(&rest _) ((add-hook > 'save-place-after-find-file-hook #'+org-make-last-point-visible-h nil t)) > (t)] > +lookup--init-org-mode-handlers-h #[0 > "\300\301\302\303\304$\207" [add-hook change-major-mode-hook > org-fold-show-all append local] 5] > #[0 "\300\301\302\303\304$\207" [add-hook > change-major-mode-hook org-babel-show-result-all append local] 5] > org-babel-result-hide-spec org-babel-hide-all-hashes #[0 > "\301\211 \207" [imenu-create-index-function org-imenu-get-tree] 2] > org-auto-tangle--auto-enable > doom-disable-show-paren-mode-h doom-disable-show-trailing-whitespace-h > evil-org-mode org-eldoc-load > toc-org-enable embrace-org-mode-hook > +corfu-add-cape-elisp-block-h) > org-load-hook '(+org-init-org-directory-h +org-init-appearance-h > +org-init-agenda-h +org-init-attachments-h +org-init-babel-h > +org-init-babel-lazy-loader-h > +org-init-capture-defaults-h +org-init-capture-frame-h > +org-init-custom-links-h +org-init-export-h > +org-init-habit-h +org-init-hacks-h +org-init-keybinds-h > +org-init-popup-rules-h +org-init-smartparens-h) > org-hide-leading-stars t > org-capture-templates '(("t" "Personal todo" entry (file+headline > +org-capture-todo-file "Inbox") "* [ ] %?\n%i\n%a" :prepend t) > ("n" "Personal notes" entry (file+headline > +org-capture-notes-file "Inbox") "* %u %?\n%i\n%a" :prepend t) > ("j" "Journal" entry (file+olp+datetree > +org-capture-journal-file) "* %U %?\n%i\n%a" :prepend t) > ("p" "Templates for projects") > ("pt" "Project-local todo" entry (file+headline > +org-capture-project-todo-file "Inbox") "* TODO %?\n%i\n%a" :prepend t) > ("pn" "Project-local notes" entry (file+headline > +org-capture-project-notes-file "Inbox") "* %U %?\n%i\n%a" :prepend t) > ("pc" "Project-local changelog" entry > (file+headline +org-capture-project-changelog-file "Unreleased") "* %U > %?\n%i\n%a" > :prepend t) > ("o" "Centralized templates for projects") > ("ot" "Project todo" entry > #'+org-capture-central-project-todo-file "* TODO %?\n %i\n %a" :heading > "Tasks" :prepend nil) > ("on" "Project notes" entry > #'+org-capture-central-project-notes-file "* %U %?\n %i\n %a" :heading > "Notes" :prepend t) > ("oc" "Project changelog" entry > #'+org-capture-central-project-changelog-file "* %U %?\n %i\n %a" :heading > "Changelog" > :prepend t) > ) > org-refile-targets '((nil :maxlevel . 3) (org-agenda-files :maxlevel . 3)) > org-agenda-deadline-faces '((1.001 . error) (1.0 . org-warning) (0.5 . > org-upcoming-deadline) (0.0 . org-upcoming-distant-deadline)) > org-confirm-shell-link-function 'yes-or-no-p > org-agenda-inhibit-startup t > org-attach-use-inheritance t > org-archive-hook '(org-attach-archive-delete-maybe) > org-src-window-setup 'other-window > org-mode-local-vars-hook '(+org-init-gifs-h) > org-insert-heading-respect-content t > org-metaup-hook '(org-babel-load-in-session-maybe) > org-fontify-whole-heading-line t > org-occur-hook '(org-first-headline-recenter) > org-ellipsis " [...] " > org-enforce-todo-dependencies t > org-entities-user '(("flat" "\\flat" nil "" "" "266D" "♭") ("sharp" > "\\sharp" nil "" "" "266F" "♯")) > org-confirm-babel-evaluate nil > org-priority-faces '((65 . error) (66 . warning) (67 . shadow)) > org-link-abbrev-alist '(("doomdir" . "/home/difficult/.config/doom/%s") > ("emacsdir" . "/home/difficult/.config/emacs/%s") > ("doom-repo" . " > https://github.com/doomemacs/doomemacs/%s") ("wolfram" . " > https://wolframalpha.com/input/?i=%s") > ("wikipedia" . "https://en.wikipedia.org/wiki/%s") > ("duckduckgo" . "https://duckduckgo.com/?q=%s") > ("kagi" . "https://kagi.com/search?q=%s") > ("gmap" . "https://maps.google.com/maps?q=%s") > ("gimages" . "https://google.com/images?q=%s") > ("google" . "https://google.com/search?q=") > ("youtube" . "https://youtube.com/watch?v=%s") > ("github" . "https://github.com/%s")) > org-link-parameters '(("id" :follow org-id-open :store > org-id-store-link-maybe :complete org-id-complete :insert-description > org-id-description) > ("info" :follow org-info-open :export > org-info-export :store org-info-store-link :insert-description > org-info-description-as-command) > ("pdf" :follow > #[(&rest args) > ((and (condition-case nil (progn (require > 'org-pdftools nil t)) (error nil)) (file-executable-p > pdf-info-epdfinfo-program) > (apply fn args)) > ) > ((fn . org-pdftools-open))] > :complete > #[(&rest args) > ((and (condition-case nil (progn (require > 'org-pdftools nil t)) (error nil)) (file-executable-p > pdf-info-epdfinfo-program) > (apply fn args)) > ) > ((fn . org-pdftools-complete-link))] > :store > #[(&rest args) > ((and (condition-case nil (progn (require > 'org-pdftools nil t)) (error nil)) (file-executable-p > pdf-info-epdfinfo-program) > (apply fn args)) > ) > ((fn . org-pdftools-store-link))] > :export > #[(&rest args) > ((and (condition-case nil (progn (require > 'org-pdftools nil t)) (error nil)) (file-executable-p > pdf-info-epdfinfo-program) > (apply fn args)) > ) > ((fn . org-pdftools-export))] > ) > ("orgit-rev" :store orgit-rev-store :follow > orgit-rev-open :export orgit-rev-export :complete orgit-rev-complete-link) > ("orgit-log" :store orgit-log-store :follow > orgit-log-open :export orgit-log-export :complete orgit-log-complete-link) > ("orgit" :store orgit-status-store :follow > orgit-status-open :export orgit-status-export :complete > orgit-status-complete-link) > ("data" :preview +org-link-preview-image-data-fn) > ("doom-changelog" :follow > #[(link) ((find-file (doom-path doom-docs-dir " > changelog.org")) (org-match-sparse-tree nil link)) (t)]) > ("doom-user" :follow > #[(link) ((browse-url (format " > https://github.com/%s" (string-remove-prefix "@" > (+org-link-read-desc-at-point link))))) (t)] > :face #[(_) ('org-priority) (t)]) > ("doom-ref" :follow > #[(link) > ((let ((link (+org-link-read-desc-at-point > link)) (url "https://github.com") (doom-repo "doomemacs/doomemacs")) > (let ((saved-match-data (match-data))) > (unwind-protect > (progn > (browse-url > (cond > ((string-match > "^\\([^/]+\\(?:/[^/]+\\)?\\)?#\\([0-9]+\\(?:#.*\\)?\\)" link) > (format "%s/%s/issues/%s" url (or > (match-string 1 link) doom-repo) (match-string 2 link))) > ((string-match > "^\\([^/]+\\(?:/[^/]+\\)?@\\)?\\([a-z0-9]\\{7,\\}\\(?:#.*\\)?\\)" link) > (format "%s/%s/commit/%s" url (or > (match-string 1 link) doom-repo) (match-string 2 link))) > ((user-error "Invalid doom-ref link: %S" > link))) > ) > ) > (set-match-data saved-match-data t)) > ) > ) > ) > (t)] > :face > #[(link) > ((let ((link (+org-link-read-desc-at-point > link))) > (if > (or (string-match > "^\\([^/]+\\(?:/[^/]+\\)?\\)?#\\([0-9]+\\(?:#.*\\)?\\)" link) > (string-match > "^\\([^/]+\\(?:/[^/]+\\)?@\\)?\\([a-z0-9]\\{7,\\}\\(?:#.*\\)?\\)" link)) > 'org-link 'error) > ) > ) > (t)] > ) > ("doom-executable" :activate-func > +org-link--doom-executable-link-activate-fn :help-echo > +org-link-doom--help-echo-from-textprop :face > org-verbatim) > ("doom-module" :follow > +org-link--doom-module-link-follow-fn :activate-func > +org-link--doom-module-link-activate-fn :help-echo > +org-link-doom--help-echo-from-textprop) > ("doom-package" :follow > +org-link--doom-package-link-follow-fn :activate-func > +org-link--doom-package-link-activate-fn > :help-echo +org-link-doom--help-echo-from-textprop) > ("cmd" :follow > #[(path _prefixarg) > ((funcall (or (command-remapping fn) fn) (or > (intern-soft path) (user-error "Can't find documentation for %S" path)))) > ((fn . describe-command))] > :activate-func +org-link--command-link-activate-fn > :face help-key-binding :help-echo +org-link-doom--help-echo-from-textprop) > ("face" :follow > #[(path _prefixarg) > ((funcall (or (command-remapping fn) fn) (or > (intern-soft path) (user-error "Can't find documentation for %S" path)))) > ((fn . describe-face))] > :activate-func +org-link--face-link-activate-fn > :face (font-lock-type-face underline)) > ("fn" :follow > #[(path _prefixarg) > ((funcall (or (command-remapping fn) fn) (or > (intern-soft path) (user-error "Can't find documentation for %S" path)))) > ((fn . describe-function))] > :activate-func +org-link--fn-link-activate-fn > :face (font-lock-function-name-face underline)) > ("var" :follow > #[(path _prefixarg) > ((funcall (or (command-remapping fn) fn) (or > (intern-soft path) (user-error "Can't find documentation for %S" path)))) > ((fn . describe-variable))] > :activate-func +org-link--var-link-activate-fn > :face (font-lock-variable-name-face underline)) > ("kbd" :follow > #[(ev) > ((minibuffer-message "%s" > (+org-link-doom--help-echo-from-textprop nil (current-buffer) (posn-point > (event-start ev))))) (t) > nil nil "e"] > :help-echo +org-link-doom--help-echo-from-textprop > :face help-key-binding) > ("doom-docs" :complete > #[nil > ((if requires (mapc #'require (ensure-list > requires))) > (+org--relative-path (+org--read-link-path key > (funcall dir-fn)) (funcall dir-fn))) > ((dir-fn . #[nil ((symbol-value dir-var)) > ((dir-var . doom-docs-dir))]) (requires) (key . "doom-docs"))] > :follow > #[(link) ((org-link-open-as-file (expand-file-name > link (funcall dir-fn)) nil)) > ((dir-fn . #[nil ((symbol-value dir-var)) > ((dir-var . doom-docs-dir))]))] > :face > #[(link) > ((let* > ((path (expand-file-name link (funcall > dir-fn))) (option-index (string-match-p "::\\(.*\\)\\'" path)) > (file-name (substring path 0 option-index))) > (if (file-exists-p file-name) 'org-link > 'error)) > ) > ((dir-fn . #[nil ((symbol-value dir-var)) > ((dir-var . doom-docs-dir))]))] > :requires nil) > ("doom" :complete > #[nil > ((if requires (mapc #'require (ensure-list > requires))) > (+org--relative-path (+org--read-link-path key > (funcall dir-fn)) (funcall dir-fn))) > ((dir-fn . #[nil ((symbol-value dir-var)) > ((dir-var . doom-emacs-dir))]) (requires) (key . "doom"))] > :follow > #[(link) ((org-link-open-as-file (expand-file-name > link (funcall dir-fn)) nil)) > ((dir-fn . #[nil ((symbol-value dir-var)) > ((dir-var . doom-emacs-dir))]))] > :face > #[(link) > ((let* > ((path (expand-file-name link (funcall > dir-fn))) (option-index (string-match-p "::\\(.*\\)\\'" path)) > (file-name (substring path 0 option-index))) > (if (file-exists-p file-name) 'org-link > 'error)) > ) > ((dir-fn . #[nil ((symbol-value dir-var)) > ((dir-var . doom-emacs-dir))]))] > :requires nil) > ("org" :complete > #[nil > ((if requires (mapc #'require (ensure-list > requires))) > (+org--relative-path (+org--read-link-path key > (funcall dir-fn)) (funcall dir-fn))) > ((dir-fn . #[nil ((symbol-value dir-var)) > ((dir-var . org-directory))]) (requires) (key . "org"))] > :follow > #[(link) ((org-link-open-as-file (expand-file-name > link (funcall dir-fn)) nil)) > ((dir-fn . #[nil ((symbol-value dir-var)) > ((dir-var . org-directory))]))] > :face > #[(link) > ((let* > ((path (expand-file-name link (funcall > dir-fn))) (option-index (string-match-p "::\\(.*\\)\\'" path)) > (file-name (substring path 0 option-index))) > (if (file-exists-p file-name) 'org-link > 'error)) > ) > ((dir-fn . #[nil ((symbol-value dir-var)) > ((dir-var . org-directory))]))] > :requires nil) > ("attachment" :preview org-attach-preview-file > :follow org-attach-follow :complete org-attach-complete-link) ("file+sys") > ("file+emacs") ("shell" :follow > org-link--open-shell) > ("news" :follow #[514 "\301\300\302 Q \"\207" > ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"]) > ("mailto" :follow #[514 "\301\300\302 Q \"\207" > ["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"]) > ("https" :follow #[514 "\301\300\302 Q \"\207" > ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"] :preview > +org-link-preview-image-url-fn) > ("http" :follow #[514 "\301\300\302 Q \"\207" > ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"] :preview > +org-link-preview-image-url-fn) > ("ftp" :follow #[514 "\301\300\302 Q \"\207" ["ftp" > browse-url ":"] 6 "\n\n(fn URL ARG)"]) > ("shortdoc" :follow org-link--open-shortdoc :store > org-link--store-shortdoc :complete org-link--complete-shortdoc) > ("help" :follow org-link--open-help :store > org-link--store-help) > ("file" :complete org-link-complete-file :preview > org-link-preview-file :face > #[(path) > ((if > (or (if (featurep :system 'windows) > (string-prefix-p "//" path)) (file-remote-p path) > (if (featurep :system 'windows) > (string-prefix-p "\\\\" path)) (file-exists-p path)) > 'org-link '(warning org-link)) > ) > (t)] > ) > ("elisp" :follow org-link--open-elisp)) > org-todo-keyword-faces '(("[-]" . +org-todo-active) ("STRT" . > +org-todo-active) ("[?]" . +org-todo-onhold) ("WAIT" . +org-todo-onhold) > ("HOLD" . +org-todo-onhold) ("PROJ" . > +org-todo-project) ("NO" . +org-todo-cancel) ("KILL" . +org-todo-cancel)) > org-persist-directory > "/home/difficult/.config/emacs/.local/cache/org/persist/" > org-refile-use-outline-path 'file > org-cycle-tab-first-hook '(+org-yas-expand-maybe-h +org-indent-maybe-h > org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) > org-imenu-depth 6 > org-todo-keywords '((sequence "TODO(t)" "PROJ(p)" "LOOP(r)" "STRT(s)" > "WAIT(w)" "HOLD(h)" "IDEA(i)" "|" "DONE(d)" "KILL(k)") > (sequence "[ ](T)" "[-](S)" "[?](W)" "|" "[X](D)") > (sequence "|" "OKAY(o)" "YES(y)" "NO(n)")) > org-font-lock-set-keywords-hook '(doom-themes-enable-org-fontification) > org-agenda-before-write-hook '(org-agenda-add-entry-text) > org-metadown-hook '(org-babel-pop-to-session-maybe) > org-clock-history-length 20 > org-tab-first-hook '(+org-yas-expand-maybe-h +org-indent-maybe-h > org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) > org-sort-function 'string-collate-lessp > org-export-backends '(md ascii html icalendar latex odt) > org--warnings nil > org-after-refile-insert-hook '(+org-save-buffer-after-capture-h) > org-startup-folded nil > org-babel-pre-tangle-hook '(save-buffer) > org-src-preserve-indentation t > org-tags-column 0 > org-babel-after-execute-hook > '(+org-redisplay-inline-images-in-babel-result-h) > org-export-before-parsing-hook '(org-attach-expand-links) > org-image-actual-width nil > org-link-shell-confirm-function 'yes-or-no-p > org-fold-core-isearch-open-function 'org-fold-core--isearch-reveal > org-agenda-skip-unavailable-files t > org-tags-exclude-from-inheritance '("crypt") > outline-isearch-open-invisible-function 'outline-isearch-open-invisible > org-src-mode-hook '(org-src-babel-configure-edit-buffer > org-src-mode-configure-edit-buffer) > org-agenda-span 10 > org-agenda-mode-hook '(+org-habit-resize-graph-h evil-org-agenda-mode) > org-fontify-quote-and-verse-blocks t > org-capture-after-finalize-hook '(+org-capture-cleanup-frame-h) > org-modules nil > org-agenda-loop-over-headlines-in-active-region nil > org-agenda-start-on-weekday nil > org-agenda-files '("~/org/") > org-list-allow-alphabetical t > org-attach-id-dir "/home/difficult/org/.attach/" > org-capture-mode-hook '(+org-show-target-in-capture-header-h > evil-insert-state) > org-link-elisp-confirm-function nil > org-outline-path-complete-in-steps nil > org-startup-indented t > org-src-lang-modes '(("md" . markdown) ("rust" . rustic) ("C" . c) ("C++" > . c++) ("asymptote" . asy) ("beamer" . latex) ("calc" . fundamental) > ("cpp" . c++) ("ditaa" . artist) ("desktop" . > conf-desktop) ("dot" . graphviz-dot) ("elisp" . emacs-lisp) ("ocaml" . > tuareg) > ("screen" . shell-script) ("sqlite" . sql) ("toml" . > conf-toml) ("shell" . sh) ("ash" . sh) ("sh" . sh) ("bash" . sh) > ("jsh" . sh) ("bash2" . sh) ("dash" . sh) ("dtksh" . > sh) ("ksh" . sh) ("es" . sh) ("rc" . sh) ("itcsh" . sh) ("tcsh" . sh) > ("jcsh" . sh) ("csh" . sh) ("ksh88" . sh) ("oash" . > sh) ("pdksh" . sh) ("mksh" . sh) ("posix" . sh) ("wksh" . sh) ("wsh" . sh) > ("zsh" . sh) ("rpm" . sh)) > org-clock-persist-file > "/home/difficult/.config/emacs/.local/etc/org-clock-save.el" > org-cycle-hook '(org-cycle-hide-archived-subtrees > org-cycle-show-empty-lines org-cycle-optimize-window-after-visibility-change > org-cycle-display-link-previews) > org-persist-before-read-hook '(org-element--cache-persist-before-read) > org-use-sub-superscripts '{} > ) > >
