# Do you use Emacs Gnus?



## neilms (Sep 16, 2013)

I decided to try and set up Gnus for email and Usenet. I have attempted to do this before, but gave up. The reason is simply that I use Emacs exclusively for editing on FreeBSD and it would be really convenient if I could also get Gnus set up.

I was just interested to know if anyone here has set Gnus up and if possible see a .gnus.el file that you use. I have the Gnus manual and am going to read through and follow the steps set out, but it would be a great help to me if I could see a functional configuration file with unique customization.

If you do use Gnus, how difficult did you find it to set up and master it? 

Thanks.


----------



## jrm@ (Sep 17, 2013)

I use Gnus for email and Gnus with Gmane/Gwene for mailing lists and RSS feeds.  Like Emacs itself (or FreeBSD) I found the learning curve steep, but once I became more comfortable, the power and customizability were very satisfying.

Here is my ~/.emacs.d/gnus.el:

```
(setq canlock-password "***")
(setq bbdb-electric-p t)
;; store mail messages in the same group started out in
(setq gnus-message-archive-group
      '((lambda (x)
	  (cond
	   ((message-news-p) nil) ;; don't store messages sent to lists
	   ;; if in a group with a level less than 4, store message there
	   ((and (boundp 'group) (< (gnus-group-level group) 4)) group)
	   ;; Store everything else in mail.misc
	   (t "mail.misc")))))
;;(setq gnus-permanently-visible-groups "mail\\.misc")
(setq gnus-activate-level 4)
(setq gnus-agent nil)
;;(setq gnus-asynchronous nil)
(setq gnus-article-date-headers (quote (local)))
(setq gnus-article-prepare-hook (quote (bbdb/gnus-pop-up-bbdb-buffer)))
(setq gnus-article-sort-functions (quote (gnus-article-sort-by-number)))
(setq gnus-exit-gnus-hook (quote (mm-destroy-postponed-undisplay-list)))
(setq gnus-group-catchup-group-hook (quote (gnus-topic-update-topic)))
(setq gnus-group-mode-hook (quote (gnus-topic-mode hl-line-mode)))
(setq gnus-group-sort-function (quote (gnus-group-sort-by-alphabet gnus-group-sort-by-level)))
(setq gnus-ignored-from-addresses (quote ("blah@blah\\.blah" "blah@blah\\.blah\\.blah")))
(setq gnus-message-archive-method '(nnml ""))
(setq gnus-read-newsrc-file nil)
(setq gnus-save-newsrc-file nil)
(setq gnus-save-newsrc-hook (quote (bbdb-offer-save)))
(setq gnus-secondary-select-methods '((nntp "news.gmane.org")))
(setq gnus-select-method '(nnml ""))
(setq gnus-server-mode-hook nil)
;;(setq gnus-sort-gathered-threads-function (quote gnus-thread-sort-by-date) t)
(setq gnus-startup-hook (quote (bbdb-insinuate-gnus)))
(setq gnus-sum-thread-tree-false-root "âš‡")
(setq gnus-sum-thread-tree-indent "   ")
(setq gnus-sum-thread-tree-leaf-with-other "â”œâ€•â€•â–º")
(setq gnus-sum-thread-tree-root "â—")
(setq gnus-sum-thread-tree-single-indent "â—‹")
(setq gnus-sum-thread-tree-single-leaf "â””â€•â€•â–º")
(setq gnus-sum-thread-tree-vertical "â”‚  ")
(setq gnus-summary-line-format "%U%R %5N %6k %24&user-date; â”‚ %~(max-right 75)~(pad-right 75)S â”‚ %B %f
")
(setq gnus-summary-mode-hook 'hl-line-mode)
(setq gnus-summary-thread-gathering-function (quote gnus-gather-threads-by-references))
(setq gnus-thread-sort-functions (quote ((not gnus-thread-sort-by-most-recent-number))))

(setq gnus-user-date-format-alist (quote (
					  ((gnus-seconds-today) . "Today at %H:%M")
					  ((+ 86400 (gnus-seconds-today)) . "Yesterday at %H:%M")
					  ((gnus-seconds-year) . "%a %b %d at %H:%M")
					  (t . "%a %b %d %Y at %H:%M"))))
(setq message-send-mail-function 'smtpmail-send-it
      smtpmail-starttls-credentials '(("smtp.blah.blah" 587 nil nil))
      smtpmail-auth-credentials '(("smtp.blah.com" 587 "me" nil))
      smtpmail-default-smtp-server "smtp.blah.com"
      smtpmail-smtp-server "smtp.blah.com"
      smtpmail-smtp-service 587
      smtpmail-local-domain "blah.blah")
(setq mail-sources
      '((maildir :path "/home/jrm/mail/")))
(setq mm-discouraged-alternatives '("text/html" "text/richtext"))
(setq nnmail-split-methods
      '(("Admin"     "^From:.*root@\\(host\\.domain\\.blah\\.blah\\)")
	("AList"       "^List-Id: Some list")
	("$"         "^From:.*interac\\.ca")
	("$"         "^From:.*rbc\\.com")
	("$"         "^From:.*bell\\.ca")
	("$"         "^From:.*eastlink\\.ca")
	("$"         "^From:.*kijiji\\.ca")
	("$"         "^From:.*ebay.\\(ca\\|com\\)")
	("$"         "^From:.*ups\\.com")
	("mail.misc" "")
	))
(setq user-work-mail-address "blah@blah.blah")

(defun toggle-from()
  "Toggle addresses in the From: field of the message buffer."
  (interactive)
  (save-excursion
    (message-goto-from)
    (if (string-match (concat "^From:\s-*.*" user-work-mail-address) (thing-at-point 'line))
	(progn 
	  (beginning-of-line)
	  (message-delete-line)
	  (insert (concat "From: " user-full-name " <" user-mail-address ">\n")))
      (message-goto-from)
      (when (string-match (concat "^from:\s-*.*" user-mail-address) (thing-at-point 'line))
	(beginning-of-line)
	(message-delete-line)
	(insert (concat "From: " user-full-name " <" user-work-mail-address ">\n"))))))

(defun gnus-summary-open-links (arg)
  "Open links in a browser for RSS feeds."
  (interactive "P")
  (let ((articles (gnus-summary-work-articles arg)))
    (save-excursion
      (while articles
	(setq article (pop articles))
	(gnus-summary-goto-article article)
	(gnus-summary-show-article t)
	(save-excursion
	  (pop-to-buffer gnus-article-buffer)
	  (re-search-forward "<a href=\"\\([^\"]+\\)\">Link</a>")
	  (browse-url (match-string 1)))
	(gnus-summary-remove-process-mark article))))
  (gnus-summary-position-point))

(fset 'jrm-gnus-open-rss-article-link
   (lambda (&optional arg) 
     "Keyboard macro, to be called from the summary buffer, to open RSS articles in a browser."
     (interactive "p") 
     (kmacro-exec-ring-item 
      (quote ([104 134217790 S-iso-lefttab return 104] 0 "%d")) arg)))
(add-hook 'gnus-summary-mode-hook
	  (lambda ()
	  (local-set-key (kbd "C-c l") 'jrm-gnus-open-rss-article-link)))
```

