In terminal Emacs:

scratch buffer in terminal Emacs

Look at the mode line. Notice that there are lots of dashes (hyphen-minuses, to be precise) (-----) at the end of the mode line (after "(Lisp Interaction)"). How do I remove these dashes?

These dashes only seem to appear in terminal Emacs but not in GUI Emacs.

(I am using GNU Emacs 25.2 on Ubuntu 18.04 bionic beaver).

  • The hyphens appear also in GUI Emacs, for me at least. Perhaps you are using some fancy mode-line. Do you not see the dashes in GUI Emacs if you start Emacs with emacs -Q? If you see them, please edit the question and tags to remove mention of terminal. Thx. – Drew Jan 12 at 0:39
  • @Drew I don't see the dashes in GUI Emacs when I start Emacs with emacs -Q or emacs --no-site-file --no-init-file. – Flux Jan 12 at 0:44
  • I see them with GUI Emacs on MS Windows. Sounds like it's platform-dependent. Probably has to do with whether a graphic toolkit is used. You might want to specify your platform etc. (in the question). – Drew Jan 12 at 2:36
  • @Drew What do you get when you evaluate (display-graphic-p) in your terminal Emacs and in your GUI Emacs? – Flux Jan 12 at 2:48
  • nil for emacs -nw, t for GUI. – Drew Jan 12 at 4:09

It appears that the dashes are caused by the variable mode-line-end-spaces, which is the last item in mode-line-format by default. The default value of mode-line-end-spaces is (:eval (unless (display-graphic-p) "-%-")), which explains why the dashes only appear in terminal Emacs but not in GUI Emacs.

This seems to remove the dashes, but I'm not sure if there are any adverse side effects:

(setq-default mode-line-end-spaces nil)

This also seems to remove the dashes:

(setq-default mode-line-format (remove 'mode-line-end-spaces mode-line-format))


Emacs mode line without trailing dashes

Perhaps someone more experienced with Emacs Lisp could comment on the validity of the methods above.

  • Setting mode-line-end-spaces seems to work pretty well. I've not noticed any adverse side effects. – amitp Jan 11 at 22:19

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.