I have been using Emacs on Unix systems since the 1980s. The vast majority of my work is done on PCs, though, and from about 1988 until 2011 I used an editor for the PC called Qedit, later renamed TSE Pro, from The SemWare Corporation. TSE Pro is small, fast, and highly customizable via its own macro language. I customized it to my preferences over many years, in particular for use with , and wrote four books and many papers with it. When I acquired a Mac laptop in 2009 I realized that I needed to switch to an editor that runs on both Windows and Mac, so after trying Vim and Emacs (and temporarily using TextMate on the Mac) I switched to Emacs.
My past use of Emacs had mainly been to send emails or edit web pages, often over a terminal connection, and I had not realized how fast Emacs was—nor that one could issue commands by typing Alt- instead of the two consecutive keys Esc .
Since 2011 I have used Emacs exclusively and have built up my dot emacs to its current size of nearly 3000 lines. For non-Emacs users, a dot emacs (.emacs) file is an Emacs Lisp file that is read and executed when Emacs loads, and it is where one sets customizations and loads packages.
I have now made my dot emacs file available on Github.
A few notes:
- Some of the code uses conditional tests to see whether Emacs is running on a Windows machine or a Mac machine and take different action in each case.
- The code is lightly documented with links to sources for the things I am using.
- I have recently started using John Wiegley’s use-package for loading packages. Not everything is converted and I may convert other package to load this way. Use-package has several advantages:
- It makes the dot emacs more readable.
- It makes it easy to disable a package, by adding a line “:disabled t”.
- It speeds up the loading of Emacs by delaying loading of packages until they are first used. When I first started using use-package my Emacs load time dropped from 8 seconds to 5 seconds.
- I do not use the Emacs package manager, but rather download packages manually and place them in ~/dropbox/elisp. The one exception is the Helm package, which I was unable to install manually.
- I spend most of my time in Emacs in org-mode, latex-mode, or bibtex-mode, so quite a lot of my dot emacs concerns those modes.
- I recently started using Oleh Krehel’s hydra package, which was released at the start of the year. It provides a nice way to set up key bindings based on a prefix key and provides a reminder at the bottom of the screen about possible subsequent keypresses.
You should not expect to be able to take my dot emacs and use it as is, because many of the packages that are loaded will not be present on your system in the expected location. However, the main benefit of sharing Emacs configurations is that one can copy and adapt pieces of code.
My dot emacs is long, and I have trouble remembering all the features I have set up, even though I have an even longer emacs.org file that contains notes and a summary of my customized keypresses.
I still use TSE Pro: to edit my dot emacs file when an error introduced therein causes Emacs to fail to start properly! (Of course, I could also use
emacs -q, which inhibits loading of the
.emacs, but I like to keep my hand in with TSE Pro).
3 thoughts on “My Dot Emacs”
Very informative blog.
Would you mind to share your dropbox/elisp folder to Github to make using the .emacs easier for others.
Glad you like it. There are several reasons why I’d rather not put my elisp directory on GitHub. However, most packages I use are available from the standard repositories and via a Google search and I do document where I got them or how I found out about them within comments in the .emacs file. And you can always email me if you have trouble locating a package.
Nick, I was looking for something that removes the prompt when I want to close a buffer that has a client attached to it came across your .emacs file. I also used the same solution like you.
(remove-hook ‘kill-buffer-query-functions ‘server-kill-buffer-query-function)
But, in that SO thread, someone mentioned a warning from RMS about the client being left alone without proper closing of the connection. So, I was looking for a better solution and found one by Ryan Barrett (https://snarfed.org/dotfiles/.emacs) which is something like following:
(defun server-edit-or-close ()
“Saves and calls `server-edit’, if opened by server, or kills buffer.”
(global-set-key (kbd “C-x k”) ‘server-edit-or-close)