Discussion:
Using gnus with gmail: almost there
c***@gmail.com
2014-07-29 04:00:59 UTC
Permalink
Hi all, it's my first day with gnus and I'm pretty happy with the level
of integration I was able to achieve with gmail imap. Nevertheless,
there are a few quirks remaining and any help from the experienced users
here would be very much appreciated. Let's see:

1) I would like to include my sent emails in the threads where they
belong, like in the "conversation" view gmail offers. There is a
suggestion somewhere in the net to create a virtual group merging the
inbox and the sent mail groups, but this will only work for threads in
the inbox. Another option is to add a copy of any sent mail to the
current group, i.e. something like:

(setq gnus-message-archive-group
(lambda (g) (concat "nnimap+gmail:" g)))

But this has some problems:
1.i) I don't know how to do this *only* for the gmail server.
1.ii) Obviously it doesn't work for emails sent from the webmail.

Nevertheless, being able to solve 1.i alone would be very good news for
me.

2) I would like to postpone a message directly to a remote group
(ideally, the gmail drafts folder). Currently I'm able to locally
postpone a message and then move it to the remote group. A way to
automate this is what I can't come with (or, better, to directly store
the draft in the remote group, which I'm afraid is not possible).

Well, I think that's all for the time being. Thank you in advance.

Cheers
--
Carlos
Carlos
2014-07-29 13:09:48 UTC
Permalink
Hi all, it's my first day with gnus and I'm pretty happy with the level of
integration I was able to achieve with gmail imap. Nevertheless, there are a
few quirks remaining and any help from the experienced users here would be
very much appreciated. Let's see:

1) I would like to include my sent emails in the threads where they belong,
like in the "conversation" view gmail offers. There is a suggestion somewhere
in the net to create a virtual group merging the inbox and the sent mail
groups, but this will only work for threads in the inbox. Another option is to
add a copy of any sent mail to the current group, i.e. something like:

(setq gnus-message-archive-group (lambda (g) (concat "nnimap+gmail:" g)))

But this has some problems: 1.i) I don't know how to do this *only* for the
gmail server. 1.ii) Obviously it doesn't work for emails sent from the
webmail.

Nevertheless, being able to solve 1.i alone would be very good news for me.

2) I would like to postpone a message directly to a remote group (ideally, the
gmail drafts folder). Currently I'm able to locally postpone a message and
then move it to the remote group. A way to automate this is what I can't come
with (or, better, to directly store the draft in the remote group, which I'm
afraid is not possible).

Well, I think that's all for the time being. Thank you in advance.

Cheers
--
Carlos
Tassilo Horn
2014-07-31 05:56:32 UTC
Permalink
Carlos <***@gmail.com> writes:

Hi Carlos,
Post by c***@gmail.com
1) I would like to include my sent emails in the threads where they
belong, like in the "conversation" view gmail offers.
I do the same.
Post by c***@gmail.com
There is a suggestion somewhere in the net to create a virtual group
merging the inbox and the sent mail groups, but this will only work
for threads in the inbox. Another option is to add a copy of any sent
(setq gnus-message-archive-group (lambda (g) (concat "nnimap+gmail:" g)))
But this has some problems: 1.i) I don't know how to do this *only* for the
gmail server. 1.ii) Obviously it doesn't work for emails sent from the
webmail.
Nevertheless, being able to solve 1.i alone would be very good news for me.
Have a look at the `gcc-self' group parameter.

,----[ (info "(gnus)Group Parameters") ]
| ‘gcc-self’
| If ‘(gcc-self . t)’ is present in the group parameter list, newly
| composed messages will be ‘Gcc’’d to the current group. If
| ‘(gcc-self . none)’ is present, no ‘Gcc:’ header will be generated,
| if ‘(gcc-self . "string")’ is present, this string will be inserted
| literally as a ‘gcc’ header. This parameter takes precedence over
| any default ‘Gcc’ rules as described later (*note Archived
| Messages::), with the exception for messages to resend.
|
| *Caveat*: Adding ‘(gcc-self . t)’ to the parameter list of ‘nntp’
| groups (or the like) isn’t valid. An ‘nntp’ server doesn’t accept
| articles.
`----

Here's my gcc-self related settings:

