You could also use the sml-modeline
package. It works pretty well in the terminal (imo) and is a nice alternative when yascroll
doesn't work so well. However, you might want to apply the following monkey patch to sml-modeline-mode
if you don't want it messing with stuff that's already in your modeline:
(require 'sml-modeline)
(defun sml-modeline-mode
(&optional arg)
"Show buffer size and position like scrollbar in mode line.
You can customize this minor mode, see option `sml-modeline-mode'.
Note: If you turn this mode on then you probably want to turn off
option `scroll-bar-mode'."
(interactive
(list
(or current-prefix-arg 'toggle)))
(let
((last-message
(current-message)))
(setq-default sml-modeline-mode
(if
(eq arg 'toggle)
(not
(default-value 'sml-modeline-mode))
(>
(prefix-numeric-value arg)
0)))
(if sml-modeline-mode
(progn
(unless sml-modeline-old-car-mode-line-position
(setq sml-modeline-old-car-mode-line-position
(car mode-line-position)))
(add-to-list 'mode-line-position ;; this line is patched and...
'(:eval
(list
(sml-modeline-create)))))
(add-to-list 'mode-line-position sml-modeline-old-car-mode-line-position)) ;; this line is patched
;; (they use `add-to-list' instead of `setcar')
(run-hooks 'sml-modeline-mode-hook
(if
(default-value 'sml-modeline-mode)
'sml-modeline-mode-on-hook 'sml-modeline-mode-off-hook))
(if
(called-interactively-p 'any)
(progn
(customize-mark-as-set 'sml-modeline-mode)
(unless
(and
(current-message)
(not
(equal last-message
(current-message))))
(let
((local ""))
(message "Sml-Modeline mode %sabled%s"
(if
(default-value 'sml-modeline-mode)
"en" "dis")
local))))))
(force-mode-line-update)
(default-value 'sml-modeline-mode))
As you can see, only two lines there are patched which just make sure that it uses add-to-list
instead of setcar
(this keeps it from overriding anything that's the car
of mode-line-position
). Also, I have the following settings in my Custom file for sml-modeline
:
(custom-set-variables
...
'(sml-modeline-borders (quote ("[" . "] ")))
'(sml-modeline-len 17)
'(sml-modeline-numbers (quote percentage))
...)
The only real quirks I've seen for this mode are that it's not really accurate in things like Info-mode
(because it seems that Info-mode
buffers are actually one big buffer given the illusion of being multiple ones) and sometimes the "scrollbar" disappears between the percent symbol and the number adjacent to it when the "scrollbar" is really small. Other than that, sml-modeline
works pretty nicely.
EDIT:
I just found two hacky "fixes" for the aforementioned bugs. For the bug regarding Info-mode
et al. scrolling, if you remove the (widen)
invocations from sml-modeline-create
, you'll get the expected behavior. Note that I've only tested this in Info-mode
, so don't expect this "fix" to give desired behavior everywhere. For the other bug regarding the "scrollbar" disappearing, you can eliminate this effect by not setting the sml-modeline-borders
variable. Not exactly sure why that works, but it does so whatever.