emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: Infinite loop in `org-previous-item' when there's nothing above item (patch included) [6.33trans (release_6.33f.80.gb777e3)]
@ 2009-12-05 21:03 David Maus
  2009-12-10 12:48 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: David Maus @ 2009-12-05 21:03 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org-mode mailing list.
------------------------------------------------------------------------

When `org-previous-item' is called on an item with nothing above it
Orgmode enters an infinite loop. The reason is that
`org-previous-item' searches for non-empty lines by moving point up
line by line and if there is nothing above an item point gets stuck on
begin of buffer.

example.org
,----
| 
|  - Item
`----

Move point on Item, M-x org-previous-item RET and Orgmode enters the
infinite loop.

Attached patch adds a conditional clause to `org-previous-item' that
leaves the search loop if point reaches beginning of buffer.

Emacs  : GNU Emacs 23.1.50.1 (i486-pc-linux-gnu, GTK+ Version 2.18.3)
 of 2009-11-28 on elegiac, modified by Debian
Package: Org-mode version 6.33trans (release_6.33f.80.gb777e3)


[-- Attachment #2: 0001-org-list.el-Prevent-infinite-loop-in-org-previous-it.patch --]
[-- Type: application/octet-stream, Size: 1167 bytes --]

From b777e3969372f23ed357bdd4058c1445ccfe5d38 Mon Sep 17 00:00:00 2001
From: David Maus <maus.david@gmail.com>
Date: Sat, 5 Dec 2009 21:56:34 +0100
Subject: [PATCH] org-list.el: Prevent infinite loop in `org-previous-item'

When `org-previous-item' is called on an item with nothing above it
Orgmode enters an infinite loop. The reason is that
`org-previous-item' searches for non-empty lines by moving point up
line by line and if there is nothing above an item point gets stuck on
begin of buffer.

Patch adds a conditional clause that leaves the search loop if point
reaches beginning of buffer.
---
 lisp/org-list.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lisp/org-list.el b/lisp/org-list.el
index edd612a..56cbc42 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -616,7 +616,8 @@ Error if not at a plain list, or if this is the first item in the list."
 	(if (looking-at "[ \t]*$")
 	    nil
 	  (if (<= (setq ind1 (org-get-indentation)) ind)
-	      (throw 'exit t)))))
+	      (throw 'exit t)))
+	(if (bobp) (throw 'exit t))))
     (condition-case nil
 	(if (or (not (org-at-item-p))
 		(< ind1 (1- ind)))
-- 
1.6.5


[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: Bug: Infinite loop in `org-previous-item' when there's nothing above item (patch included) [6.33trans (release_6.33f.80.gb777e3)]
  2009-12-05 21:03 Bug: Infinite loop in `org-previous-item' when there's nothing above item (patch included) [6.33trans (release_6.33f.80.gb777e3)] David Maus
@ 2009-12-10 12:48 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2009-12-10 12:48 UTC (permalink / raw)
  To: David Maus; +Cc: emacs-orgmode

Hi David,

I have applied your patch, thanks!

- Carsten

On Dec 5, 2009, at 10:03 PM, David Maus wrote:

>
> Remember to cover the basics, that is, what you expected to happen and
> what in fact did happen.  You don't know how to make a good report?   
> See
>
>     http://orgmode.org/manual/Feedback.html#Feedback
>
> Your bug report will be posted to the Org-mode mailing list.
> ------------------------------------------------------------------------
>
> When `org-previous-item' is called on an item with nothing above it
> Orgmode enters an infinite loop. The reason is that
> `org-previous-item' searches for non-empty lines by moving point up
> line by line and if there is nothing above an item point gets stuck on
> begin of buffer.
>
> example.org
> ,----
> |
> |  - Item
> `----
>
> Move point on Item, M-x org-previous-item RET and Orgmode enters the
> infinite loop.
>
> Attached patch adds a conditional clause to `org-previous-item' that
> leaves the search loop if point reaches beginning of buffer.
>
> Emacs  : GNU Emacs 23.1.50.1 (i486-pc-linux-gnu, GTK+ Version 2.18.3)
> of 2009-11-28 on elegiac, modified by Debian
> Package: Org-mode version 6.33trans (release_6.33f.80.gb777e3)
>
> <0001-org-list.el-Prevent-infinite-loop-in-org-previous- 
> it.patch>_______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-10 12:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-05 21:03 Bug: Infinite loop in `org-previous-item' when there's nothing above item (patch included) [6.33trans (release_6.33f.80.gb777e3)] David Maus
2009-12-10 12:48 ` Carsten Dominik

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).