emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Maus <maus.david@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Bug: Infinite loop in `org-previous-item' when there's nothing above item (patch included) [6.33trans (release_6.33f.80.gb777e3)]
Date: Sat, 05 Dec 2009 22:03:29 +0100	[thread overview]
Message-ID: <87ws11xhem.wl%maus.david@gmail.com> (raw)

[-- 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

             reply	other threads:[~2009-12-05 21:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-05 21:03 David Maus [this message]
2009-12-10 12:48 ` Bug: Infinite loop in `org-previous-item' when there's nothing above item (patch included) [6.33trans (release_6.33f.80.gb777e3)] Carsten Dominik

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=87ws11xhem.wl%maus.david@gmail.com \
    --to=maus.david@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).