all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Another "Rmail" problem I ran into
@ 2024-06-09 16:19 Dr Rainer Woitok
  2024-06-09 16:47 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Dr Rainer Woitok @ 2024-06-09 16:19 UTC (permalink / raw)
  To: Help-Gnu-Emacs

Greetings,

because sometimes  Google sends  some reply mail  to my inbox  before it
sends the corresponding original mail, I added the following lines to my
"Rmail" configuration file:

   (defun Sort-Date ()
    "Sort incoming mail by date."
    (rmail-summary-sort-by-date nil))

   (add-hook 'rmail-get-new-mail-hook 'Sort-Date)

But this leads  to either  the summary  or the message buffer  not being
displayed, and in buffer "*Messages*" I find

   Getting mail from /home/rainer/mail/.HAM...
   Counting new messages...done (1)
   Finding sort keys...30
   Reordering messages...30
   Counting messages...done
   Computing summary lines...done
   rmail-show-message: Wrong type argument: stringp, nil

Just in case it matters: including the one new message there are 39 mes-
sages in the summary buffer,  so why does "Rmail" only process 30 messa-
ges?

When I again comment out the "add-hook" line above and restart "Rmail",
everything works again (well, except for the sorting of course).

What's going wrong here?

Sincerely,
  Rainer



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Another "Rmail" problem I ran into
  2024-06-09 16:19 Another "Rmail" problem I ran into Dr Rainer Woitok
@ 2024-06-09 16:47 ` Eli Zaretskii
  2024-06-10 15:32   ` Dr Rainer Woitok
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2024-06-09 16:47 UTC (permalink / raw)
  To: Help-Gnu-Emacs

> From: Dr Rainer Woitok <rainer.woitok@gmail.com>
> Date: Sun, 09 Jun 2024 18:19:13 +0200
> 
> Greetings,
> 
> because sometimes  Google sends  some reply mail  to my inbox  before it
> sends the corresponding original mail, I added the following lines to my
> "Rmail" configuration file:
> 
>    (defun Sort-Date ()
>     "Sort incoming mail by date."
>     (rmail-summary-sort-by-date nil))
> 
>    (add-hook 'rmail-get-new-mail-hook 'Sort-Date)

You cannot call rmail-summary functions from rmail-get-new-mail-hook,
not without switching to the right buffer and doing other bookkeeping.
rmail-get-new-mail-hook is a hook intended to act on the new messages
in the Rmail buffer, it is not intended to make summaries.

> But this leads  to either  the summary  or the message buffer  not being
> displayed, and in buffer "*Messages*" I find
> 
>    Getting mail from /home/rainer/mail/.HAM...
>    Counting new messages...done (1)
>    Finding sort keys...30
>    Reordering messages...30
>    Counting messages...done
>    Computing summary lines...done
>    rmail-show-message: Wrong type argument: stringp, nil
> 
> Just in case it matters: including the one new message there are 39 mes-
> sages in the summary buffer,  so why does "Rmail" only process 30 messa-
> ges?

Because when the hook is called, the Rmail buffer is narrowed to
include only the newly arrived email messages.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Another "Rmail" problem I ran into
  2024-06-09 16:47 ` Eli Zaretskii
@ 2024-06-10 15:32   ` Dr Rainer Woitok
  2024-06-10 16:10     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Dr Rainer Woitok @ 2024-06-10 15:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Help-Gnu-Emacs

Eli,

On Sun, 09 Jun 2024 19:47:20 +0300 you wrote:
> ...
> You cannot call rmail-summary functions from rmail-get-new-mail-hook,
> not without switching to the right buffer and doing other bookkeeping.
> rmail-get-new-mail-hook is a hook intended to act on the new messages
> in the Rmail buffer, it is not intended to make summaries.

Hm,  wouldn't that be worth  being mentioned in both,  the docstring and
the info-pages?   From the hook functions I am aware of,  this seemed to
be the natural place for running my function.

And does that mean that the only way achieving my goal is to re-bind key
"g" to a function which first runs "rmail-get-new-mail" and then "rmail-
summary-sort-by-date"?  Or is there another hook function I could use?

Sincerely,
  Rainer



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Another "Rmail" problem I ran into
  2024-06-10 15:32   ` Dr Rainer Woitok
@ 2024-06-10 16:10     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2024-06-10 16:10 UTC (permalink / raw)
  To: Help-Gnu-Emacs

> From: Dr Rainer Woitok <rainer.woitok@gmail.com>
> Date: Mon, 10 Jun 2024 17:32:21 +0200
> Cc: Help-Gnu-Emacs@Gnu.Org
> 
> On Sun, 09 Jun 2024 19:47:20 +0300 you wrote:
> > ...
> > You cannot call rmail-summary functions from rmail-get-new-mail-hook,
> > not without switching to the right buffer and doing other bookkeeping.
> > rmail-get-new-mail-hook is a hook intended to act on the new messages
> > in the Rmail buffer, it is not intended to make summaries.
> 
> Hm,  wouldn't that be worth  being mentioned in both,  the docstring and
> the info-pages?

It is mentioned now, I added that yesterday.

> And does that mean that the only way achieving my goal is to re-bind key
> "g" to a function which first runs "rmail-get-new-mail" and then "rmail-
> summary-sort-by-date"?

That's the simplest way, yes.  So I suggest that you do that in your
customizations.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-10 16:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-09 16:19 Another "Rmail" problem I ran into Dr Rainer Woitok
2024-06-09 16:47 ` Eli Zaretskii
2024-06-10 15:32   ` Dr Rainer Woitok
2024-06-10 16:10     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.