From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Subject: Re: [BUG] Unmatched #+end-src Date: Sun, 13 Mar 2011 01:31:38 +0100 Message-ID: <877hc3x3md.fsf@gmail.com> References: <87ei6cffbw.fsf@btinternet.com> <87bp1gw1a4.fsf@gmail.com> <87d3lwkq1v.fsf@btinternet.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=54033 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PyZDg-0005Un-HZ for emacs-orgmode@gnu.org; Sat, 12 Mar 2011 19:31:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PyZDe-0005DC-Gu for emacs-orgmode@gnu.org; Sat, 12 Mar 2011 19:31:40 -0500 Received: from mail-wy0-f169.google.com ([74.125.82.169]:48310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PyZDe-0005D8-AG for emacs-orgmode@gnu.org; Sat, 12 Mar 2011 19:31:38 -0500 Received: by wyf19 with SMTP id 19so3956231wyf.0 for ; Sat, 12 Mar 2011 16:31:37 -0800 (PST) In-Reply-To: <87d3lwkq1v.fsf@btinternet.com> (Martyn Jago's message of "Sat, 12 Mar 2011 21:05:32 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Martyn Jago Cc: emacs-orgmode@gnu.org Hello, Martyn Jago writes: > I've supplied a patch which passes all of my tests, but I will look at > providing additional tests looking at other cases within this loop since > I'm currently in the habit of writing tests anyway. Your patch has the same weakness as the previous one and I explained why. For example, in the following example, calling (org-in-item-p) with point anywhere on line "some text" will return nil, which is obviously wrong. - item 1 #+end_ some text - item 2 Actually, it is not a matter of patch, which is just changing #+begin_src emacs-lisp ((looking-at "^[ \t]*#\\+end_") (re-search-backward "^[ \t]*#\\+begin_" nil t)) #+end_src into #+begin_src emacs-lisp ((and (looking-at "^[ \t]*#\\+end_") (re-search-backward "^[ \t]*#\\+begin_" nil t))) #+end_src once for blocks and once for drawers, in both org-in-item-p and org-list-struct. The real problem is: how should Org react when parsing syntactically erroneous buffers? I concede that freezing Emacs isn't nice, but otoh, code can't deal with every possible user error. So, what is the expected behavior here? Consider orphan #+end_ as normal text, throw an error, or both? An answer to this question would be more useful than code, honestly. I hope I am clearer now. Regards, -- Nicolas