--8<---------------cut here---------------start------------->8---
(setq gnus-parameters
`((,(rx "nnimap+")
(gcc-self . t))
;; Mailing List exceptions
(,(rx "nnimap+Uni:ml/")
(gcc-self . "nnimap+Uni:Sent"))
(,(rx "nnimap+Fastmail:INBOX.mailinglists.")
(gcc-self . "nnimap+Fastmail:INBOX.Sent Items"))))
--8<---------------cut here---------------end--------------->8---

So I gcc the current group for all my IMAP accounts, except for mailing
list groups, where I gcc the account's sent mail folder.

To have that only for your Gmail account, you would change the regex to
something like ,(rx "nnimap+Gmail") or whatever you've named your gmail
account.
Post by c***@gmail.com
2) I would like to postpone a message directly to a remote group
(ideally, the gmail drafts folder). Currently I'm able to locally
postpone a message and then move it to the remote group. A way to
automate this is what I can't come with (or, better, to directly store
the draft in the remote group, which I'm afraid is not possible).
I think this question pops up here once in a while, but so far nobody
seems to have implemented that feature.

Bye,
Tassilo
Alberto Luaces
2014-07-31 07:19:53 UTC
Permalink
Post by Tassilo Horn
(,(rx "nnimap+Uni:ml/")
(gcc-self . "nnimap+Uni:Sent"))
(,(rx "nnimap+Fastmail:INBOX.mailinglists.")
(gcc-self . "nnimap+Fastmail:INBOX.Sent Items"))))
On a side note, I wanted to do this as well, but I was worrying about
losing the copy of an email if there are network problems during the
sending process. Any issue with that?

Thanks,
--
Alberto
Tassilo Horn
2014-07-31 09:05:00 UTC
Permalink
Alberto Luaces <***@udc.es> writes:

Hi Alberto,
Post by Alberto Luaces
Post by Tassilo Horn
(,(rx "nnimap+Uni:ml/")
(gcc-self . "nnimap+Uni:Sent"))
(,(rx "nnimap+Fastmail:INBOX.mailinglists.")
(gcc-self . "nnimap+Fastmail:INBOX.Sent Items"))))
On a side note, I wanted to do this as well, but I was worrying about
losing the copy of an email if there are network problems during the
sending process. Any issue with that?
Indeed, I think that can happen if the mail could successfully be
transfered to your SMTP server, but the server hosting the IMAP account
you're gcc-ing to is offline.

I think it would be nice if the gcc-self value could also be a list, so

(gcc-self "nnml+Archive:mail-backups" t)

would mean to put outgoing mail into both the local archive group and
into the current group as well. I've tried that out, but it doesn't
seem to be implemented so far.

I'll hack that right now. Shouldn't be too hard to implement, but give
me some time so that I can also update the docs accordingly.

Bye,
Tassilo
Tassilo Horn
2014-07-31 09:27:32 UTC
Permalink
Post by Tassilo Horn
I'll hack that right now. Shouldn't be too hard to implement, but
give me some time so that I can also update the docs accordingly.
Implemented, documented, and pushed to Gnus' git repository.

Bye,
Tassilo
Alberto Luaces
2014-07-31 09:35:30 UTC
Permalink
Post by Tassilo Horn
Post by Tassilo Horn
I'll hack that right now. Shouldn't be too hard to implement, but
give me some time so that I can also update the docs accordingly.
Implemented, documented, and pushed to Gnus' git repository.
Awesome! Thank you a lot!
--
Alberto
Carlos Pita
2014-07-31 19:18:50 UTC
Permalink
Hi Tassilo,

gcc-self is indeed a great tip, thank you!

As you've become sort of my guru now, I'm asking you further: I'm
having a hard time trying to match my primary method groups by prefix,
as in "imap.*"; the problem is that these groups don't show the method
prefix, only the secondary ones, but I really want to get a similar
behavior for all my primary select method without having to match on a
per group basis. Is that possible?

Regards
--
Carlos
Post by Tassilo Horn
Hi Carlos,
Post by c***@gmail.com
1) I would like to include my sent emails in the threads where they
belong, like in the "conversation" view gmail offers.
I do the same.
Post by c***@gmail.com
There is a suggestion somewhere in the net to create a virtual group
merging the inbox and the sent mail groups, but this will only work
for threads in the inbox. Another option is to add a copy of any sent
(setq gnus-message-archive-group (lambda (g) (concat "nnimap+gmail:" g)))
But this has some problems: 1.i) I don't know how to do this *only* for the
gmail server. 1.ii) Obviously it doesn't work for emails sent from the
webmail.
Nevertheless, being able to solve 1.i alone would be very good news for me.
Have a look at the `gcc-self' group parameter.
,----[ (info "(gnus)Group Parameters") ]
| ‘gcc-self’
| If ‘(gcc-self . t)’ is present in the group parameter list, newly
| composed messages will be ‘Gcc’’d to the current group. If
| ‘(gcc-self . none)’ is present, no ‘Gcc:’ header will be generated,
| if ‘(gcc-self . "string")’ is present, this string will be inserted
| literally as a ‘gcc’ header. This parameter takes precedence over
| any default ‘Gcc’ rules as described later (*note Archived
| Messages::), with the exception for messages to resend.
|
| *Caveat*: Adding ‘(gcc-self . t)’ to the parameter list of ‘nntp’
| groups (or the like) isn’t valid. An ‘nntp’ server doesn’t accept
| articles.
`----
--8<---------------cut here---------------start------------->8---
(setq gnus-parameters
`((,(rx "nnimap+")
(gcc-self . t))
;; Mailing List exceptions
(,(rx "nnimap+Uni:ml/")
(gcc-self . "nnimap+Uni:Sent"))
(,(rx "nnimap+Fastmail:INBOX.mailinglists.")
(gcc-self . "nnimap+Fastmail:INBOX.Sent Items"))))
--8<---------------cut here---------------end--------------->8---
So I gcc the current group for all my IMAP accounts, except for mailing
list groups, where I gcc the account's sent mail folder.
To have that only for your Gmail account, you would change the regex to
something like ,(rx "nnimap+Gmail") or whatever you've named your gmail
account.
Post by c***@gmail.com
2) I would like to postpone a message directly to a remote group
(ideally, the gmail drafts folder). Currently I'm able to locally
postpone a message and then move it to the remote group. A way to
automate this is what I can't come with (or, better, to directly store
the draft in the remote group, which I'm afraid is not possible).
I think this question pops up here once in a while, but so far nobody
seems to have implemented that feature.
Bye,
Tassilo
Carlos Pita
2014-07-31 19:44:06 UTC
Permalink
Well, this is the best I could come with, considering that emacs
regexps have no negative look-ahead or any fancy stuff:

