branch: externals/valign
commit 927d82d0196a7cd5f610886dd42bbd9aa18e5842
Author: Yuan Fu <[email protected]>
Commit: Yuan Fu <[email protected]>

    Support indented tables
    
    * valign.el (valign--beginning-of-table, valign--end-of-table): skip
    white space characters at the beginning of a line.
---
 valign.el | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/valign.el b/valign.el
index 5af7ae1..bba3140 100644
--- a/valign.el
+++ b/valign.el
@@ -229,12 +229,16 @@ Start from point, stop at LIMIT."
 Assumes point is on a table.  Return nil if failed, point
 otherwise."
   (beginning-of-line)
+  (skip-chars-forward " \t")
   (if (not (eq (char-after) ?|))
       nil
     (while (eq (char-after) ?|)
-      (forward-line -1))
+      (forward-line -1)
+      (beginning-of-line)
+      (skip-chars-forward " \t"))
     (unless (eq (char-after) ?|)
-      (forward-line))
+      (search-forward "|")
+      (backward-char))
     (point)))
 
 (defun valign--end-of-table ()
@@ -242,11 +246,15 @@ otherwise."
 Assumes point is on a table.  Return nil if failed, point
 otherwise."
   (beginning-of-line)
+  (skip-chars-forward " \t")
   (if (not (eq (char-after) ?|))
       nil
     (while (eq (char-after) ?|)
-      (forward-line 1))
-    (backward-char)
+      (forward-line 1)
+      (beginning-of-line)
+      (skip-chars-forward " \t"))
+    (search-backward "|")
+    (forward-char)
     (point)))
 
 (defun valign--put-text-property (beg end xpos)

Reply via email to