Having gotten used to various editors implementations of distraction free or presentation mode views, I figured that emacs could probably do something similar with little effort.
As usual, it could.
For me, distraction free means no clutter, no menu bars, tool bars, gutters, line numbers, just the code. The first step is to be able to set the size of the left and right margins to something large, 100px works quite well. I use Aquamacs a lot. This does not work in the terminal! So, here is the little bit of code you need to place into your beloved ~/.emacs file:
Then, using the Ctrl-U prefix, you would set the left and right margins to be whatever you want, let’s say we wanted to have 500px left and right, which works well for meo n my 1920×1080 display, the keystrokes:
will make the fringes become very wide and take on the current theme background colour. If you change themes a lot like I do, then just re-issue the sequence if the fringes end up a different colour. Sometimes it actually looks nicer!
Some other command that are useful in cutting down the visual clutter:
You could of course combine all of the above into a single killer command, make it interactive and also use the Ctrl-U prefix to turn it on or off. For example, if the prefix was set to a non-negative integer for example that could mean to enable the mode and any other value would disable it.
If I get some time I’ll write that command and stick it here.
As usual, it could.
For me, distraction free means no clutter, no menu bars, tool bars, gutters, line numbers, just the code. The first step is to be able to set the size of the left and right margins to something large, 100px works quite well. I use Aquamacs a lot. This does not work in the terminal! So, here is the little bit of code you need to place into your beloved ~/.emacs file:
(defun fringe-bars (width) (interactive "pWidth:") (fringe-mode (cons width width)) (set-face-attribute 'fringe nil :foreground (face-foreground 'default) :background (face-background 'default)))
Then, using the Ctrl-U prefix, you would set the left and right margins to be whatever you want, let’s say we wanted to have 500px left and right, which works well for meo n my 1920×1080 display, the keystrokes:
will make the fringes become very wide and take on the current theme background colour. If you change themes a lot like I do, then just re-issue the sequence if the fringes end up a different colour. Sometimes it actually looks nicer!
Some other command that are useful in cutting down the visual clutter:
You could of course combine all of the above into a single killer command, make it interactive and also use the Ctrl-U prefix to turn it on or off. For example, if the prefix was set to a non-negative integer for example that could mean to enable the mode and any other value would disable it.
If I get some time I’ll write that command and stick it here.
Comments
Post a Comment