开发者

Setting fonts to parts of modeline

How can I use multiple fonts in the modeline? For example, If want it to loo开发者_开发技巧k like

Line: 23 Size: 3000

with Line and Size in a different font than the modeline font, how should

(setq-default mode-line-format '(
    "Line: %l Size: %i"
))

be modified?


Use propertize. For example, to get Line: and Size: in bold as in your example:

(setq-default mode-line-format `(
    ,(propertize "Line:" 'face 'bold)
    " %l "
    ,(propertize "Size:" 'face 'bold)
    " %i"
))

You can use M-x list-faces-display to see samples of defined faces, or define your own.

For future reference, you can take a look at the documentation for any variable you're trying to customize with C-h v; the help for mode-line-format mentions using propertize.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