Some buffers get too big names, especially when I use org-tree-to-indirect-buffer.

Is there some way to limit it in the status bar?


Current buffer name displayed in the status bar:

gtd.org-TODO [#A] Reduce the file name in the status bar if it is too big-1

Desired buffer name displayed in the status bar:


1 Answer 1


When in the org-mode buffer do, M-: and enter the following when prompted

(setq mode-line-buffer-identification '(-12 "%b"))

You will see the buffer name truncated to a width of 12.

Relevant extracts from the *Help* ...

mode -line-buffer-identification is a variable defined in ‘bindings.el’.

Its value is shown below.

Mode line construct for identifying the buffer being displayed.

Its default value is ("%12b") with some text properties added. Major modes that edit things other than ordinary files may change this (e.g. Info, Dired,...)

mode-line-format is a variable defined in ‘C source code’.

Template for displaying mode line for a window’s buffer.

The value may be nil, a string, a symbol or a list.

A list whose car is an integer is processed by processing the cadr of the list, and padding (if the number is positive) or truncating (if negative) to the width specified by that number.

A string is printed verbatim in the mode line except for %-constructs:

%b -- print buffer name.

  • Many thanks! It solved my problem. Based on your answer, I made it default for any buffer/mode using (setq-default mode-line-buffer-identification '(-12 "%b")) in my init.el. Oct 4, 2022 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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