While it's possible to do 'correct' left/right alignment adding an alternative method because fully evaluating the left and right just for alignment is a bit heavy,
when there is a simpler alternative.
If you know you only need a fixed amount of space on the right, you can fill in all but N characters,
this works as long as the right size is a fixed length.
String formatting %12s
and similar can be used to ensure the string doesn't resize.
(defun mode-line-fill (reserve)
"Return empty space using FACE and leaving RESERVE space on the right."
(when
(and window-system (eq 'right (get-scroll-bar-mode)))
(setq reserve (- reserve 3)))
(propertize " "
'display
`((space :align-to (- (+ right right-fringe right-margin) ,reserve)))))
(setq-default
mode-line-format
(list
;; left align
"%e %b [%*]"
;; right align
(mode-line-fill 18)
"%6l, %4c, %8p")))
Eg:
CMakeLists.txt [-] 1590, 0, 94%
Note that this only works well if you want to display a few items on the right hand side, as with this example - line/column/percentage. Showing all minor modes for eg wouldn't work well.