GNU bug report logs -
#27847
26.0.50; mode-line-percent-position: line-based instead of char-based (optionally)
Previous Next
Full log
Message #17 received at 27847 <at> debbugs.gnu.org (full text, mbox):
Dani Moncayo <dmoncayo <at> gmail.com> writes:
>>> I'd prefer this (those) percentage(s) to be based on the
>>> number of
>>> _lines_ instead
>>
>> What do you want to be displayed in that case when line numbers
>> are
>> not counted and displayed as "???" ? Do you want Emacs to
>> count lines
>> even though the limits which control that are exceeded?
>
> In cases where line numbers are not counted (I didn't know about
> such
> cases, BTW), I guess Emacs could display "??" as the percentage,
> meaning that the value is unknown at that moment.
>
>> Also note that for your feature to be implemented, Emacs needs
>> to
>> count lines in the entire buffer each time the buffer is
>> changed, so I
>> expect this feature to slow down redisplay.
>
> Maybe this computation could be optimized somehow. In any case,
> if
> someone implements it and the slow down is observable, it could
> be
> advertised in the manual and/or the docstring of the variable
> which
> enables this feature.
As a data point, i have this as part of my `mode-line-format`
setup:
'(:eval
(let ((buffer-line-count (count-lines (point-min)
(point-max))))
(number-to-string
(round
(* 100 (/
(float (count-lines 1 (point)))
(if (equal 0 buffer-line-count)
1
buffer-line-count)))))))
"%%"
which gives me at least a rough percentage (i.e. 'good enough' for
my
needs), and i've not noticed any slowdown as a result.
Alexis.
This bug report was last modified 7 years and 323 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.