Skip to content

Instantly share code, notes, and snippets.

@mmarshall540
Last active June 1, 2025 20:20
Show Gist options
  • Save mmarshall540/e420f6848e39e45c6981e0f0418f5ea2 to your computer and use it in GitHub Desktop.
Save mmarshall540/e420f6848e39e45c6981e0f0418f5ea2 to your computer and use it in GitHub Desktop.
A clean and minimal mode-line configuration (requires Emacs 30.1)
(setopt mode-line-format
'("%e"
mode-line-front-space
;; removed mode-line-mule-info
mode-line-client
mode-line-modified
mode-line-remote
mode-line-window-dedicated
;; removed `display' property from the above constructs
"\t" ; added
mode-line-frame-identification
mode-line-buffer-identification
" "
mode-line-position
mode-line-format-right-align ; added
(project-mode-line project-mode-line-format)
(vc-mode vc-mode)
" "
mode-line-modes
mode-line-misc-info
" " ; added
mode-line-end-spaces))
(setopt mode-line-modified
'((:eval (if buffer-read-only "R" ""))
(:propertize
(:eval (if (buffer-modified-p) "×" "")) face error)))
(setopt mode-line-modes (remove "(" (remove ")" mode-line-modes)))
(setopt mode-line-position-column-line-format '("%l:%c"))
(setopt mode-line-position-line-format '("L%l"))
(setopt mode-line-remote
'(:eval (if (file-remote-p default-directory) "☎" "")))
(setopt mode-line-right-align-edge 'window)
@mmarshall540
Copy link
Author

mmarshall540 commented Mar 24, 2025

This uses the mode-line-format-right-align mode-line construct and the mode-line-right-align-edge user-option, both of which are new features in Emacs 30.

It also uses a combination of regular spaces and tabs to align the buffer name. I'm using the Lexend Exa font in my mode-line, so you might need to adjust if your font is different, but probably not.

EDIT (screenshots):

Regular:

Screenshot From 2025-06-01 06-48-39v2

And with Prot's spacious-padding and spacious-padding-subtle-mode-line enabled:

Screenshot From 2025-06-01 06-47-11-with spacious-padding subtle-mode-line

@mmarshall540
Copy link
Author

mmarshall540 commented Mar 26, 2025

Updated to using tab character to align buffer-name to ensure it doesn't move, even on Windows, where apparently the spacing was different.

Switched to using a colon to separate line number and column number in column-number-mode. Reason being that the "LATIN LETTER PIPE" that I had there wasn't covered by the fonts on my Windows work laptop. I didn't want to bother with fixing it, even though it looked a little bit nicer. My goal for this is to keep it simple, not perfect.

Also for indicating a remote connection, I switched from the satellite dish emoji character to the simple "BLACK TELEPHONE" character, which is more universal. Same reason as in the last paragraph.

@mmarshall540
Copy link
Author

Updated to improve readability of mode-line-format value and to indicate what changes were made to it in comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment