The text in my modeline fits exactly in the modeline, I would like to have some more padding above and below the text, couldn't find an option for it and don't know much about text properties in Emacs. How can I achieve that?


You can customize the :box attribute of the mode-line-face. From the documentation (C-hset-face-attributeRET


VALUE specifies whether characters in FACE should have a box drawn around them. If VALUE is nil, explicitly don't draw boxes. If VALUE is t, draw a box with lines of width 1 in the foreground color of the face. If VALUE is a string, the string must be a color name, and the box is drawn in that color with a line width of 1. Otherwise, VALUE must be a property list of the form `(:line-width WIDTH :color COLOR :style STYLE)'. If a keyword/value pair is missing from the property list, a default value will be used for the value, as specified below. WIDTH specifies the width of the lines to draw; it defaults to 1.

So that following should give you the padding you want

(set-face-attribute 'mode-line nil
                    :box '(:line-width 3))

You might also want to give a certain background to the box, you can do that by specifying the :color property to the :box property something like below

(set-face-attribute 'mode-line nil
                :box '(:line-width 6 :color "gray20"))

Credits: I got this trick from Amit Patel's blog

  • Your welcome, updated the answer to mention the way to specify the color for the box – Iqbal Ansari Sep 8 '15 at 12:31
  • Thanks, just figured it out(by reading the documentation excerpt you provided) and deleted my previous comment before I noticed your edit. – clemera Sep 8 '15 at 12:33

A hacky solution could consist in adding a tall zero-width character at the beginning of your mode-line. Something like:

(setq-default mode-line-format
              (cons (propertize "\u200b" 'display '((raise -0.5) (height 2))) mode-line-format))
  • Shows no effect in my mode-line... – clemera Sep 8 '15 at 10:57
  • Are you using emacs in GUI mode (as opposed to emacs -nw in a terminal)? Does it have no effect at all or only a partial effect (in one of the buffers, for example)? – François Févotte Sep 8 '15 at 12:10
  • I edited the answer to fix a problem with buffer-local value (the previous solution worked only for one buffer). – François Févotte Sep 8 '15 at 12:13
  • It works now thanks, it was a problem with another manual mode-line update config which interfered with your solution. – clemera Sep 8 '15 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.