Skip to main content

Emacs fat fringes and colours

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

Popular posts from this blog

AndroidStudio and a RAM Disk

Ok, my iMac is late 2012 and only has 8GB of RAM. I decided to see if it would be possible to speed up my development cycle, especially for running unit tests and the like but just as much for an improved build time as well. After much fiddling in the dark and reading some great pages, I eventually came up with the following solution that works for me but bear this in mind: Danger Will Robinson RAM is volatile so everything you do is gone forever when you unmount it or shutdown so don't forget to copy your changes elsewhere. If you have Git integrated properly then get into the habit of committing frequently. I have considered writing a small bash script to run `rsync` from a custom menu option  (and thus a shortcut key binding) or look into using the Apple Automator to transfer any changed files across to the hard drive. Whatever... you have been warned! Step one: Create the RAM disk, I do it like this: diskutil erasevolume HFS + "RAMBO" `hdiutil attac

Prime Peace

I think prime numbers are the numerical expression of peace. Restful nodes in the vibration of everything. Prime factorisation has always struck me as something truly astounding and it is reassuring to know that awsesome minds are hard at work trying to solve the Riemann hypothesis right now. There are some truly wonderful professional and amateur (in the nicest sense of the word) explorations I have watched recently and the ones that moved me the most, in order of cool factor were: This guy,Carlos Paris, has put in some serious work with AutoCAD and made some interesting observations. I truly enjoyed watching all of his four videos. Awesome work Carlos. As an interested amateur I found his work and thoughts to be very compelling. I am sure the professionals would groan or moan but to me this video is most excellent and informative. Speaking of the professionals, this video is also very interesting to watch as it goes some way to visually explaining the Riemann hypothesis in

Handling multipart/form-data with NanoHTTPD

I am in the process of reviving an old project from 2014 that I never finished because of other work commitments. In that time, bitrot has set in, the Android API has moved on and all in all, the home-brewed HTTP server I wrote using SocketServer and the org.apache libraries had to go! I looked around, found a couple of contenders and after much time decided to go with NanoHTTPD because it is lean, small and fits in exactly two files. The main server is in one file `NanoHTTPD.java`and there is another file called `ServerRunner.java` which manages instances of running servers. The others The other project I looked at is this one:  https://github.com/koush/AndroidAsync which led me a merry dance and I just couldn't figure out how get the POST data I had uploaded. I spent a few days really digging at it with Wire Shark too to make sure the data was going up. It was. Whatever... I had used it via a gradle dependency entry but I dropped it and went back to NanoHTTPD. For m