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

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

[elpa] externals/org 0b07b30dea: orgtbl-toggle-comment: Fix when table i


From: ELPA Syncer
Subject: [elpa] externals/org 0b07b30dea: orgtbl-toggle-comment: Fix when table is at `point-min' or `point-max'
Date: Mon, 9 May 2022 09:57:41 -0400 (EDT)

branch: externals/org
commit 0b07b30dea6ecddbb81546489c8e8b1b7c4637e5
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    orgtbl-toggle-comment: Fix when table is at `point-min' or `point-max'
    
    * lisp/org-table.el (orgtbl-toggle-comment): Avoid infinite loop when
    begin/end line of the table is at `point-min' or `point-max'.
    
    Fixes https://orgmode.org/list/874k20v7sj.fsf@gmail.com
---
 lisp/org-table.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/org-table.el b/lisp/org-table.el
index 2f31bef560..b160dc97c2 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -5543,10 +5543,14 @@ First element has index 0, or I0 if given."
         beg end)
     (save-excursion
       (beginning-of-line 1)
-      (while (looking-at re) (beginning-of-line 0))
-      (beginning-of-line 2)
+      (while (and (not (eq (point) (point-min)))
+                  (looking-at re))
+        (beginning-of-line 0))
+      (unless (eq (point) (point-min)) (beginning-of-line 2))
       (setq beg (point))
-      (while (looking-at re) (beginning-of-line 2))
+      (while (and (not (eq (point) (point-max)))
+                  (looking-at re))
+        (beginning-of-line 2))
       (setq end (point)))
     (comment-region beg end (if commented '(4) nil))))
 



reply via email to

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