I'm using this test code.
(defun +outline~show-all (orig-fn &rest args)
"Show all."
(let ((beg1 (window-start))
(end1 (window-end))
(beg2) (end2))
(apply orig-fn args)
(setq beg2 (window-start) end2 (window-end))
(message "before (%d , %d) | after (%d , %d)" beg1 end1 beg2 end2)))
(advice-add #'outline-show-all :around #'outline~show-all)
I expect difference between (window-start)
and (window-end)
to be smaller after calling outline-show-all
in a (sufficiently large) org file with folded headings. This is because the window can't show as much of the text now that the contents of org headings are visible. But the window beginning and end before calling outline-show-all
and after are the same according to the output of my advice.
Here's an example of the output in a huge orgfile.
before (1 , 246850) | after (1 , 246850)
It is visibly obvious that the window beginning and end have changed. But to make sure I use eval-expression
and indeed (window-end)
is smaller.
I evaluated this form: (message "wndow-beg: %d | window-end: %d" (window-start) (window-end))
.
I get this output.
window-beg: 1 | window-end: 884
But why didn't I get this output from my advice?
window-scroll-functions
hook. For several months, I used a combination of thepost-command-hook
andwindow-scroll-functions
hook to get window-start/end in the majority of situations, but not all of them. Another idea is to forceredisplay
and then get the values of window start/end after redisplay, but flickers – lawlist Sep 03 '19 at 21:06redisplay
once. – Aquaactress Sep 04 '19 at 02:56redisplay
did work for my purposes. But definitely mention (as you did in the comment) it's not foolproof by any means. – Aquaactress Sep 04 '19 at 03:04outline-show-all
. – Aquaactress Sep 04 '19 at 03:37