Making Emacs Elegant
Emacs, out of the box, looks its age. But, of course, as all things in Emacsland, it can be prettified to a great extent.
Just how far that is is best exemplified by Nicholas Rougier's elegant-emacs and NANO projects. If you haven't seen them, go take a look at that eye candy.
If you have seen some of my stuff, you may now realized where I get my modeline (or lack if it) from. It is easily the single most impactful change in my own .emacs as far as visuals go.
The point of emacs is to get the bits and bobs that you want and merge it into the evergrowing coral reef like organism that is your .emacs. In this post, I point out the good stuff from the Elegant Emacs project and some more things from my own explorations. Note that I have no clear demarcation in this post on what are bits from Elegant and what are my own additions/removals. The idea is to give you a starting point, if you want your own Elegant Emacs like visuals.
1. Getting rid of clutter
This is a well known move: disable all the bars!
(menu-bar-mode 0) (tool-bar-mode 0) (scroll-bar-mode 0)
Now, the menu bar is useful in some contexts. No worries - use Ctrl+<Right Click>
to bring up the menus that are normally shown on the bar.
One more move:
(fringe-mode '(0 . 0))
disables the fringes on both sides. Now, again, this can be a bad move for some modes - which use this space to show indicators. As far as I can see, it can only be set at frame level (this command sets for all frames) and not buffer level. But, should be solvable with a bit of elisp - you can enable the fringe back in some major-modes.
2. Useless gaps
Adding some empty space around your frame will clean up the look way more than you think. Just try it. It is a waste of space, yes, but the neatness you get back is totally worth it. I do this now with my terminal too.
(add-to-list 'default-frame-alist '(internal-border-width . 40))
3. Modeline
The modeline is the biggest contribution of Elegant Emacs.
(setq-default mode-line-format '(" ")) (set-face-attribute 'mode-line nil :height 10 :background "black")
What are we doing here?
- Set the mode-line to be built from a list with a single empty string. So, basically no modeline.
- Set the height of the modeline to 10 pixels and color it with black. This should give you a nice notebook margin like feel.
But, the modeline had information I wanted! Great plan. Now, what?
(setq-default header-line-format '("%e" mode-line-front-space mode-line-mule-info mode-line-client mode-line-modified mode-line-remote mode-line-frame-identification mode-line-buffer-identification " " mode-line-position evil-mode-line-tag (vc-mode vc-mode) " " mode-line-modes mode-line-misc-info mode-line-end-spaces))
This is my literal modeline format, now copied into the header-line - a line right up top, normally unused. As you might have surmised, I saved the existing format, before nuking the mode-line. Simply look up the value of a variable using C-h v
.
People do a lot of tinkering with the mode-line (now header-line) format - including a bunch of stuff in elegant and NANO. Take a look at it and see if there is anything that makes sense for you. This is also the place to do fancy things like icons, powerline type demarcations etc.
You have a header-line in place of the mode-line, but how to style it?
(set-face-attribute 'header-line nil :height 220 :box nil :overline nil :underline nil :background "#F4F4E8")
Open up the manual for set-face-attribute
to get all params that are applicable. Here, I have shown the common ones:
- :background
- bg color to use
- :box
- draw a box around the line using specified color. Instead of nil, you can use "black" to see how it looks.
- :overline
- A single line drawn on top of the line.
- :underline
- Obvious by this point
You have other options like :strike-through
which are totally useless in this context. But, there are things like, :weight
(for bold to light) and :slant
which can work out really well. So, for example:
(set-face-attribute 'header-line nil :height 220 :slant 'italic :background "white")
can give you a nice thick box with italic text on a white background.
4. Other stuff
Add fancy icons to dired. I keep it in monochrome - since that fits with the minimal theme that I am going for.
(use-package all-the-icons-dired :ensure t :hook (dired-mode . all-the-icons-dired-mode) :config (setq all-the-icons-dired-monochrome nil))