Here are the relevant customizations in custom-set-variables in my ~/.emacs.d/init.el:

```
'(bbdb-complete-name-allow-cycling t)
 '(bbdb-use-pop-up nil)
 '(bbdb/mail-auto-create-p (quote prompt))
 '(bbdb/news-auto-create-p nil)
 '(gnus-init-file "~/.emacs.d/gnus.el")
 '(gnus-startup-file "~/.emacs.d/newsrc")
 '(gnus-thread-sort-functions (quote ((not gnus-thread-sort-by-most-recent-number))))
 '(mail-user-agent (quote gnus-user-agent))
 '(mm-attachment-override-types (quote ("text/x-vcard" "application/pkcs7-mime" "application/x-pkcs7-mime" "application/pkcs7-signature" "application/x-pkcs7-signature" "image/.*")))
 '(user-mail-address "me@blah.blah")
```


----------



## jb_fvwm2 (Sep 17, 2013)

I would if I had the time, at one time having started to use Emacs for Usenet IIRC. However, I sort of not purposely discovered that mutt could read Usenet that I had a little trouble reading in slrn, and that became much more readable with the (web somewhere) mutt-colors-solarized setup. Very readable.  However, since that worked super, spam has overtaken most of them, so I read just the freebsd current  newsgroups and a few others.


----------



## neilms (Sep 17, 2013)

jb_fvwm2 said:
			
		

> I would if I had the time, at one time having started to use Emacs for Usenet IIRC. However, I sort of not purposely discovered that mutt could read Usenet that I had a little trouble reading in slrn, and that became much more readable with the (web somewhere) mutt-colors-solarized setup. Very readable.  However, since that worked super, spam has overtaken most of them, so I read just the freebsd current  newsgroups and a few others.



Thanks for replying. There are still a lot of really good Usenet groups out there, particularly the moderated ones. I am learning C++ and have found a few groups that are excellent learning resources with no spam. The people that post replies & and  help are often experts - folk who have written definitive books on the subject. There is no other medium where I could get that level of help. Learning that way even trumps a university course IMHO.


----------



## Cthulhux (Oct 4, 2013)

neilms said:
			
		

> If you do use Gnus, how difficult did you find it to set up and master it?



I found Gnus not hard to set up. The interesting part is the customization. My Gnus looks like this:







Config goes here.


----------



## jrm@ (Oct 5, 2013)

Cthulhux said:
			
		

> My Gnus looks like this:...



Nice.  Here's one reading the current mailing list through Gwene.  I like Gwene because I don't have to store local copies of mailing list messages, i.e, I just subscribe without delivery and access/reply through Gwene.




Here's one of the summary buffer showing RSS (Gmane), mailing list (Gwene), and mail groups (local nnml).  Note the group nntp+news.gmane.org:gwene.org.freebsd.forums.


----------



## Cthulhux (Oct 5, 2013)

^ I like the separation by categories here. How do you achieve that?


----------



## jrm@ (Oct 5, 2013)

I think you are referring to topics.  Use `T n` to create a new topic and `T m` to move a group to a topic.


----------



## Cthulhux (Oct 5, 2013)

That's neat. See, that's what I meant  with customization. It will never be perfect. 

Thanks!


----------

