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-colorandset-background-colorto change foreground and background.-
The
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 thedescribe-variablefunction.-
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-erroranddebug-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
.emacsfiles aretool-bar-mode,blink-cursor-modeandshow-paren-mode. - Some functions which are defined in files that are not parts of Emacs need to be
required before they can be used. An example isbar-cursorwhich, on Debian, comes in theemacs-goodiespackage. It providesbar-cursor-mode. - For files which you’ve downloaded yourself and not in the default load path, you can use
add-to-listand add the directory to theload-pathbefore requiring. We do this with arect-markfile that we have. - To associate file name patterns with major modes, you can add a tuple to
auto-mode-alistusingadd-to-list. We do this formarkdown-mode. - We add global keybindings using
global-set-key. We make bindings forM-upandM-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-modewhen we entermarkdown-modeto 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.