Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using.
Doing (almost) all the things with Emacs, part 1
Before I get too far, I should explain two things. First, I'm doing everything here using the default Emacs configuration, not Spacemacs, which I have written about. Why? Because I will be using the default keyboard mappings so that you can refer back to the documentation and not have to translate things from "native Emacs" to Spacemacs. Second, I'm not setting up Org mode in this series. Org mode almost needs an entire series on its own, and, while it is very powerful, the setup can be quite complex.
Configuring Emacs is a little bit more complicated than configuring Vim, but in my opinion, it is worth it in the long run. Start by creating a configuration file and opening it in Emacs:
Next, add some additional package sources to the built-in package manager. Add the following to init.el:
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/"))
Save the file with Ctrl+x Ctrl+s, exit with Ctrl+x Ctrl+c, and restart Emacs. It will download all the package lists at startup, and then you should be ready to install things with the built-in package manager. Start by typing Meta+x to bring up a command prompt (the Meta key is the Alt key on most keyboards or Option on MacOS). At the command prompt, type package-list-packages to bring up a list of packages you can install. Go through the list and select the following packages with the i key:
Once the packages are selected, press x to install them. Depending on your internet connection, this could take a while. You may see some compile errors, but it's safe to ignore them. Once it completes, open ~/.emacs.d/init.el with the key combination Ctrl+x Ctrl+f, and add the following lines to the file after (package-refresh-packages) and before (custom-set-variables. Emacs uses the (custom-set-variables line internally, and you should never, ever modify anything below it. Lines beginning with ;; are comments.
;; Set up bbdb
(add-hook 'message-setup-hook 'bbdb-insinuate-mail)
;; set up calendar
;; Set this to the URL of your calendar. Google users will use
;; the Secret Address in iCalendar Format from the calendar settings
;; Set up notmuch
;; set up mail sending using sendmail
(setq send-mail-function (quote sendmail-send-it))
(setq user-mail-address "firstname.lastname@example.org"
user-full-name "My Name")
Now you are ready to start Emacs with your setup! Save the init.el file (Ctrl+x Ctrl+s), exit Emacs (Ctrl+x Ctrl+c), and then restart it. It will take a little longer to start this time.
Read and write email in Emacs with Notmuch
Once you are at the Emacs splash screen, you can start reading your email with Notmuch. Type Meta+x notmuch, and you'll get Notmuch's Emacs interface.
All the items in bold type are links to email views. You can access them with either a mouse click or by tabbing between them and pressing Return or Enter. You can use the search bar to
search Notmuch's database using the same syntax as you use on Notmuch's command line. If you want, you can save any searches for later use with the [save] button, and they will be added to the list at the top of the screen. If you follow one of the links, you will get a list of the relevant email messages. You can navigate the list with the Arrow keys, and press Enter on the message you want to read. Pressing r will reply to a message, f will forward the message, and q will exit the current screen.
You can write a new message by typing Meta+x compose-mail. Composing, replying, and forwarding all bring up the mail writing interface. When you are done writing your email, press Ctrl+c Ctrl+c to send it. If you decide you don't want to send it, press Ctrl+c Ctrl+k to kill the message compose buffer (window).
Autocomplete email addresses in Emacs with BBDB
abook --convert --outformat vcard --outfile ~/all-my-addresses.vcf --infile ~/.abook/addresses
Once Emacs starts, run Meta+x bbdb-vcard-import-file. It will prompt you for the file name you want to import, which is ~/all-my-addresses.vcf. After the import finishes, when you compose a message, you can start typing a name and use Tab to search and autocomplete the "To" field. BBDB will also open a buffer for the contact so you can make sure it's the correct one.
Why do it this way when you already have each address as a vcf. file from vdirsyncer? If you are like me, you have a LOT of addresses, and doing them one at a time is a lot of work. This way, you can take everything you have in abook and make one big file.
View your calendar in Emacs with calfw
Finally, you can use Emacs to look at your calendar. In the configuration section above, you installed the calfw package and added lines to tell it where to find the calendars to load. Calfw is short for the Calendar Framework for Emacs, and it supports many calendar formats. Since I use Google calendar, that is the link I put into my config. Your calendar will auto-load at startup, and you can view it by switching the cfw-calendar buffer with the Ctrl+x+b command.
Calfw offers views by the day, week, two weeks, and month. You can select the view from the top of the calendar and navigate your calendar with the Arrow keys. Unfortunately, calfw can only view calendars, so you'll still need to use something like khal or a web interface to add, delete, and modify events.
So there you have it: mail, calendars, and addresses in Emacs. Tomorrow I'll do even more.