This is the second part of the customisation episode.
This episode covers a little more elisp focusing on common things that people tweak in their init files.
It’s a little longer than usual. I was feeling tired so I didn’t time myself like I usually do. Also, due to some screw up with my mic jack, there’s a crackling sound throughout the recording. It’s not that bad but it would be nice have gotten it without that. You can also hear me coughing once or twice. My apologies.
The H.264 version of the video for iOS devices is at https://archive.org/download/EmacsMovies/08.2-episode-customisation-2.mkv. This one is rather huge (302 MB or so). If it’s prohibitive, you can visit the archive details page which has links to an mp4 and an ogg version that are much smaller.
Here’s a summary of what is covered along with a few extras.
- Locations of the init files -
set-background-colorto change foreground and background.
visible-bellvariable to control the method in which alarms are displayed. Following are a few extras. You can get information on these and any other variables using the the
global-auto-revert-modewhich will watch visited files for changes and reload if necessary.
require-final-newlineadds a newline to the end of a file automatically if it doesn’t have one when saving.
debug-on-quitwhen the debugger should get invoked.
inhibit-startup-messagewill control whether the welcome message should be displayed on startup.
Some functions that are commonly seen in
- Some functions which are defined in files that are not parts of Emacs need to be
required before they can be used. An example is
bar-cursorwhich, on Debian, comes in the
emacs-goodiespackage. It provides
- For files which you’ve downloaded yourself and not in the default load path, you can use
add-to-listand add the directory to the
load-pathbefore requiring. We do this with a
rect-markfile that we have.
- To associate file name patterns with major modes, you can add a tuple to
add-to-list. We do this for
- We add global keybindings using
global-set-key. We make bindings for
M-down. We then create a custom command and bind it to
- We also add mode specific keybindings using
- We add hooks to a major mode to trigger some actions when that mode is activated. We turn on
flyspell-modewhen we enter
markdown-modeto demonstrate this.
- We talk about the customisation system using
One extra thing that I’d like to mention is the
set-face-attribute function which allows you to modify aspects of a “face”. A face is a font along with some other settings like colour, weight, size etc. that you can save and reuse. So, for example, there will be a
comment-face used to syntax highlight all comments in the buffer. The following command will set the
height attribute of the default face to
135. This is a setting that essentially controls text size.
(set-face-attribute 'default nil :height 135)
That’s essentially it. Feedback welcome.