all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: D <d.williams@posteo.net>
To: emacs-orgmode@gnu.org
Subject: Strangely recognized non-lists and non-headers.
Date: Sun, 2 Feb 2020 11:11:02 +0100	[thread overview]
Message-ID: <bffbea3f-fbfc-1908-7249-8c083e859a1a@posteo.net> (raw)

Hi all,

while debugging org-superstar-mode I noticed something very strange, and
I am not sure if it's a bug in org or a bug in my understanding of org.

First off, an MWE for Org mode version 9.1.9 (release_9.1.9-65-g5e4542):

#+BEGIN_SRC C
/*
* This is a header?
  + this
    + is
      * a list?
*/
#+END_SRC

This works. I can promote, demote, fold, etc.  org-superstar also has no
issue with accepting these.  I should add, this is the default config
(emacs -Q on Emacs 26.3).  So no spooky stuff I believe on that end.
So I began digging.

I use org-list-in-valid-context-p as a quick hack to check if what I am
looking at is actually a list.  Said predicate is a simple wrapper
around the function org-in-block-p being called with
org-list-forbidden-blocks.  It is the the list of environments where
lists are not allowed.

Value: ("example" "verse" "src" "export")

There is also a very similar variable: org-protecting-blocks.  This one
marks environments as quoted, disallowing org syntax.

Value: ("src" "example" "export")

Currently these two variables don't know of one another.  Maybe the
latter should be a strict subset of the former?

Anyway, from what I have found org-in-block-p seems to not recognize src
blocks reliably.  I wrote a small function to test this:

(defun nag ()
  (interactive)
  (when (org-list-in-valid-context-p)
    (warn "You can make a list here! :(")))

And it seems, yes, you can make a list in a src block.
That's all very peculiar, what do you guys think?

             reply	other threads:[~2020-02-02 10:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-02 10:11 D [this message]
2020-02-02 11:59 ` Strangely recognized non-lists and non-headers Nicolas Goaziou
2020-02-02 13:33   ` D
2020-02-02 14:13     ` Nicolas Goaziou
2020-02-02 15:26       ` D

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

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

  git send-email \
    --in-reply-to=bffbea3f-fbfc-1908-7249-8c083e859a1a@posteo.net \
    --to=d.williams@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.