From 4f8ac0a7a3d5575fedf5ea311bd34ea09c2a0d99 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 10 Dec 2020 00:40:05 -0500 Subject: [PATCH] org.el: Fix cycling hang when %p is in frame-title-format * lisp/org.el (org-optimize-window-after-visibility-change): Guard against calling set-window-start with a nil POS argument. org-optimize-window-after-visibility-change calls set-window-start with org-scroll-position-to-restore when it is a repeat call (i.e. last-command and this-command match). However, org-scroll-position-to-restore may not have yet been set yet (e.g. if org-startup-folded is at its default value of showeverything). Calling set-window-start appears to generally be a noop, but, for a reason that I don't understand, it triggers a hang when %p is in frame-title-format. Reported-by: Massimo Lauria Ref: https://orgmode.org/list/CAJCFsEEHJXP4nKZpWdzheMM5O0Dq-tT+v0u0FsT+3Q0mi4v10A@mail.gmail.com --- lisp/org.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 500e9659a..0c1d36a4e 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6618,7 +6618,8 @@ This function is the default value of the hook `org-cycle-hook'." (cond ((eq state 'content) nil) ((eq state 'all) nil) - ((and (eq state 'folded) (eq last-command this-command)) + ((and org-scroll-position-to-restore + (eq state 'folded) (eq last-command this-command)) (set-window-start nil org-scroll-position-to-restore)) ((eq state 'folded) nil) ((eq state 'children)