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 . This one is rather huge (302 MB or so). If it’s prohibitive, you can visit the 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 -
~/.emacs
,~/.emacs.el
,~/.emacs.d/init.el
. set-foreground-color
andset-background-color
to change foreground and background.-
The
visible-bell
variable 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 thedescribe-variable
function.-
global-auto-revert-mode
which will watch visited files for changes and reload if necessary. -
require-final-newline
adds a newline to the end of a file automatically if it doesn’t have one when saving. -
debug-on-error
anddebug-on-quit
when the debugger should get invoked. -
inhibit-startup-message
will control whether the welcome message should be displayed on startup.
-
-
Some functions that are commonly seen in
.emacs
files aretool-bar-mode
,blink-cursor-mode
andshow-paren-mode
. - Some functions which are defined in files that are not parts of Emacs need to be
require
d before they can be used. An example isbar-cursor
which, on Debian, comes in theemacs-goodies
package. It providesbar-cursor-mode
. - For files which you’ve downloaded yourself and not in the default load path, you can use
add-to-list
and add the directory to theload-path
before requiring. We do this with arect-mark
file that we have. - To associate file name patterns with major modes, you can add a tuple to
auto-mode-alist
usingadd-to-list
. We do this formarkdown-mode
. - We add global keybindings using
global-set-key
. We make bindings forM-up
andM-down
. We then create a custom command and bind it tof7
. - We also add mode specific keybindings using
define-key
. - We add hooks to a major mode to trigger some actions when that mode is activated. We turn on
flyspell-mode
when we entermarkdown-mode
to demonstrate this. - We talk about the customisation system using
M-x customize
.
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.