From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Inserting a comma as prefix of headlines (in Org code blocks) Date: Wed, 27 Feb 2013 13:54:13 +0100 Message-ID: <87obf5syru.fsf@gmail.com> References: <86fw0i9lu4.fsf@somewhere.org> <87sj4irt1y.fsf@gmail.com> <87r4k2eyub.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:52978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAgX1-0000aI-Hh for emacs-orgmode@gnu.org; Wed, 27 Feb 2013 07:54:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAgWz-0002re-CA for emacs-orgmode@gnu.org; Wed, 27 Feb 2013 07:54:47 -0500 Received: from plane.gmane.org ([80.91.229.3]:37497) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAgWz-0002px-5z for emacs-orgmode@gnu.org; Wed, 27 Feb 2013 07:54:45 -0500 Received: from public by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UAgXC-0007IO-PC for emacs-orgmode@gnu.org; Wed, 27 Feb 2013 13:54:58 +0100 In-Reply-To: <87r4k2eyub.fsf@bzg.ath.cx> (Bastien's message of "Wed, 27 Feb 2013 13:16:28 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Cc: public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org, Sebastien Vauban Hello, Bastien writes: > "#" is already taken, for comments. Ok then another binding. I still think freeing "," key is the best thing to do. More on this below. > 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...): --8<---------------cut here---------------start------------->8--- * H1 ** H11 #+begin_example ** H12 #+end_example --8<---------------cut here---------------end--------------->8--- 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. Therefore, "** H12" is a headline, and it is to be expected that speed commands are triggered when point is on column 0. So my suggested solution for the problem at hand is to simply avoid using "," in speed keys, since "," is also used to protect headlines in blocks. Let me stress this again: 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. 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). Regards, -- Nicolas Goaziou