77

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 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 ...


46

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 :...


25

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-...


18

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 ...


17

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 and Stefan (see comments below) this does not work for buffers that are not displayed. Try this: (with-temp-buffer (dotimes (i 10000) (insert (format "%...


14

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 ...


14

Diminish mode (available in Melpa) will do this. (diminish 'projectile-mode)


14

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 M-x ...


11

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 ...


11

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 ...


11

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 ...


10

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 ...


9

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 (which-function-mode) (setq-default header-line-format '((which-func-...


8

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.


8

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 unwanted spaces Remove all spaces and "min-width" of the buffer position info field. ;; Remove all unwanted spaces (setq-default mode-line-format '("%e" ...


8

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 ...


8

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...


7

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 directory abbreviated to ~/ (instead of an absolute file name, from the root), then: (setq-default mode-line-buffer-identification '(:eval (...


7

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) ...


7

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)))


7

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 ...


7

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) (unsplittable . t) (buffer-predicate . (lambda (x) nil)) (height . 2) (left-fringe . 0) ...


7

Alternatively, count words and characters including spaces in a selection: M-x count-words-region


7

The Spacemacs mode-line is provided by the Spaceline package. The answer for your question is found in the README, under the Turning segments on and off section. To toggle off the buffer size, add this to your init file: (spaceline-toggle-buffer-size-off) I'm not sure what displays the 2.2.3, though it might be from the perspective.el package. If it's not,...


7

Well, vc does that by default. From its documentation (emphasis mine): When you visit a file that is under version control, Emacs indicates this on the mode line. For example, ‘Bzr-1223’ says that Bazaar is used for that file, and the current revision ID is 1223. The character between the back-end name and the revision ID indicates the "...


7

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. (defvar ...


6

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 features to make that display more concise. For instance, “~/.emacs.d/” gets replaced with “:ED:” (and you can configure further replacements).


6

I'm not sure whether you can do that with the built-in display-battery-mode. It's not very customizable in this regard, and you may have to resort to heavy advises to change the built-in mode as you like. I wrote fancy-battery.el some time ago to provide a more customizable indicator for the battery status. Notably, I wanted to indicate the state of the ...


6

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 ...


6

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 "Git" string) (concat "G" (substring string 3))) (t string))) (advice-add 'vc-git-mode-line-string :filter-return 'my-shorten-vc-mode-line) It uses ...


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