org-sticky-header
org-sticky-header copied to clipboard
Error during redisplay if org-sticky-header-always-show-header is nil
My messages buffer was constantly filling up with redisplay errors like this:
Error during redisplay: (eval (progn (setq org-sticky-header-stickyline (propertize (org-sticky-header--fetch-stickyline) 'keymap org-sticky-header-keymap)) (list (propertize " " 'display '((space :align-to 0))) 'org-sticky-header-stickyline))) signaled (wrong-type-argument stringp nil) [5 times]
https://github.com/alphapapa/org-sticky-header/issues/19#issuecomment-684128927 led me to a solution. I too had org-sticky-header-always-show-header set to nil, which caused org-sticky-header--fetch-stickyline to sometimes return nil instead of an empty string.
The below seems to solve it:
(defun org-sticky-header--fetch-stickyline ()
"Return string of Org heading or outline path for display in header line."
(org-with-wide-buffer
(goto-char (window-start))
(if (org-before-first-heading-p)
""
;; No non-header lines above top displayed header
(if (or org-sticky-header-always-show-header
(not (org-at-heading-p)))
;; Header should be shown
(progn
(when (fboundp 'org-inlinetask-in-task-p)
;; Skip inline tasks
(while (and (org-back-to-heading)
(org-inlinetask-in-task-p))
(forward-line -1)))
(cond
;; TODO: Update minimum Emacs version and use `pcase'.
((null org-sticky-header-full-path)
(concat (org-sticky-header--get-prefix)
(org-sticky-header--heading-string)))
((eq org-sticky-header-full-path 'full)
(concat (org-sticky-header--get-prefix)
(mapconcat 'identity
(nreverse
(save-excursion
(cl-loop collect (org-sticky-header--heading-string)
while (org-up-heading-safe))))
org-sticky-header-outline-path-separator)))
((eq org-sticky-header-full-path 'reversed)
(let ((s (concat
(org-sticky-header--get-prefix)
(mapconcat 'identity
(save-excursion
(cl-loop collect (org-sticky-header--heading-string)
while (org-up-heading-safe)))
org-sticky-header-outline-path-reversed-separator))))
(if (> (string-width s) (window-width))
(concat (substring s 0 (- (window-width) 2))
"..")
s)))
(t "")))
""))))
Hi,
Thanks for reporting this bug. Please try this commit and let me know if it fixes it for you: https://github.com/alphapapa/org-sticky-header/commit/d0304316690b28469530bf92c8a893cfac94fb44
That fixes it for me! Sorry for the delay in responding.
Hi @alphapapa, I've been seeing this issue too, and the linked commit fixes it for me. Would appreciate it if you could merge the fix!
BTW I have installed this patch locally at my site and it works correctly. If you could merge it when you get the chance, that would be great.