[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nnimap-split-download-body removed?
From: |
Eric Abrahamsen |
Subject: |
Re: nnimap-split-download-body removed? |
Date: |
Mon, 30 Nov 2020 09:10:05 -0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Bodertz <bodertz@gmail.com> writes:
> I wrote a function which can do something useful with the body of an
> email. If worse comes to worse, I can run this function manually after
> opening the email, but my plan was to use splitting to automate this.
>
> As documented in "(gnus)Fancy Mail Splitting", splitting based on the
> content of the email can be done with nnimap by setting
> 'nnimap-split-download-body' to 't'. See the last sentence:
>
> (: FUNCTION ARG1 ARG2 ...)’
> If the split is a list, and the first element is ‘:’, then the
> second element will be called as a function with ARGS given as
> arguments. The function should return a SPLIT.
>
> For instance, the following function could be used to split based
> on the body of the messages:
>
> (defun split-on-body ()
> (save-excursion
> (save-restriction
> (widen)
> (goto-char (point-min))
> (when (re-search-forward "Some.*string" nil t)
> "string.group"))))
>
> The buffer is narrowed to the header of the message in question
> when FUNCTION is run. That’s why ‘(widen)’ needs to be called
> after ‘save-excursion’ and ‘save-restriction’ in the example above.
> Also note that with the nnimap backend, message bodies will not be
> downloaded by default. You need to set
> ‘nnimap-split-download-body’ to ‘t’ to do that (*note Client-Side
> IMAP Splitting).
>
> However, this did not seem to work, although I haven't tested
> thouroughly. Looking through the git history of Emacs, it seems that
> 'nnimap-split-download-body' was removed a little over ten years ago.
> An internal variable, 'nnimap-split-download-body-default' is still
> present, but is as far as I can tell unused.
I tried looking through the history, too, and that was pretty confusing.
It looks like the manual section talking about
`nnimap-split-download-body' was added *after* the actual defcustom was
removed. I suspect that's an artifact of git history merge, but the
current situation is still odd (the manual still refers to
`nnimap-split-download-body').
It looks like `nnimap-split-download-body-default' is in fact still
used, in `nnimap-fetch-inbox', and setting it to t looks like it should
work. Give that a shot?
No matter what, there's a mismatch between code and documentation. And
if split-download-body-default still has effect, then it should be a
defcustom, too. I don't see why there were two separate variables to
begin with.
Anyway, let me know if setting that variable to t works.
Eric