emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/valign cd7c17f 052/198: Fix infinite loop


From: Stefan Monnier
Subject: [elpa] externals/valign cd7c17f 052/198: Fix infinite loop
Date: Tue, 1 Dec 2020 18:19:15 -0500 (EST)

branch: externals/valign
commit cd7c17f3d5dbdb979a4c829eb028e678c0ed581b
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>

    Fix infinite loop
    
    * valign.el (valign--beginning-of-table, valign--end-of-table): Fix.
---
 valign.el | 25 +++++--------------------
 1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/valign.el b/valign.el
index 37e4850..7ead41e 100644
--- a/valign.el
+++ b/valign.el
@@ -302,16 +302,8 @@ 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 (and (eq (char-after) ?|)
-                (eq (forward-line -1) 0))
-      (beginning-of-line)
-      (skip-chars-forward " \t"))
-    (unless (eq (char-after) ?|)
-      (search-forward "|")
-      (backward-char))
+  (if (not (looking-at "[ \t]*|")) nil
+    (while (re-search-backward "^[ \t]*|" nil t))
     (point)))
 
 (defun valign--end-of-table ()
@@ -319,16 +311,9 @@ 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 (and (eq (char-after) ?|)
-                (eq (forward-line 1) 0))
-      (beginning-of-line)
-      (skip-chars-forward " \t"))
-    (search-backward "|")
-    (forward-char)
-    (point)))
+  (if (not (looking-at "[ \t]*|")) nil
+    (while (re-search-forward "|[^|]*$" nil t))
+    (line-end-position)))
 
 (defun valign--put-text-property (beg end xpos)
   "Put text property on text from BEG to END.



reply via email to

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