Mode line's %p
displays the percentage of the current view of the buffer:
%p The percentage of the buffer text above the top of window, or ‘Top’, ‘Bottom’ or ‘All’. Note that the default mode line construct truncates this to three characters.
I don't like the Top/Bottom/All and I'd like to always display the percentage. Is there a way to achieve this?
Top
means 0%.Bottom
means 100%.All
means 100% and the top is visible too. You can do pretty much anything you like to the mode line, but in this case it would be a pain to monkey with this. Note that you can easily reverse the percentage direction - see%P
(instead of%p
).point-min
andwindow-start
, andwindow-end
andpoint-max
, and if so desired, the size of the visible buffer could be factored in -- i.e., points betweenwindow-start
towindow-end
-- those calculations could be done in a blink of an eye and would not affect performance because point does not move. Those buffer-size calculations could be turned into percentages. I believe that this is an answer, but I'll let someone else write it up because I have other projects on my plate today.