88 votes

How do I get a fancier mode line that uses solid colors and triangles?

This can be achieved with two packages: smart-mode-line. powerline. Overall, smart-mode-line is more powerful than powerline (pardon the pun), in the sense that it offers more features to control ...
user avatar
  • 22.4k
48 votes

How do I get a fancier mode line that uses solid colors and triangles?

This can be achieved with a package called "powerline". There are several variants available, including at least one you can install through package.el. Personally, I use this one. Here's a ...
user avatar
29 votes
Accepted

What piece of code in Emacs makes `line-number-mode` print "??" as line number in buffers with long lines?

Thanks to @lunaryorn's suggestions I've been able to locate the piece of code causing this. It looks like format-mode-line eventually calls decode_mode_spec to turn the format codes given into values. ...
user avatar
  • 21k
24 votes

How to count characters in buffer including spaces?

Alternatively, count words and characters including spaces in a selection: M-x count-words-region
user avatar
23 votes
Accepted

Moving the mode line and minibuffer to the top

The content of the mode-line are stored in the variable mode-line-format. Emacs also supports a header line whose content is steered by the variable header-line-format. In principle you can use (...
user avatar
  • 2,447
21 votes
Accepted

Hide list of minor modes in mode-line

Diminish mode (available in Melpa) will do this. (diminish 'projectile-mode)
user avatar
19 votes
Accepted

A faster method to obtain `line-number-at-pos` in large buffers

Try (string-to-number (format-mode-line "%l")) You can extract other information using %-Constructs described in the Emacs Lisp Manual. Caveat: In addition to limitations pointed out by wasamasa ...
user avatar
  • 8,952
18 votes

How can I set different font sizes for buffers and for the mode-line?

Try replacing the code for setting the font size with this: (set-face-attribute 'default nil :font "DejaVu Sans Mono-14") (set-face-attribute 'mode-line nil :font "DejaVu Sans Mono-10") Of course, ...
user avatar
  • 14.2k
17 votes

Hide list of minor modes in mode-line

As mbork commented, you can use delight.el to selectively modify or disable minor (and indeed major) mode text in the mode line. One of the advantages is that it takes care of the eval-after-load (...
user avatar
  • 43.5k
13 votes
Accepted

How can I display the parent directory of the current file in the modeline?

You can configure the mode line format as you wish. If you want to show the parent directory together with the buffer name (which is usually the file name, for a buffer that's visiting a file), modify ...
user avatar
13 votes

How do I get a fancier mode line that uses solid colors and triangles?

As other people have mentioned, powerline is the package that formats the modeline that way. Most emacs themes however, don't define colours for powerline (which is not great). One theme that does is ...
user avatar
13 votes

How to right align some items in the modeline?

Like the answer in the comments, you can do this yourself by writing code to return a nicely spaced string. Here is a simple way that supports only left and right aligned text applied to your ...
user avatar
11 votes
Accepted

Which class or method or function am I in?

which-function-mode displays the current method name. The following configuration, which I got from Emacs Redux, displays the current method / function / orgmode heading in the top header line rather ...
user avatar
  • 5,005
11 votes
Accepted

Can I use an image in my modeline lighter?

The mode line is rendered from a list of segments, each of which come with their own special rules. See Mode Line Data for the details. The symbol section contains a crucial hint to make your code ...
user avatar
  • 21k
10 votes

How can I display the parent directory of the current file in the modeline?

I assume you mean that you want to see the directory instead of the buffer name. (setq-default mode-line-buffer-identification '(:eval default-directory)) Or if you want your home ...
user avatar
  • 69.7k
10 votes
Accepted

Transiently adjust text size in mode line and minibuffer?

Text scaling zooms the text of a particular buffer, everywhere that the buffer is displayed. What you want to do is zoom a particular frame and not just scale the text of a particular buffer. ...
user avatar
  • 69.7k
9 votes
Accepted

display in the mode-line the number of characters in the selection

Use library Mode-Line Position (modeline-posn.el). It shows you the size of the selection (active region) in the mode line, using the region face. It optionally tells you also the number of selected ...
user avatar
  • 69.7k
9 votes

Hide list of minor modes in mode-line

Use Rich-minority with config: (require 'rich-minority) (rich-minority-mode 1) (setf rm-blacklist "") I also have the thought like you, but I shorten the mode-line more paranoid: Remove all ...
user avatar
  • 930
9 votes

Single mode line for all windows

I don't have a solution for a single modeline, but here are two possible alternative solutions: 1. Only render the mode line in the active window: If you use powerline, you could wrap your mode-line-...
user avatar
9 votes
Accepted

Show something in active mode line instead of all mode lines

In the following example, the word “ACTIVE” will appear in the mode-line of the window that is active, and all other windows will display the word “INACTIVE” in the mode-line. Be sure to try this ...
user avatar
  • 17.7k
8 votes
Accepted

Display list of words along bottom of frame?

With a lot of hacky experimentation I was able to get #6 (using minibuffer text) to a 'good enough' working state. Here's a screenshot: There are several key parts to make this work: Inserting text ...
user avatar
8 votes
Accepted

How to abbreviate version control information in the mode line?

Here is a piece of advice that shortens Git to G, while leaving mode line strings for other version control systems unchanged: (defun my-shorten-vc-mode-line (string) (cond ((string-prefix-p "...
user avatar
  • 5,834
8 votes

More than one line in mode-line?

I'm afraid this is generally not possible as newlines in mode-line-format are interpreted verbatim and appear as ^J or ^M. What could work would be replacing the mode line with an image spanning two ...
user avatar
  • 21k
7 votes

How can I display the parent directory of the current file in the modeline?

You install use smart-mode-line. It's configured to display the file path in the mode-line, whenever that's relevant. Just install it, and then turn it on with (sml/setup). It also has a lot of ...
user avatar
  • 22.4k
7 votes

How can I set different font sizes for buffers and for the mode-line?

Thanks to the answer provided by itsjeyd I managed to write a short expression to change the size of all mode-line related faces for all current and future frames. If you're using other themes ...
user avatar
  • 1,723
7 votes

Hide list of minor modes in mode-line

Here is what worked for me: (defvar hidden-minor-modes ; example, write your own list of hidden '(abbrev-mode ; minor modes auto-fill-function flycheck-mode flyspell-mode ...
user avatar
  • 4,773
7 votes
Accepted

Hide mode-line for minimap buffers

To disable the mode line in Minimap sidebars, add a hook to minimap-sb-mode-hook: (add-hook 'minimap-sb-mode-hook (lambda () (setq mode-line-format nil)))
user avatar
  • 8,952
7 votes

How to display time in seconds in the mode line?

The top of the EmacsWiki page on Display Time tells you how to control the format of the time. Of the three variables, it looks like display-time-format is the most relevant after inspecting the ...
user avatar
  • 31.1k
7 votes
Accepted

Make a new frame with only mode-line

Extending Jorgen Schäfer's answer with Matthew Piziak's suggestion produces the following snippet: (with-current-buffer (generate-new-buffer "*empty*") (make-frame '((minibuffer . nil) ...
user avatar
  • 10k
7 votes
Accepted

How to customize mode-line-format?

If you want something that changes according to conditions then you pretty much need to use :eval, as in the second borrowed-code snippet. There are several things wrong with your code. buffer-...
user avatar
  • 69.7k

Only top scored, non community-wiki answers of a minimum length are eligible