From: Bastien <bzg@altern.org>
To: Nicolas Goaziou <n.goaziou@gmail.com>
Cc: public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org,
Sebastien Vauban
<public-wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@plane.gmane.org>
Subject: Re: Inserting a comma as prefix of headlines (in Org code blocks)
Date: Wed, 27 Feb 2013 23:55:49 +0100 [thread overview]
Message-ID: <878v69nz7u.fsf@bzg.ath.cx> (raw)
In-Reply-To: <87obf5syru.fsf@gmail.com> (Nicolas Goaziou's message of "Wed, 27 Feb 2013 13:54:13 +0100")
Hi Nicolas,
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Ok then another binding. I still think freeing "," key is the best thing
> to do. More on this below.
Users will still be able to use the "," so this will not really fix
the issue.
>> I think "," is good for priorities, and that preventing speed commands
>> in the several blocks is safe and non-intrusive, that's what my patch
>> did. Let me know if you (strongly) think otherwise!
>
> Well, yes, I strongly think otherwise.
>
> Your patch is relying on `org-in-block-p', which is completely broken in
> this situation.
>
> The fact is that any strictly positive number of "*" at column
> 0 followed by a space define a headline, whatever the context is. In
> other words, headlines have precedence over every other construct in Org
> syntax.
>
> It's not about the parser. Every low level Org command (and most of the
> high level too) assume, and have always assumed, this. For example, try
> to cycle visibility in the following example (or move forward
> heading...):
>
> * H1
>
> ** H11
>
> #+begin_example
> ** H12
> #+end_example
>
> So, we have to make this point clear once and for all. Otherwise, we
> should as well re-implement all functions working on headlines, because
> if we accept that (org-in-block-p '("example")) returns a non-nil value
> in the previous example, they become all wrong.
I got your point, but "broken" is contextual.
The fact that (org-in-block-p '("src")) returns a non-nil value in
#+begin_src org
** H12
#+end_src
is not wrong in the context of checking whether a speed command should
be prevented or not. It might be wrong in other contexts, but for
this purpose it is not.
That's similar to TAB, which comma-escapes the content of the block
instead of cycling through the folding states, because it knows it is
in a src block.
> 1. "stars + space" at column 0 define a headline. No exception. Most
> of Org code (reasonably) assumes this, so we should not let users
> think otherwise.
Yes. But it is not because the cursor is at the beginning of a
headline that every function should behave the same. TAB does not,
speed commands do not either.
> 2. Do not rely on `org-in-block-p'. Please use `org-element-at-point'
> or `org-element-context' instead. These are not broken, and they
> are fast enough for any interactive use (but let's not use them for
> fontification yet).
Btw, can you think of cases where it would be nice to have
`org-element-context' check against a wider context than the closest
one?
--
Bastien
next prev parent reply other threads:[~2013-02-27 22:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-27 8:56 Inserting a comma as prefix of headlines (in Org code blocks) Sebastien Vauban
2013-02-27 9:22 ` Bastien
2013-02-27 9:43 ` Nicolas Goaziou
2013-02-27 12:16 ` Bastien
2013-02-27 12:54 ` Nicolas Goaziou
2013-02-27 22:55 ` Bastien [this message]
2013-02-27 23:29 ` Nicolas Goaziou
2013-02-28 8:54 ` Bastien
2013-02-28 9:56 ` Nicolas Goaziou
2013-02-28 10:15 ` Bastien
2013-02-28 10:52 ` Nicolas Goaziou
2013-02-28 11:17 ` Achim Gratz
2013-02-28 21:23 ` Nicolas Goaziou
2013-02-28 16:17 ` François Pinard
2013-02-28 17:02 ` Yagnesh Raghava Yakkala
2013-02-28 19:26 ` François Pinard
2013-02-28 20:06 ` Yagnesh Raghava Yakkala
2013-03-01 16:23 ` Takafumi Arakaki
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878v69nz7u.fsf@bzg.ath.cx \
--to=bzg@altern.org \
--cc=n.goaziou@gmail.com \
--cc=public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org \
--cc=public-wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@plane.gmane.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 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).