* Re: Rmail tips
2024-02-09 14:01 ` Ben Hancock
@ 2024-02-09 19:22 ` Colin Baxter
2024-02-10 7:05 ` Ben Hancock
2024-02-15 13:21 ` Fernando de Morais
2024-02-15 13:23 ` Fernando de Morais
2 siblings, 1 reply; 15+ messages in thread
From: Colin Baxter @ 2024-02-09 19:22 UTC (permalink / raw)
To: Ben Hancock; +Cc: Fernando de Morais, help-gnu-emacs
>>>>> Ben Hancock <ben@benghancock.com> writes:
> Fernando de Morais <fernandodemorais.jf@gmail.com> writes:
>> I believe this answer is long overdue and now, after a few months
>> of use, you should have already configured RMAIL to suit your
>> needs.
>>
>> However, here are some recommendations for things that were
>> helpful to me when using RMAIL:
> Thanks for your kind reply and these helpful snippets, Fernando. I
> just recently started using Mairix, which has been great.
> The one thing I still haven't found the optimal approach for in
> RMAIL is filtering mails into dedicated mailboxes -- for example,
> for high-volume mailing lists, that I may want to keep out of my
> regular RMAIL inbox.
> I've tried using the rmail-automatic-folder-directives variable to
> handle this, but it has the downside that mails are marked as seen
> when they are filed away; they also still land in the main RMAIL
> file first.
> My MTA (maildrop) of course can put incoming mails into specific
> files based on conditions. But if I just visit those files with
> RMAIL, i.e. by using the 'i' command, there is also no distinction
> between what is old and what is unseen. It seems that I would have
> to configure those files as separate _inboxes_, and fetch mail
> from them into another RMAIL file.
> That's doable, but I'm wondering if there's another way ... or if
> I should abandon filtering altogether and just search?
I filter incoming mail by means of procmail and then read the mailboxes
using "rmail-input". This might be too simple for what you want, of
course.
Best wishes,
Colin Baxter.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Rmail tips
2024-02-09 19:22 ` Colin Baxter
@ 2024-02-10 7:05 ` Ben Hancock
2024-02-10 8:29 ` Colin Baxter
0 siblings, 1 reply; 15+ messages in thread
From: Ben Hancock @ 2024-02-10 7:05 UTC (permalink / raw)
To: m43cap; +Cc: fernandodemorais.jf, help-gnu-emacs
Colin Baxter <m43cap@yandex.com> writes:
> I filter incoming mail by means of procmail and then read the
> mailboxes using "rmail-input". This might be too simple for what you
> want, of course.
This seems like a fine approach and I've tried a similar setup; my issue
was that new messages in these inboxes weren't treated as "unseen" by
rmail, so it was hard to distinguish new mail.
I think this is because rmail is not actually fetching mail out of these
inboxes, it just treats them as any other rmail file. Have you found the
same behavior, or have I perhaps missed a step?
Thanks,
Ben
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Rmail tips
2024-02-10 7:05 ` Ben Hancock
@ 2024-02-10 8:29 ` Colin Baxter
2024-02-12 13:53 ` Ben Hancock
0 siblings, 1 reply; 15+ messages in thread
From: Colin Baxter @ 2024-02-10 8:29 UTC (permalink / raw)
To: Ben Hancock; +Cc: fernandodemorais.jf, help-gnu-emacs
>>>>> Ben Hancock <ben@benghancock.com> writes:
> Colin Baxter <m43cap@yandex.com> writes:
>> I filter incoming mail by means of procmail and then read the
>> mailboxes using "rmail-input". This might be too simple for what
>> you want, of course.
> This seems like a fine approach and I've tried a similar setup; my
> issue was that new messages in these inboxes weren't treated as
> "unseen" by rmail, so it was hard to distinguish new mail.
I was going to write "no, I don't have that problem", but then I thought
that perhaps I do see the same as you except I don't think of it as an
issue.
I don't know if it's possible in rmail to "flag" an email as
unread. There is a variable "rmail-unseen-attr-index" with a default
value of 6. Maybe it's possible to use that, but I've never tried.
In procmail, you can set a log file and have that displayed in
gnus. That way, you can see immediately what email is unread. You will
need promaillog.el from <https://www.emacswiki.org/emacs/ProcmailLog>.
I use fetchmail first to bring emails from various external
servers. However, I use fetchmail manually from a shell and so I am able
to see what new emails I have received. I don't fetch emails
automatically. I read the "rmail-file-name" first and then M-x
rmail-input <RET> to navigate to files that I know have new email. All
the files are listed with the latest email in view at the top, and
indeed they are not distinguished by whether they have been previously
read or unread.
Best wishes,
Colin.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Rmail tips
2024-02-10 8:29 ` Colin Baxter
@ 2024-02-12 13:53 ` Ben Hancock
2024-02-12 14:34 ` Colin Baxter
0 siblings, 1 reply; 15+ messages in thread
From: Ben Hancock @ 2024-02-12 13:53 UTC (permalink / raw)
To: m43cap; +Cc: fernandodemorais.jf, help-gnu-emacs
[Colin wrote:]
>>> I filter incoming mail by means of procmail and then read the
>>> mailboxes using "rmail-input". This might be too simple for what you
>>> want, of course.
[Ben replied:]
>> This seems like a fine approach and I've tried a similar setup; my
>> issue was that new messages in these inboxes weren't treated as
>> "unseen" by rmail, so it was hard to distinguish new mail.
[Then Colin responded:]
> I don't know if it's possible in rmail to "flag" an email as
> unread. There is a variable "rmail-unseen-attr-index" with a default
> value of 6. Maybe it's possible to use that, but I've never tried.
This was a good clue. Rmail recognizes a set of email labels or
"attributes" that have special meaning[1], including "unseen" (or
unread). After digging into rmail.el and looking at my mail headers more
closely, it looks like each message that is read into rmail-file-name
via the 'rmail' command is given a special header that looks like this:
X-RMAIL-ATTRIBUTES: --------
When a message is "unseen", the dash at position 6 (zero-indexed) gets a
special "U" flag, changing the header to this:
X--RMAIL-ATTRIBUTES: ------U-
Rmail treats these messages differently; it will default to opening the
first unseen message when reading a file into rmail, and unseen messages
get a different face in the summary buffer so they stand out.
I also use fetchmail with maildrop(1) as my mail delivery agent, and it
supports adding a custom header to incoming messages (via the '-A'
flag); I imagine procmail has a similar option. So it seems feasible to
set the set the "unseen" flag on messages that are filtered to different
files this way, even without them being read via the 'rmail' command. I
may give that a shot.
Thanks!
- Ben
[1] See: info '(emacs) Rmail Attributes'
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Rmail tips
2024-02-12 13:53 ` Ben Hancock
@ 2024-02-12 14:34 ` Colin Baxter
2024-02-15 16:08 ` Ben Hancock
0 siblings, 1 reply; 15+ messages in thread
From: Colin Baxter @ 2024-02-12 14:34 UTC (permalink / raw)
To: Ben Hancock; +Cc: fernandodemorais.jf, help-gnu-emacs
>>>>> Ben Hancock <ben@benghancock.com> writes:
> [Colin wrote:]
>>>> I filter incoming mail by means of procmail and then read the
>>>> mailboxes using "rmail-input". This might be too simple for
>>>> what you want, of course.
> [Ben replied:]
>>> This seems like a fine approach and I've tried a similar setup;
>>> my issue was that new messages in these inboxes weren't treated
>>> as "unseen" by rmail, so it was hard to distinguish new mail.
> [Then Colin responded:]
>> I don't know if it's possible in rmail to "flag" an email as
>> unread. There is a variable "rmail-unseen-attr-index" with a
>> default value of 6. Maybe it's possible to use that, but I've
>> never tried.
> This was a good clue. Rmail recognizes a set of email labels or
> "attributes" that have special meaning[1], including "unseen" (or
> unread). After digging into rmail.el and looking at my mail
> headers more closely, it looks like each message that is read into
> rmail-file-name via the 'rmail' command is given a special header
> that looks like this:
> X-RMAIL-ATTRIBUTES: --------
> When a message is "unseen", the dash at position 6 (zero-indexed)
> gets a special "U" flag, changing the header to this:
> X--RMAIL-ATTRIBUTES: ------U-
> Rmail treats these messages differently; it will default to
> opening the first unseen message when reading a file into rmail,
> and unseen messages get a different face in the summary buffer so
> they stand out.
I never knew that. I get the X-RMAIL-ATTRIBUTES header but not the `U'
on messages that are definitely unseen. Is there some variable that must
be set to actually see these attributes?
Best wishes,
Colin.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Rmail tips
2024-02-12 14:34 ` Colin Baxter
@ 2024-02-15 16:08 ` Ben Hancock
2024-02-21 6:00 ` Colin Baxter
0 siblings, 1 reply; 15+ messages in thread
From: Ben Hancock @ 2024-02-15 16:08 UTC (permalink / raw)
To: m43cap; +Cc: fernandodemorais.jf, help-gnu-emacs
[Ben wrote:]
>> When a message is "unseen", the dash at position 6 (zero-indexed)
>> gets a special "U" flag, changing the header to this:
>>
>> X--RMAIL-ATTRIBUTES: ------U-
>>
>> Rmail treats these messages differently; it will default to opening
>> the first unseen message when reading a file into rmail, and unseen
>> messages get a different face in the summary buffer so they stand
>> out.
[Colin replied:]
> I never knew that. I get the X-RMAIL-ATTRIBUTES header but not the `U'
> on messages that are definitely unseen. Is there some variable that
> must be set to actually see these attributes?
I don't think so; from what I can tell, the U flag is set on messages
that Rmail retrieves out of what it calls the "inbox" - either a system
mailbox, or a remote mailbox. See (info "(emacs) Rmail Inbox").
In rmail.el, it looks like this process calls a function named
rmail-add-mbox-headers that sets the U flag. It sounds like you're using
procmail to put new mail into your rmail-file-name directly, so that
step doesn't happen.
You may be able to use procmail to add the header as messages to come
in, perhaps in combination with formail. I don't use either, but based
on docs it seems possible:
https://linux.die.net/man/1/formail
Best,
Ben
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Rmail tips
2024-02-15 16:08 ` Ben Hancock
@ 2024-02-21 6:00 ` Colin Baxter
0 siblings, 0 replies; 15+ messages in thread
From: Colin Baxter @ 2024-02-21 6:00 UTC (permalink / raw)
To: Ben Hancock; +Cc: fernandodemorais.jf, help-gnu-emacs
>>>>> Ben Hancock <ben@benghancock.com> writes:
> I don't think so; from what I can tell, the U flag is set on
> messages that Rmail retrieves out of what it calls the "inbox" -
> either a system mailbox, or a remote mailbox. See (info "(emacs)
> Rmail Inbox").
That makes sense.
> You may be able to use procmail to add the header as messages to
> come in, perhaps in combination with formail. I don't use
> either, but based on docs it seems possible:
> https://linux.die.net/man/1/formail
I'll give that a try, thank you for all your help.
Best wishes,
Colin.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Rmail tips
2024-02-09 14:01 ` Ben Hancock
2024-02-09 19:22 ` Colin Baxter
@ 2024-02-15 13:21 ` Fernando de Morais
2024-02-15 13:23 ` Fernando de Morais
2 siblings, 0 replies; 15+ messages in thread
From: Fernando de Morais @ 2024-02-15 13:21 UTC (permalink / raw)
To: Ben Hancock; +Cc: help-gnu-emacs
Hello Ben,
Sorry for my late response (again).
Ben Hancock <ben@benghancock.com> writes:
> Thanks for your kind reply and these helpful snippets, Fernando. I just
> recently started using Mairix, which has been great.
You're welcome!
> I've tried using the rmail-automatic-folder-directives variable to
> handle this, but it has the downside that mails are marked as seen when
> they are filed away; they also still land in the main RMAIL file first.
>
> My MTA (maildrop) of course can put incoming mails into specific files
> based on conditions. But if I just visit those files with RMAIL, i.e. by
> using the 'i' command, there is also no distinction between what is old
> and what is unseen. It seems that I would have to configure those files
> as separate _inboxes_, and fetch mail from them into another RMAIL file.
>
> That's doable, but I'm wondering if there's another way ... or if I
> should abandon filtering altogether and just search?
Perhaps you can customize the `rmail-auto-file' function (which is
called when Rmail is obeying the `rmail-automatic-folder-directives') to
use `rmail-set-attribute' and, therefore, force the insertion of the
`unseen' attribute in messages. Maybe like this:
#+begin_src emacs-lisp
(defun rmail-auto-file ()
...
(if (null directive-loop)
(if (null folder)
(rmail-delete-forward)
(if (string= "/dev/null" folder)
(rmail-delete-message)
(rmail-set-attribute rmail-unseen-attr-index t) ; ==> Here?
(rmail-output folder 1)
(setq d nil))))
(setq d (cdr d))))))
#+end_src
Unfortunately, at the moment, I can't test whether just this insertion
is enough, but if you can (and if it works), do you think it would cover
your use case?
Hope it helps!
--
Regards,
Fernando de Morais.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Rmail tips
2024-02-09 14:01 ` Ben Hancock
2024-02-09 19:22 ` Colin Baxter
2024-02-15 13:21 ` Fernando de Morais
@ 2024-02-15 13:23 ` Fernando de Morais
2 siblings, 0 replies; 15+ messages in thread
From: Fernando de Morais @ 2024-02-15 13:23 UTC (permalink / raw)
To: Ben Hancock; +Cc: help-gnu-emacs
Hello Ben,
Sorry for my late response (again).
Ben Hancock <ben@benghancock.com> writes:
> Thanks for your kind reply and these helpful snippets, Fernando. I just
> recently started using Mairix, which has been great.
You're welcome!
> I've tried using the rmail-automatic-folder-directives variable to
> handle this, but it has the downside that mails are marked as seen when
> they are filed away; they also still land in the main RMAIL file first.
>
> My MTA (maildrop) of course can put incoming mails into specific files
> based on conditions. But if I just visit those files with RMAIL, i.e. by
> using the 'i' command, there is also no distinction between what is old
> and what is unseen. It seems that I would have to configure those files
> as separate _inboxes_, and fetch mail from them into another RMAIL file.
>
> That's doable, but I'm wondering if there's another way ... or if I
> should abandon filtering altogether and just search?
Perhaps you can customize the `rmail-auto-file' function (which is
called when Rmail is obeying the `rmail-automatic-folder-directives') to
use `rmail-set-attribute' and, therefore, force the insertion of the
`unseen' attribute in messages. Maybe like this:
#+begin_src emacs-lisp
(defun rmail-auto-file ()
...
(if (null directive-loop)
(if (null folder)
(rmail-delete-forward)
(if (string= "/dev/null" folder)
(rmail-delete-message)
(rmail-set-attribute rmail-unseen-attr-index t) ; ==> Here?
(rmail-output folder 1)
(setq d nil))))
(setq d (cdr d))))))
#+end_src
Unfortunately, at the moment, I can't test whether just this insertion
is enough, but if you can (and if it works), do you think it would cover
your use case?
Hope it helps!
--
Regards,
Fernando de Morais.
^ permalink raw reply [flat|nested] 15+ messages in thread