From 5c4a699e5a8d9ce6045d0ce710dcf14b9a92d2d8 Mon Sep 17 00:00:00 2001 Message-Id: <5c4a699e5a8d9ce6045d0ce710dcf14b9a92d2d8.1624364038.git.yantar92@gmail.com> From: Ihor Radchenko Date: Tue, 22 Jun 2021 20:10:16 +0800 Subject: [PATCH] Avoid infinite loop in org-agenda-dim-blocked-tasks * lisp/org-agenda.el (org-agenda-dim-blocked-tasks): When the blocked task is the last line in agenda buffer and no trailing newline is present, (move-beginning-of-line 2) would not move the point causing infinite loop. Now, such case is handled correctly. --- lisp/org-agenda.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 44acd035a..b5fc0179a 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -4107,7 +4107,9 @@ (defun org-agenda-dim-blocked-tasks (&optional _invisible) (overlay-put ov 'face 'org-agenda-dimmed-todo-face)) (when invisible (org-agenda-filter-hide-line 'todo-blocked))) - (move-beginning-of-line 2)))) + (if (= (point-max) (line-end-position)) + (goto-char (point-max)) + (move-beginning-of-line 2))))) (when (called-interactively-p 'interactive) (message "Dim or hide blocked tasks...done"))) -- 2.31.1