Gnus: get rid of ~/Mail and ~/News folders

7

4

Gnus (Emacs's mail client) creates directories ~/Mail/ and ~/News. I don't want to clutter my home folder, how can i change this directories to, say, ~/.emacs.d/mail/ and ~/.emacs.d/news/?

Mirzhan Irkegulov

Posted 2012-12-15T09:26:04.003

Reputation: 1 134

Answers

9

First i executed apropos-value ~/Mail/. It threw me many variables, that contain this string in their values. On my Debian i installed package emacs24-el so i could track down these variables in code. I ran describe-variable on the variable nnfolder-directory, which value was ~/Mail/. In went to the code and found out it's initialized like this:

(defvoo nnfolder-directory (expand-file-name message-directory))

The same was with the varible nndraft-directory that contained value ~/News/, which actually came from variable gnus-directory. For some reason the directory ~/Mail/archive/ is still created, i think nnfolder-directory is initialized before i set message-directory in init file.

Resume: to change your mail and news directories, put this into init file:

(setq message-directory "~/.emacs.d/mail/")
(setq gnus-directory "~/.emacs.d/news/")
(setq nnfolder-directory "~/.emacs.d/mail/archive")

Mirzhan Irkegulov

Posted 2012-12-15T09:26:04.003

Reputation: 1 134

What about the drafts directory and the sent directory? – incandescentman – 2015-07-28T19:59:50.637

Thanks for the tip about apropos-value – I had no idea one could do that! – unhammer – 2016-07-01T06:32:39.273

3

I've traced the problem sindikat observed (that for some reason the directory ~/Mail/archive/ is still created). At first I thought there was indeed a bug in gnus initialization code which I've reported here:

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18284

But then I realized that the message-directory setting was being overriden by a previous definition in my newsrc file. So you will have to edit your newsrc and remove the offending definition in order to remove every trace of the default setting.

memeplex

Posted 2012-12-15T09:26:04.003

Reputation: 141

0

While the solution works for most of those variables, I couldn't set the draft directory nndraft-directory since it's overridden when calling gnus (that's the only exception). That's mostly because nndraft is considered a backend and is therefore configured from the nnoo-state-alist list. Sadly, nnoo-state-alist is configured at loading and takes the initial nndraft-directory value.

A quick and dirty fix would be to change the list value:

(setq nndraft-directory "~/.emacs.d/mail/drafts/")
(setcdr (assoc 'nndraft-directory
               (nnoo-variables 'nndraft))
        nndraft-directory)

notetienne

Posted 2012-12-15T09:26:04.003

Reputation: 1