*Windows Users*: I *highly* recommend creating an environment variable called HOME and then point that to a directory that will act as a “faux” home directory.
The tilde is obviously your home directory on Linux/Mac, but on Windows it will default to somewhere in your User’s My Documents directory. As MS-DOS cannot have filenames beginning with a dot, an underscore is used instead (i.e., _emacs). When Emacs is starting it will look for the init file in ~/.emacs, ~/.emacs.el or ~/.emacs.d/init.el. This file is different from your custom file as that is where your Customization settings are stored - but more on Customize later. emacs file is the place where all your emacs customizations are typically kept. The beauty of Emacs is that you can often have your cake and eat it (though you may have to write some emacs-lisp in order to do both.) Your.
Fact is though, if you’re starting out in Emacs you probably come from other environments (like Windows or Mac OS) where things are done this way and not that way. Some of the “best practices” here are contentious subjects and I’m sure I’ll get a flurry of e-mails and comments supporting or opposing them. Best Practices / Quality of Life improvements
To get a complete list of all modes running and all the keybindings they introduce, type C-h m. You tend to have lots of minor modes running in a buffer without necessarily noticing it. Minor modes are similar to major modes in that, when enabled in a buffer, provide a variety of changes and customizations. There are some packages out there that provide support for this like nXhtml, an excellent package for most web-focused languages. That Emacs can only have one major mode is actually a serious obstacle in “multi-language” modes like a lot of web-based languages as they tend to mix very different languages in one file (HTML, CSS and Javascript for instance). In Emacs a buffer can only have one major mode, but any number of minor modes. Modes are always buffer-specific, and they come in two flavors: major modes and minor modes. Modes are Emacs’ way of switching between key bindings, functionality, syntax highlighting and pretty much any other mutable item in Emacs. Don’t confuse it with the mouse cursor though. The point is the caret, or cursor, in other editors and in most operating systems. You can have multiple windows in a frame, but only one buffer in a window.Ī buffer is said to be active when the point is in it that is, if you were to type, your text would be input into that buffer. And windows, in turn, are contained in a frame. In Emacs a window is what people in other environments would call a frame – and vice versa.Ī window is something a buffer is contained in. This is where Emacs terminology differs from the established standard. If you need to do some quick string manipulation it’s very common to simply create a throwaway buffer (usually named “12312eqwdowqjd” or something to that effect), do your thing and then kill it. In Emacs it is common to create and dispose of buffers as needed. It can also be a transient thing (like the help file or the output from your compiler).
It’s where your source code is displayed and it’s where most of your time is spent.Ī buffer need not point to a file it can exist in the aether and never see the light of day on your filesystem. In Emacs, a buffer is the area in which you write things. That age is reflected in the sometimes arcane and baroque ways it handles things. Important ConceptsĮmacs is very, very complicated – but it is also very, very old.
Once you’re done with this tutorial then I highly recommend you read my book Mastering Emacs – it’s 280 pages long and it will take you from knowing nothing (or almost nothing) about Emacs to fluently mastering not only how to navigate and edit, but also how to make use of Emacs’s extensive, self-documenting help system. This guide will help you move past the tutorial and should hopefully explain away some of the more typical questions that people have about Emacs. With that in mind, I have found there’s a gap between what the Tutorial sets out to do (basic movement and editing) and what people need to actually get started. That’s a shame, because although Emacs is complicated it does come with an excellent and exhaustive manual. No wonder so many people find it difficult to get their footing and opt for simpler editors. Emacs is a complex beast with thousands of commands and even more settings that can be customized.