Hi Eric,

Eric Abrahamsen <e...@ericabrahamsen.net> writes:

> If you call "C-c C-c" within a table to align it, and point happens to
> be on a horizontal rule, it throws an error that originates in
> org-element-context.

This is now fixed with the attached patch, thanks for reporting
this bug.

If think `org-element-table-row-parser' is doing the right thing by
not assigning a :contents-begin and a :contents-end to table rules,
as they have no content.  

So the fix should go directly in `org-element-context'.  Just stating
this in case Nicolas wants to double-check.

>From 5046137401779d6be0d68631b448644a868e03fb Mon Sep 17 00:00:00 2001
From: Bastien Guerry <b...@altern.org>
Date: Thu, 14 Mar 2013 12:19:41 +0100
Subject: [PATCH] org-element.el (org-element-context): Prevent an error when
 getting the context of a table rule

* org-element.el (org-element-context): Prevent an error when
getting the context of a table rule.

Thanks to Eric Abrahamsen for reporting this bug.
---
 lisp/org-element.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index 6810b98..ba2461a 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -4751,7 +4751,8 @@ Providing it allows for quicker computation."
 				    :contents-begin element))
 			     (cend (org-element-property
 				    :contents-end element)))
-			 (and (>= origin cbeg)
+			 (and cbeg cend ; cbeg is nil for table rules
+			      (>= origin cbeg)
 			      (<= origin cend)
 			      (progn (goto-char cbeg) (setq end cend)))))
 		  (and (eq type 'keyword)
-- 
1.8.1.4

-- 
 Bastien

Reply via email to