(setq gnus-parameters
'(("^[^:]+$"
(gcc-self . t)
(gnus-gcc-mark-as-read . t))))

It will work as long as there are no gmail labels including a ':'. If
you know of a better approach, please tell me!

Regards
--
Carlos
Post by Carlos Pita
Hi Tassilo,
gcc-self is indeed a great tip, thank you!
As you've become sort of my guru now, I'm asking you further: I'm
having a hard time trying to match my primary method groups by prefix,
as in "imap.*"; the problem is that these groups don't show the method
prefix, only the secondary ones, but I really want to get a similar
behavior for all my primary select method without having to match on a
per group basis. Is that possible?
Regards
--
Carlos
Post by Tassilo Horn
Hi Carlos,
Post by c***@gmail.com
1) I would like to include my sent emails in the threads where they
belong, like in the "conversation" view gmail offers.
I do the same.
Post by c***@gmail.com
There is a suggestion somewhere in the net to create a virtual group
merging the inbox and the sent mail groups, but this will only work
for threads in the inbox. Another option is to add a copy of any sent
(setq gnus-message-archive-group (lambda (g) (concat "nnimap+gmail:" g)))
But this has some problems: 1.i) I don't know how to do this *only* for the
gmail server. 1.ii) Obviously it doesn't work for emails sent from the
webmail.
Nevertheless, being able to solve 1.i alone would be very good news for me.
Have a look at the `gcc-self' group parameter.
,----[ (info "(gnus)Group Parameters") ]
| ‘gcc-self’
| If ‘(gcc-self . t)’ is present in the group parameter list, newly
| composed messages will be ‘Gcc’’d to the current group. If
| ‘(gcc-self . none)’ is present, no ‘Gcc:’ header will be generated,
| if ‘(gcc-self . "string")’ is present, this string will be inserted
| literally as a ‘gcc’ header. This parameter takes precedence over
| any default ‘Gcc’ rules as described later (*note Archived
| Messages::), with the exception for messages to resend.
|
| *Caveat*: Adding ‘(gcc-self . t)’ to the parameter list of ‘nntp’
| groups (or the like) isn’t valid. An ‘nntp’ server doesn’t accept
| articles.
`----
--8<---------------cut here---------------start------------->8---
(setq gnus-parameters
`((,(rx "nnimap+")
(gcc-self . t))
;; Mailing List exceptions
(,(rx "nnimap+Uni:ml/")
(gcc-self . "nnimap+Uni:Sent"))
(,(rx "nnimap+Fastmail:INBOX.mailinglists.")
(gcc-self . "nnimap+Fastmail:INBOX.Sent Items"))))
--8<---------------cut here---------------end--------------->8---
So I gcc the current group for all my IMAP accounts, except for mailing
list groups, where I gcc the account's sent mail folder.
To have that only for your Gmail account, you would change the regex to
something like ,(rx "nnimap+Gmail") or whatever you've named your gmail
account.
Post by c***@gmail.com
2) I would like to postpone a message directly to a remote group
(ideally, the gmail drafts folder). Currently I'm able to locally
postpone a message and then move it to the remote group. A way to
automate this is what I can't come with (or, better, to directly store
the draft in the remote group, which I'm afraid is not possible).
I think this question pops up here once in a while, but so far nobody
seems to have implemented that feature.
Bye,
Tassilo
Carlos Pita
2014-07-31 20:27:22 UTC
Permalink
Here's another alternative (similar to the one I posted a couple of days
ago):

(setq gnus-message-archive-group
(lambda (g)
(when (message-mail-p)
(concat "nnimap+gmail:" g))))

If I'm not wrong this is more or less equivalent to:

(setq gnus-parameters
'(("^[^:]+$" (gcc-self . t)
("^[^:]+:.+$" (gcc-self . none)))))

The first one has a more flexible matching mechanism, as it let's you
pass a lambda expression. But it can't set anything besides the
group. It would be nice that gnus-parameters worked more like
gnus-message-archive-groups, allowing one to passed a dotted pair list
but also a function or expression.

Regards
--
Carlos
Adam Sjøgren
2014-07-31 20:36:57 UTC
Permalink
I'm having a hard time trying to match my primary method groups by
prefix, as in "imap.*"; the problem is that these groups don't show
the method prefix, only the secondary ones, but I really want to get a
similar behavior for all my primary select method without having to
match on a per group basis. Is that possible?
Probably not the answer you are looking for, but: I use nnnil as the
primary method, and all the real stuff is secondary methods - nobody
gets put on the primary piedestal.


:-),

Adam
--
"It troo! Dat darn Kahlfin stole ma spacechip!" Adam Sjøgren
***@koldfront.dk
Tassilo Horn
2014-08-01 09:01:27 UTC
Permalink
Carlos Pita <***@gmail.com> writes:

Hi Carlos,
Post by Carlos Pita
gcc-self is indeed a great tip, thank you!
Thanks!
Post by Carlos Pita
As you've become sort of my guru now, I'm asking you further: I'm
having a hard time trying to match my primary method groups by prefix,
as in "imap.*"; the problem is that these groups don't show the method
prefix, only the secondary ones,
Oh, really? I wasn't aware of that.
Post by Carlos Pita
but I really want to get a similar behavior for all my primary select
method without having to match on a per group basis. Is that possible?
Well, I don't use a primary select method at all, only secondary ones.
And as far as I know, there's nothing making them less powerful or
second class citizens (well, except that the backend is always shown, it
seems), so you might want to do the same.

;; Make the primary select method a do-nothing one
(setq gnus-select-method '(nnnil))

;; Only use severeal secondary select methods
(add-to-list 'gnus-secondary-select-methods
'(nntp "Gmane"
(nntp-address "news.gmane.org")))
...

Bye,
Tassilo

Loading...