emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas <n.goaziou@gmail.com>
To: Martyn Jago <martyn.jago@btinternet.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] Unmatched #+end-src
Date: Sun, 13 Mar 2011 01:31:38 +0100	[thread overview]
Message-ID: <877hc3x3md.fsf@gmail.com> (raw)
In-Reply-To: <87d3lwkq1v.fsf@btinternet.com> (Martyn Jago's message of "Sat, 12 Mar 2011 21:05:32 +0000")

Hello,

Martyn Jago <martyn.jago@btinternet.com> 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

  reply	other threads:[~2011-03-13  0:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-12 16:56 Martyn Jago
2011-03-12 19:29 ` Aankhen
2011-03-12 20:07   ` Nicolas
2011-03-12 20:20     ` Aankhen
2011-03-12 21:05     ` Martyn Jago
2011-03-13  0:31       ` Nicolas [this message]
2011-03-13 13:49         ` Eric Schulte
2011-03-17 12:09           ` Nicolas Goaziou
2011-03-12 20:43   ` Martyn Jago
2011-03-23 17:38 ` Nicolas

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=877hc3x3md.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=martyn.jago@btinternet.com \
    --subject='Re: [BUG] Unmatched #+end-src' \
    /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

Code repositories for project(s) associated with this 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).