This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+email/gnus
syl20bnr ebe4c60264 Revert "Defer packages by default using use-package-always-defer"
This reverts commit 29c78ce841 and all other fixes
that have been made afterwards.

The motivation is that use-package is seen by many as a replacement for
`require`. Is use-package always defer the loading of packages then is breaks
this use case, this does not respect POLA so even if it was making Spacemacs
loading faster (up to 3s faster on some startup on my machine) we just cannot
use it, it would be irresponsible. Spacemacs should be easy to use, loading
performance will come with time but it is not a priority.
2018-03-03 23:40:10 -05:00
..
img Use + instead of ! for layer categories 2015-09-11 00:13:51 -04:00
packages.el Revert "Defer packages by default using use-package-always-defer" 2018-03-03 23:40:10 -05:00
README.org Fix doc for common-lisp, bibtex, cfengine and gnus layer 2018-01-12 00:37:15 -05:00

Gnus layer

/TakeV/spacemacs/media/commit/5a92c439510b54e631b90dd4ca4b3f05d2082225/layers/+email/gnus/img/gnus.gif

Description

This layer integrates a general purpose email/newsgroup client into Spacemacs.

Features:

  • Support for reading RSS feeds, newsgroups and mails directly within emacs via Gnus.
  • Support for beautiful HTML mails generated from any org buffer.
  • Support for credential managment via GnuPG.

Install

To use this configuration layer, add it to your ~/.spacemacs. You will need to add gnus to the existing dotspacemacs-configuration-layers list in this file.

Basic Concepts

Gnus is a news reading application. The Gnus terminology can be confusing for new users so the basics are listed here:

Group
A Newsgroup but can also be a RSS Feed or a mail directory
Topic
Newsgroups can be assigned to topics which will be used to structure the Group Buffer if Topic Mode is enabled(default).

Adding news sources

Adding news sources can be done in your .spacemacs file by adding the following:

  ;; Get email, and store in nnml
  (setq gnus-secondary-select-methods
    '(
      (nntp "gmane"
             (nntp-address "news.gmane.org"))
      (nntp "news.eternal-september.org")
      (nntp "nntp.aioe.org")
      (nntp "news.gwene.org")
      ))

For adding RSS Feeds please see the keybindings section.

Configuring gmail

To configure Gnus with gmail support you can add the following to your .spacemacs file.

;; Get email, and store in nnml
(setq gnus-secondary-select-methods
'(
  (nnimap "gmail"
           (nnimap-address
            "imap.gmail.com")
           (nnimap-server-port 993)
           (nnimap-stream ssl))
  ))

;; Send email via Gmail:
(setq message-send-mail-function 'smtpmail-send-it
  smtpmail-default-smtp-server "smtp.gmail.com")

;; Archive outgoing email in Sent folder on imap.gmail.com:
(setq gnus-message-archive-method '(nnimap "imap.gmail.com")
    gnus-message-archive-group "[Gmail]/Sent Mail")

;; Set return email address based on incoming email address
(setq gnus-posting-styles
    '(((header "to" "address@outlook.com")
       (address "address@outlook.com"))
  ((header "to" "address@gmail.com")
     (address "address@gmail.com"))))

;; Store email in ~/gmail directory
(setq nnml-directory "~/gmail")
(setq message-directory "~/gmail")

Authentication for your gmail account is best stored in an authinfo or authinfo.pgp file. It must be of the form:

machine smtp.gmail.com login name@gmail.com password SUPER_SECRET_PASS
machine imap.gmail.com login name@gmail.com port 993 password SUPER_SECRET_PASS

If you use two-step verification the password has to be an application specific password.

Org MIME in Org layer

It is possible to send beautiful HTML emails using org mode.

Pressing SPC m e m in a message buffer will convert the current message from org mode to html. An org mode buffer can be sent via html email by pressing SPC m e m in any org mode buffer.

Keybindings

Gnus has very modal default keybindings. Please see the manual for a complete list.

Basic and Spacemacs specific keybindings can be found in the following table.

Key Binding Gnus mode - Description
SPC a g Starts Gnus
m New Message
G R Group Buffer - Add RSS feed
^ Open Server Buffer. Browse Newsgroups.
T n Group Buffer - new Topic
T m Group Buffer - Move Group to Topic
K Article Buffer - Previous article
J Article Buffer - Next article
RET Summary Buffer(RSS) - Open article Link in browser
TAB Summary Buffer(RSS) - Open article and switch to it