Science and technology

Send electronic mail and verify your calendar with Emacs

Last 12 months, I introduced you 19 days of recent (to you) productiveness instruments for 2019. This 12 months, I am taking a special method: constructing an surroundings that can mean you can be extra productive within the new 12 months, utilizing instruments you might or could not already be utilizing.

Doing (nearly) all of the issues with Emacs, half 1

Two days in the past, I shared that I take advantage of each Vim and Emacs repeatedly, and on days 16 and 17 of this collection, I defined easy methods to do nearly every little thing in Vim. Now, it is time for Emacs!

Before I get too far, I ought to clarify two issues. First, I am doing every little thing right here utilizing the default Emacs configuration, not Spacemacs, which I’ve written about. Why? Because I will likely be utilizing the default keyboard mappings so as to refer again to the documentation and never need to translate issues from “native Emacs” to Spacemacs. Second, I am not establishing Org mode on this collection. Org mode nearly wants a whole collection by itself, and, whereas it is extremely highly effective, the setup could be fairly advanced.

Configure Emacs

Configuring Emacs is a bit of bit extra sophisticated than configuring Vim, however in my view, it’s price it in the long term. Start by making a configuration file and opening it in Emacs:

mkdir ~/.emacs.d
emacs ~/.emacs.d/init.el

Next, add some further bundle sources to the built-in bundle supervisor. Add the next to init.el:

(package-initialize)
(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/"))
(package-refresh-contents)

Save the file with Ctrl+x Ctrl+s, exit with Ctrl+x Ctrl+c, and restart Emacs. It will obtain all of the bundle lists at startup, after which you have to be prepared to put in issues with the built-in bundle supervisor. Start by typing Meta+x to carry up a command immediate (the Meta key’s the Alt key on most keyboards or Option on MacOS). At the command immediate, sort package-list-packages to carry up an inventory of packages you’ll be able to set up. Go by the listing and choose the next packages with the i key:

bbdb
bbdb-vcard
calfw
calfw-ical
notmuch

Once the packages are chosen, press x to put in them. Depending in your web connection, this might take some time. You might even see some compile errors, but it surely’s secure to disregard them. Once it completes, open ~/.emacs.d/init.el with the important thing mixture Ctrl+x Ctrl+f, and add the next strains to the file after (package-refresh-packages) and earlier than (custom-set-variables. Emacs makes use of the (custom-set-variables line internally, and you must by no means, ever modify something beneath it. Lines starting with ;; are feedback.

;; Set up bbdb
(require 'bbdb)
(bbdb-initialize 'message)
(bbdb-insinuate-message)
(add-hook 'message-setup-hook 'bbdb-insinuate-mail)
;; arrange calendar
(require 'calfw)
(require 'calfw-ical)
;; Set this to the URL of your calendar. Google customers will use
;; the Secret Address in iCalendar Format from the calendar settings
(cfw:open-ical-calendar "https://path/to/my/ics/file.ics")
;; Set up notmuch
(require 'notmuch)
;; arrange mail sending utilizing sendmail
(setq send-mail-function (quote sendmail-send-it))
(setq user-mail-address "[email protected]"
      user-full-name "My Name")

Now you might be prepared to start out Emacs along with your setup! Save the init.el file (Ctrl+x Ctrl+s), exit Emacs (Ctrl+x Ctrl+c), after which restart it. It will take a bit of longer to start out this time.

Read and write electronic mail in Emacs with Notmuch

Once you might be on the Emacs splash display, you can begin studying your electronic mail with Notmuch. Type Meta+x notmuch, and you will get Notmuch’s Emacs interface.

All the gadgets in daring sort are hyperlinks to electronic mail views. You can entry them with both a mouse click on or by tabbing between them and urgent Return or Enter. You can use the search bar to

search Notmuch’s database utilizing the same syntax as you utilize on Notmuch’s command line. If you need, it can save you any searches for later use with the [save] button, and they are going to be added to the listing on the high of the display. If you comply with one of many hyperlinks, you’ll get an inventory of the related electronic mail messages. You can navigate the listing with the Arrow keys, and press Enter on the message you wish to learn. Pressing r will reply to a message, f will ahead the message, and q will exit the present display.

You can write a brand new message by typing Meta+x compose-mail. Composing, replying, and forwarding all carry up the mail writing interface. When you might be achieved writing your electronic mail, press Ctrl+c Ctrl+c to ship it. If you resolve you do not wish to ship it, press Ctrl+c Ctrl+okay to kill the message compose buffer (window).

Autocomplete electronic mail addresses in Emacs with BBDB

But what about your deal with guide? That’s the place BBDB is available in. But first, import all of your addresses from abook by opening a command line and operating the next export command:

abook --convert --outformat vcard --outfile ~/all-my-addresses.vcf --infile ~/.abook/addresses

Once Emacs begins, run Meta+x bbdb-vcard-import-file. It will immediate you for the file title you wish to import, which is ~/all-my-addresses.vcf. After the import finishes, if you compose a message, you can begin typing a reputation and use Tab to look and autocomplete the “To” subject. BBDB can even open a buffer for the contact so you may make positive it is the proper one.

Why do it this fashion when you have already got every deal with as a vcf. file from vdirsyncer? If you might be like me, you’ve a LOT of addresses, and doing them separately is lots of work. This approach, you’ll be able to take every little thing you’ve in abook and make one huge file.

View your calendar in Emacs with calfw

Finally, you need to use Emacs to have a look at your calendar. In the configuration part above, you put in the calfw bundle and added strains to inform it the place to search out the calendars to load. Calfw is brief for the Calendar Framework for Emacs, and it helps many calendar codecs. Since I take advantage of Google calendar, that’s the hyperlink I put into my config. Your calendar will auto-load at startup, and you may view it by switching the cfw-calendar buffer with the Ctrl+x+b command.

Calfw gives views by the day, week, two weeks, and month. You can choose the view from the highest of the calendar and navigate your calendar with the Arrow keys. Unfortunately, calfw can solely view calendars, so you will nonetheless want to make use of one thing like khal or an internet interface so as to add, delete, and modify occasions.

So there you’ve it: mail, calendars, and addresses in Emacs. Tomorrow I am going to do much more.

Most Popular

To Top