This can be achieved with two packages:
Overall, smart-mode-line is more powerful than powerline
(pardon the pun), in the sense that it offers more features to control
the mode-line's behaviour and more customizability in the appearance.
The Readme has a great
list of features,
but in short it offers width-control, string ...
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 screenshot from the package's README:
You can configure the color by setting the face of the mode-line:
(set-face-attribute 'mode-line nil
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. For the case of %l this function does a few sanity checks to avoid spending too much time calculating, then checks whether the current line is exceeding line-...
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
(setq header-line-format mode-line-format)
(setq-default mode-line-format nil)
to make the format of the header-line be equal to that of your current mode line and ...
(string-to-number (format-mode-line "%l"))
You can extract other information using %-Constructs described in the Emacs Lisp Manual.
In addition to limitations pointed out by wasamasa and Stefan (see comments below) this does not work for buffers that are not displayed.
(dotimes (i 10000)
(insert (format "%...
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, you'll want to change the sizes (14 and 10) to values of your liking.
If you want to customize a specific face and don't know the name of it, try doing
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 (which you need to write manually with diminish.el in most use-cases), which makes the configuration cleaner. You still need the same information -- the name of ...
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 mode-line-buffer-identification; otherwise, add an entry to mode-line-format. There isn't a built-in construct for “parent directory of the current file”, so ...
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 the colourful (and comprehensive) moe-theme. It even has a mode that changes colour in the evening to be easier on the eyes. It looks like this:
My arrows in ...
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 specifications.
;; write a function to do the spacing
(defun simple-mode-line-render (left right)
"Return a string of `window-width' length containing LEFT, and ...
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 than the mode line:
;; Show the current function name in the header line
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 work:
Unless SYMBOL is marked as “risky” (i.e., it has a non-‘nil’
‘risky-local-variable’ property), all text properties specified in
SYMBOL’s value are ...
I assume you mean that you want to see the directory instead of the buffer name.
Or if you want your home directory abbreviated to ~/ (instead of an absolute file name, from the root), then:
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.
Commands zoom-in, zoom-out, and zoom-in/out of library zoom-frm.el let you do both of these things easily and incrementally.
From the keyboard, command zoom-in/out ...
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 characters or characters and lines, etc.
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 example with emacs -Q to verify that it works as advertised. Thereafter, customize it as needed.
Add additional hooks as needed to call ml-update-all.
Use Rich-minority with config:
(setf rm-blacklist "")
I also have the thought like you, but I shorten the mode-line more paranoid:
Remove all unwanted spaces
Remove all spaces and "min-width" of the buffer position info field.
;; Remove all unwanted spaces
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 into the minibuffer surprisingly almost does the right thing out of the box. Text inserted there will actually show up.
By making the text be the 'after-string ...
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-format in:
((:eval (when (powerline-selected-window-active) ...)))
then change the mode-line-inactive face so blends with your background but still ...
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)
((string-prefix-p "Git" string)
(concat "G" (substring string 3)))
(advice-add 'vc-git-mode-line-string :filter-return 'my-shorten-vc-mode-line)
It uses ...
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 rows and manipulating that as needed...
You install use
It's configured to display the file path in the mode-line, whenever
Just install it, and then turn it on with (sml/setup).
It also has a lot of features to make that display more concise. For
instance, “~/.emacs.d/” gets replaced with “:ED:” (and you can
configure further replacements).
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 besides the default one (such as zenburn, etc.), the code should be put after you've declared the theme; i.e., after this line:
(load-theme 'solarized-light t)
Here is what worked for me:
(defvar hidden-minor-modes ; example, write your own list of hidden
'(abbrev-mode ; minor modes
(defun purge-minor-modes ()
(dolist (x hidden-minor-...
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 docstrings of the variables with C-h v display-time-format:
String specifying format for displaying the time in the mode line.
See the function format-time-...
Append it to global-mode-string. If your mode-line format string to append is my-string then:
(cond ((consp global-mode-string)
(add-to-list 'global-mode-string my-string 'APPEND))