[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org a0b8b7303b 5/5: org-inlinetask: Fix infinite loop c
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org a0b8b7303b 5/5: org-inlinetask: Fix infinite loop caused by 5f184b5f2 |
Date: |
Sat, 20 Aug 2022 02:57:54 -0400 (EDT) |
branch: externals/org
commit a0b8b7303b9683fae4503c57ee8ae191cb89a297
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org-inlinetask: Fix infinite loop caused by 5f184b5f2
* lisp/org-inlinetask.el (org-inlinetask-toggle-visibility): Accept
optional argument forcing folding/unfolding.
(org-inlinetask-hide-tasks): Do not use `backward-char' since it can
cause infinite loop. Force folding instead.
Fixes
https://orgmode.org/list/CAKJdtO8+bh4G-Mzhp7k1x9SGfjo9PxdmncdHcUJKCk6PbK9d=g@mail.gmail.com
---
lisp/org-inlinetask.el | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el
index 07aa94f324..3c5d02ee72 100644
--- a/lisp/org-inlinetask.el
+++ b/lisp/org-inlinetask.el
@@ -305,8 +305,10 @@ If the task has an end part, also demote it."
(add-text-properties (match-beginning 3) (match-end 3)
'(face org-inlinetask font-lock-fontified t)))))
-(defun org-inlinetask-toggle-visibility ()
- "Toggle visibility of inline task at point."
+(defun org-inlinetask-toggle-visibility (&optional state)
+ "Toggle visibility of inline task at point.
+When optional argument STATE is `fold', fold unconditionally.
+When STATE is `unfold', unfold unconditionally."
(let ((end (save-excursion
(org-inlinetask-goto-end)
(if (bolp) (1- (point)) (point))))
@@ -317,7 +319,9 @@ If the task has an end part, also demote it."
;; Nothing to show/hide.
((= end start))
;; Inlinetask was folded: expand it.
- ((org-fold-get-folding-spec 'headline (1+ start))
+ ((and (not (eq state 'fold))
+ (or (eq state 'unfold)
+ (org-fold-get-folding-spec 'headline (1+ start))))
(org-fold-region start end nil 'headline))
(t (org-fold-region start end t 'headline)))))
@@ -330,16 +334,15 @@ This function is meant to be used in `org-cycle-hook'."
(save-excursion
(goto-char (point-min))
(while (re-search-forward regexp nil t)
- (org-inlinetask-toggle-visibility)
+ (org-inlinetask-toggle-visibility 'fold)
(org-inlinetask-goto-end)))))
(`children
(save-excursion
(while
(or (org-inlinetask-at-task-p)
(and (outline-next-heading) (org-inlinetask-at-task-p)))
- (org-inlinetask-toggle-visibility)
- (org-inlinetask-goto-end)
- (backward-char))))))
+ (org-inlinetask-toggle-visibility 'fold)
+ (org-inlinetask-goto-end))))))
(defun org-inlinetask-remove-END-maybe ()
"Remove an END line when present."