モードラインの右端に値を配置する方法はありますか?
現在の私の理解では、値のサイズが大きくなると、モードラインはその値をさらに右に「プッシュ」します。いくつかの値が右側から始まり、中央に拡大することをお勧めします。
電力線などのソリューションを試してみましたが、標準のモードラインと同じ量の情報を表示するには、かなり気が散り、セットアップが複雑に思えます。
ここにそれを行う1つの方法があります。秘訣は、行末からテキストを表示するために必要な場所を引いたところまでスペースを追加することです (emacs wiki の電力線コードから抽出):
(defun mode-line-fill (face reserve)
"Return empty space using FACE and leaving RESERVE space on the right."
(unless reserve
(setq reserve 20))
(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)))
'face face))
;; Set the modeline to tell me the filename, hostname, etc..
(setq-default mode-line-format (list
" "
mode-line-mule-info
'mode-line-modified
"- "
'mode-line-buffer-identification
" (%l, %c) "
'mode-line-modes
" -- "
`(vc-mode vc-mode)
;; Fill until the end of line but 10 characters
(mode-line-fill 'mode-line 10)
"Some text"
)
)