Skip to main content
27 votes

How to count characters in buffer including spaces?

Alternatively, count words and characters including spaces in a selection: M-x count-words-region
Kirill Yunussov's user avatar
10 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 ...
lawlist's user avatar
  • 19.2k
9 votes

Show current org-mode outline position in modeline

The which-function minor mode by default shows part of the org outline path in the mode line; you can turn it on using M-x which-function-mode. In general, which-function tries to show the current ...
erikstokes's user avatar
  • 12.9k
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 ...
wasamasa's user avatar
  • 22.2k
8 votes

Show the full path to the file

The variable buffer-file-name contains an absolute path of the file you are visiting. To use in frame title: (setq frame-title-format '("" invocation-name ": " (:eval ...
fhdhsni's user avatar
  • 703
7 votes
Accepted

how to disable automatic dos mode?

From the https://www.emacswiki.org/emacs/EndOfLineTips You can reopen the file with the correct line ending with a command like M-x revert-buffer-with-coding-system utf-8-dos. If your file is not ...
Konstantin Morenko's user avatar
7 votes
Accepted

How to increase the size of the mode-line

Set mode-line with a :box property which has a greater line-width. The thing is you must set the :background to have the same color as the :color of the :box. I use this in my theme: `(mode-line ((...
caisah's user avatar
  • 4,096
7 votes
Accepted

How to show XPath for current location in an XML hierarchy in the modeline?

Install nxml-mode and which-function-mode. Take the nxml-where function from here and add it to your .emacs file followed by: (defun xml-find-file-hook () (when (derived-mode-p 'nxml-mode) (...
Zoltan's user avatar
  • 251
6 votes

Single mode line for all windows

I've finally achieved this by hacking emacs. You can get the source code from https://github.com/amosbird/emacs/tree/onemodeline . Basically it uses mini-window's header line to render current ...
Amos's user avatar
  • 466
6 votes
Accepted

Prevent mouse-3 on mode-line from closing the window

To unbind it: (global-set-key [mode-line mouse-3] nil) To bind it to a different command: (global-set-key [mode-line mouse-3] 'my-favorite-command) How did I find this? C-h k, then right-click ...
Drew's user avatar
  • 78k
6 votes
Accepted

How do I change the font color of mode-line?

What you call the bottom bar is the "mode line". I recommend reading the first fews sections of the manual, especially this one to know the names of the various screen elements (this is not difficult ...
JeanPierre's user avatar
  • 7,475
6 votes
Accepted

Place time displayed in the beginning of modeline

You can re-define the main mode line with doom-modeline-def-modeline. The first argument is the mode line type, the second argument is the left-hand segment list, and the third argument is the right-...
Tobias's user avatar
  • 33.3k
5 votes
Accepted

Version control information out of sync with certain modes

When using diff-hl and magit => v2.4.0 you have to add this: (add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh) As far as the information in the mode-line is concerned, I would ...
tarsius's user avatar
  • 25.8k
5 votes

How to right align some items in the modeline?

To expand on @jordon-biondo's answer and resolve a bug showing %. This example shows how mode mode line variables can be used with alignment - which took me a while to figure out. (defun simple-mode-...
ideasman42's user avatar
  • 8,856
5 votes
Accepted

how to direct spaceline to display "Narrowed" in the mode-line?

I struggled with this one for quite a while since I wanted the same thing. This is what I did: Defining a segment is quite straight forward and the documentation is very good in that sense. But that'...
anachronic's user avatar
5 votes

Changing emacs theme modeline colors

You need to change these lines. `(mode-line ((t (:background ,atom-one-dark-black :foreground ,atom-one-dark-silver)))) `(mode-line-buffer-id ((t (:weight bold)))) `(mode-line-...
fhdhsni's user avatar
  • 703
5 votes
Accepted

Is there more than mode line (and header line)?

In general, the fact that every window has only one mode-line is probably difficult to change (would require changes in the C code). Similarly, adding something below the echo-area is going to ...
Stefan's user avatar
  • 26.5k
5 votes

Toggle button on modeline

I don't have much experience customizing the mode line, but the following seems working from here. It displays the status of column-number-mode using ON and OFF, when you click the text, the mode will ...
xuchunyang's user avatar
  • 14.6k
5 votes
Accepted

local-map in header line

A click on the mode-line does not generate the event sequence [mouse-1] but [mode-line mouse-1] and similarly a click on the header line generates the sequence [header-line mouse-1], so you need to ...
Stefan's user avatar
  • 26.5k
5 votes
Accepted

How do I display current cell address of an org-mode table?

The coordinates can be displayed with ctrl-c} - org-table-toggle-coordinate-overlays. It shows the coordinates within the table: | a | b | c | |---+---+---| |foo|bar|baz| |baz|bar|foo| |bar|baz|foo| ...
manandearth's user avatar
  • 2,128
5 votes
Accepted

How to disable changing the current buffer by clicking buffer name in mode line?

Try using: (define-key mode-line-buffer-identification-keymap [mode-line mouse-1] nil) (define-key mode-line-buffer-identification-keymap [mode-line mouse-3] nil) The variable mode-line-buffer-...
lawlist's user avatar
  • 19.2k
5 votes
Accepted

How can I apply diminish to apheleia-mode

Instead of this: (apheleia-global-mode +1) (with-eval-after-load 'apheleia ... ) (diminish 'apheleia-mode) Do this: (diminish 'apheleia-mode) (apheleia-global-mode +1) (with-eval-after-load '...
phils's user avatar
  • 51.7k
4 votes

Hide list of minor modes in mode-line

It's worth noting that use-package supports diminish and delight. If you use it to manage your packages you can hide the minor modes in the mode line adding the :diminish or :delight keywords. (use-...
Marcos's user avatar
  • 41
4 votes

How to right align some items in the modeline?

Building off of @ideasman42's answer, you can determine the required number of characters to pad the right items by using format-mode-line. For example, you can put the items you want to align to the ...
Tyler Grinn's user avatar
4 votes
Accepted

Display max line in bottom line (nox) (aka mode-line)

count-lines (also used by line-number-at-pos) is increasingly less efficient as the buffer grows in size/length, whereas (format-mode-line "%l") does not have those limitations -- however, there are ...
lawlist's user avatar
  • 19.2k
4 votes
Accepted

How do I change the mode indicators for evil-mode in the spaceline mode line package?

You can modify how the mode-line shows the evil state by setting the corresponding tag variable. You'll need these lines somewhere in your emacs init file. (setq evil-normal-state-tag "NORMAL") (setq ...
justbur's user avatar
  • 1,510
4 votes

How to display file size in the mode line

Sure, just run M-x size-indication-mode. See section 14.18 of the Emacs manual for other things you can do.
db48x's user avatar
  • 18.4k
4 votes

Colored string in mode line

@NickD provided a good answer: use a face. OP's comment to Nick's answer says that he'll try to write a function that, given a string, returns a propertized string. Such functions already exist: ...
Drew's user avatar
  • 78k
4 votes
Accepted

How do I remove all the trailing dashes in the mode line of terminal Emacs?

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-...
Flux's user avatar
  • 613
4 votes
Accepted

How to show the remaining disk space in the modeline?

There is the function free-disk-space since Emacs 27. Modify your modeline to insert (get-free-disk-space default-directory). There are many ways to add information to the mode line. Do C-h i g(elisp)...
Michael Albinus's user avatar

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