emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [BUG] Unmatched #+end-src


From: Martyn Jago
Subject: Re: [O] [BUG] Unmatched #+end-src
Date: Sat, 12 Mar 2011 20:43:12 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Aankhen <address@hidden> writes:

Thanks for the heads-up Aankhen, I had indeed missed the enclosing
infinite loop.

I modified your patch slightly since my test still failed, and made
further tests.

Attachment: 0001-Fix-endless-loop-in-org-in-item-p-where-end_-block-h.patch
Description: Fix-endless-loop-in-org-in-item-p

Regards

Martyn

> Hi,
>
> On Sat, Mar 12, 2011 at 22:26, Martyn Jago <address@hidden> wrote:
>> --8<---------------cut here---------------start------------->8---
>> * Unmatched #+end-src bug
>>
>> #+end_src
>> --8<---------------cut here---------------end--------------->8---
>>
>> With the above simple org file, placing the cursor at the end of
>> #+end_src and hitting return causes emacs to hang.
>>
>> The bug can be replicated with the following simple test which also
>> causes emacs to hang...
>>
>> [snip]
>>
>> It appears to be related to the following in 'org-in-item-p
>> (org-list.el)...
>>
>> --8<---------------cut here---------------start------------->8---
>>               ((looking-at "^[ \t]*#\\+end_")
>>                (re-search-backward "^[ \t]*#\\+begin_" nil t))
>> --8<---------------cut here---------------end--------------->8---
>>
>> I've tried to pin down the bug but its left me perplexed, so I'm going
>> to defer to more experienced org lispers!
>
> The =cond= is part of a =while= loop; it just keeps looping, entering
> that branch and doing nothing (rather than moving point and picking up
> again from there).  Going by the other branches, I think the correct
> thing to do is just exit the loop:
>
> diff --git a/lisp/org-list.el b/lisp/org-list.el
> --- a/lisp/org-list.el
> +++ b/lisp/org-list.el
> @@ -450,17 +450,19 @@ This checks `org-list-ending-method'."
>                ;; At upper bound of search or looking at the end of a
>                ;; previous list: search is over.
>                ((<= (point) lim-up) (throw 'exit nil))
>                ((and (not (eq org-list-ending-method 'indent))
>                      (looking-at org-list-end-re))
>                 (throw 'exit nil))
>                ;; Skip blocks, drawers, inline-tasks, blank lines
>                ((looking-at "^[ \t]*#\\+end_")
> -               (re-search-backward "^[ \t]*#\\+begin_" nil t))
> +               (condition-case nil
> +                   (re-search-backward "^[ \t]*#\\+begin_" nil)
> +                 (search-failed (throw 'exit nil))))
>                ((looking-at "^[ \t]*:END:")
>                 (re-search-backward org-drawer-regexp nil t)
>                 (beginning-of-line))
>                ((and inlinetask-re (looking-at inlinetask-re))
>                 (org-inlinetask-goto-beginning)
>                 (forward-line -1))
>                ((looking-at "^[ \t]*$") (forward-line -1))
>                ;; Text at column 0 cannot belong to a list: stop.
>
> Hope this helps,
> Aankhen

reply via email to

[Prev in Thread] Current Thread [Next in Thread]