Gnus development mailing list
 help / color / mirror / Atom feed
* nnimap, nnimap-split-fancy and splitting functions
@ 2003-05-04  9:31 Eric Knauel
  2003-05-04 20:19 ` Simon Josefsson
  2003-05-04 22:21 ` Ted Zlatanov
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Knauel @ 2003-05-04  9:31 UTC (permalink / raw)


Hi,

I'm trying to make nnimap-split-fancy run a function that sends the
mail received to an external program. The gnus manual for
nnmail-split-fancy (and nnimap-split-fancy) says that the message in
question can be found in nnmail-article-buffer (` *nnmail
incoming*'). However, there is no such buffer, when using nnimap
groups. The message in question seems to be in ` *nntpd*' -- is this
the intended behaviour? Is it "dangerous" to work or modify the 
` *nntpd*' buffer?

Here what I'm trying to do:

,----[ gnus.el ]
| (setq nnimap-expunge-on-close 'always
|       nnimap-split-inbox '("INBOX")
|       nnimap-split-rule 'nnimap-split-fancy
|       nnimap-split-download-body t
|       nnimap-split-fancy '(| (: spamoracle-split-function "INBOX.spam")
| 			     "INBOX"))
| 
| (defconst spamoracle-command "/afs/wsi/ppc_macx64/bin/spamoracle mark")
| 
| (defun spamoracle-split-function (spam-group)
|   (save-excursion
|     (set-buffer nnmail-article-buffer)
| ;      (set-buffer " *nntpd*")
|     (shell-command-on-region (point-min) (point-max) spamoracle-command)
|     (when (re-search-forward "^X-Spam: yes;" nil t)
|       spam-group)))
`----

This leads to this backtrace (after pressing `g' in the group buffer):

,----
| Signaling: (error "Selecting deleted or non-existent buffer")
|   set-buffer(" *nnmail incoming*")
| (save-excursion (set-buffer
nnmail-article-buffer)(shell-command-on-region (point-min) (point-max)
spamoracle-command) (when (re-search-forward "^X-Spam: yes;" nil t)
spam-group))
|   ad-Orig-spamoracle-split-function("INBOX.spam")
|   spamoracle-split-function("INBOX.spam")
|   eval((spamoracle-split-function "INBOX.spam"))
|   nnmail-split-it((: spamoracle-split-function "INBOX.spam"))
|   nnmail-split-it((| (: spamoracle-split-function "INBOX.spam") "INBOX"))
|   nnmail-split-fancy()
|   nnimap-split-fancy()
|   nnimap-split-to-groups(nnimap-split-fancy)
|   nnimap-split-articles(nil "webmail.macnews.de")
|   nnimap-request-scan(nil "webmail.macnews.de")
| gnus-request-scan(nil (nnimap "webmail.macnews.de" (nnimap-address
"webmail.macnews.de") (nnimap-server-port 585) (nnimap-list-pattern
("INBOX" "macnews/*" "archive/*")) (nnimap-stream ssl)))
| gnus-read-active-file-1((nnimap "webmail.macnews.de" (nnimap-address
"webmail.macnews.de") (nnimap-server-port 585) (nnimap-list-pattern
("INBOX" "macnews/*" "archive/*")) (nnimap-stream ssl)) nil)
|   gnus-read-active-file()
|   gnus-group-get-new-news(nil)
|   call-interactively(gnus-group-get-new-news)
|   recursive-edit()
| byte-code("..." [print-escape-newlines print-length debugger-buffer
debugger-value standard-output debugger-args pop-to-buffer
erase-buffer t 50 backtrace debugger-mode re-search-forward "\n[* ]
debug(" 1 debugger-reenable (lambda debug) "Entering:\n" debug
backtrace-debug 3 delete-char ?* 0 exit "Return value: " prin1 ?\n ?\
error "Signaling: " "Beginning evaluation of function call form:\n"
nil message "" recursive-edit buffer-read-only inhibit-trace] 3)
|   debug(error (error "Selecting deleted or non-existent buffer"))
|   set-buffer(" *nnmail incoming test*")
| (save-excursion (set-buffer " *nnmail incoming test*")
(shell-command-on-region (point-min) (point-max) spamoracle-command)
(when (re-search-forward "^X-Spam: yes;" nil t)
spamoracle-spam-group))
| (let ((temp-buffer-name "*spamoracle split temp buffer*"))
(save-excursion (set-buffer " *nnmail incoming test*")
(shell-command-on-region ... ... spamoracle-command) (when
... spamoracle-spam-group)))
|   ad-Orig-spamoracle-split-function()
|   spamoracle-split-function()
|   eval((spamoracle-split-function))
|   nnmail-split-it((: spamoracle-split-function))
|   nnmail-split-it((| (: spamoracle-split-function) "INBOX"))
|   nnmail-split-fancy()
|   nnimap-split-fancy()
|   nnimap-split-to-groups(nnimap-split-fancy)
|   nnimap-split-articles(nil "webmail.macnews.de")
|   nnimap-request-scan(nil "webmail.macnews.de")
| gnus-request-scan(nil (nnimap "webmail.macnews.de" (nnimap-address
"webmail.macnews.de") (nnimap-server-port 585) (nnimap-list-pattern
("INBOX" "macnews/*" "archive/*")) (nnimap-stream ssl)))
| gnus-read-active-file-1((nnimap "webmail.macnews.de" (nnimap-address
"webmail.macnews.de") (nnimap-server-port 585) (nnimap-list-pattern
("INBOX" "macnews/*" "archive/*")) (nnimap-stream ssl)) nil)
|   gnus-read-active-file()
|   gnus-group-get-new-news(nil)
|   call-interactively(gnus-group-get-new-news)
`----

-Eric
-- 
"Excuse me --- Di Du Du Duuuuh Di Dii --- Huh Weeeheeee" (Albert King)




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

* Re: nnimap, nnimap-split-fancy and splitting functions
  2003-05-04  9:31 nnimap, nnimap-split-fancy and splitting functions Eric Knauel
@ 2003-05-04 20:19 ` Simon Josefsson
  2003-05-04 22:21 ` Ted Zlatanov
  1 sibling, 0 replies; 5+ messages in thread
From: Simon Josefsson @ 2003-05-04 20:19 UTC (permalink / raw)
  Cc: ding

Eric Knauel <knauel@informatik.uni-tuebingen.de> writes:

> Hi,
>
> I'm trying to make nnimap-split-fancy run a function that sends the
> mail received to an external program. The gnus manual for
> nnmail-split-fancy (and nnimap-split-fancy) says that the message in
> question can be found in nnmail-article-buffer (` *nnmail
> incoming*'). However, there is no such buffer, when using nnimap
> groups. The message in question seems to be in ` *nntpd*' -- is this
> the intended behaviour? Is it "dangerous" to work or modify the 
> ` *nntpd*' buffer?

Nope.

> | (defun spamoracle-split-function (spam-group)
> |   (save-excursion
> |     (set-buffer nnmail-article-buffer)
> | ;      (set-buffer " *nntpd*")
> |     (shell-command-on-region (point-min) (point-max) spamoracle-command)
> |     (when (re-search-forward "^X-Spam: yes;" nil t)
> |       spam-group)))
> `----
>
> This leads to this backtrace (after pressing `g' in the group buffer):
>
> ,----
> | Signaling: (error "Selecting deleted or non-existent buffer")

Does it work if you comment out the second set-buffer?

Perhaps nnimap should bind nnmail-article-buffer to *nntpd* before
calling user functions.  What do you think?




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

* Re: nnimap, nnimap-split-fancy and splitting functions
  2003-05-04  9:31 nnimap, nnimap-split-fancy and splitting functions Eric Knauel
  2003-05-04 20:19 ` Simon Josefsson
@ 2003-05-04 22:21 ` Ted Zlatanov
  2003-05-06 12:09   ` Eric Knauel
  1 sibling, 1 reply; 5+ messages in thread
From: Ted Zlatanov @ 2003-05-04 22:21 UTC (permalink / raw)
  Cc: ding

On Sun, 04 May 2003, knauel@informatik.uni-tuebingen.de wrote:
> I'm trying to make nnimap-split-fancy run a function that sends the
> mail received to an external program. 

Look in spam.el in the latest Gnus for an example of how this is done,
the bogofilter functionality runs the article through bogofilter to
determine if it's spam or not.

> The gnus manual for nnmail-split-fancy (and nnimap-split-fancy) says
> that the message in question can be found in nnmail-article-buffer
> (` *nnmail incoming*'). However, there is no such buffer, when using
> nnimap groups. The message in question seems to be in ` *nntpd*' --
> is this the intended behaviour? Is it "dangerous" to work or modify
> the ` *nntpd*' buffer?

I always thought the split function was invoked with the article in
the current buffer, so you just call (widen) and you're off to the
races.  At least that's how spam-split in spam.el does it, and it
works fine.  Make sure you set nnimap-split-download-body to get the
full message body.

Ted



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

* Re: nnimap, nnimap-split-fancy and splitting functions
  2003-05-04 22:21 ` Ted Zlatanov
@ 2003-05-06 12:09   ` Eric Knauel
  2003-05-06 15:24     ` Ted Zlatanov
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Knauel @ 2003-05-06 12:09 UTC (permalink / raw)



Ted Zlatanov <tzz@lifelogs.com> writes:

> On Sun, 04 May 2003, knauel@informatik.uni-tuebingen.de wrote:
>> I'm trying to make nnimap-split-fancy run a function that sends the
>> mail received to an external program. 
>
> Look in spam.el in the latest Gnus for an example of how this is done,
> the bogofilter functionality runs the article through bogofilter to
> determine if it's spam or not.

Thanks for the hint; looking at spam-check-bogofilter was very
helpful. I'm trying to integerate with the rest of the stuff in
spam.el now. ;)

>> The gnus manual for nnmail-split-fancy (and nnimap-split-fancy) says
>> that the message in question can be found in nnmail-article-buffer
>> (` *nnmail incoming*'). However, there is no such buffer, when using
>> nnimap groups. The message in question seems to be in ` *nntpd*' --
>> is this the intended behaviour? Is it "dangerous" to work or modify
>> the ` *nntpd*' buffer?
>
> I always thought the split function was invoked with the article in
> the current buffer, so you just call (widen) and you're off to the
> races.  At least that's how spam-split in spam.el does it, and it
> works fine.  Make sure you set nnimap-split-download-body to get the
> full message body.

I don't know how it's supposed to be. The manual says the article
should be in ` *nnmail incoming*' (Node "Fancy Mail Splitting").

-Eric
-- 
"Excuse me --- Di Du Du Duuuuh Di Dii --- Huh Weeeheeee" (Albert King)




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

* Re: nnimap, nnimap-split-fancy and splitting functions
  2003-05-06 12:09   ` Eric Knauel
@ 2003-05-06 15:24     ` Ted Zlatanov
  0 siblings, 0 replies; 5+ messages in thread
From: Ted Zlatanov @ 2003-05-06 15:24 UTC (permalink / raw)


On Tue, 06 May 2003, knauel@informatik.uni-tuebingen.de wrote:
> Ted Zlatanov <tzz@lifelogs.com> writes:

>> I always thought the split function was invoked with the article in
>> the current buffer, so you just call (widen) and you're off to the
>> races.  At least that's how spam-split in spam.el does it, and it
>> works fine.  Make sure you set nnimap-split-download-body to get
>> the full message body.
> 
> I don't know how it's supposed to be. The manual says the article
> should be in ` *nnmail incoming*' (Node "Fancy Mail Splitting").

Right, but why does it matter? You're already in that buffer.  You can
call (buffer-name) if you need the buffer name, but what you said you
needed can be done without using the buffer name.

Ted



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

end of thread, other threads:[~2003-05-06 15:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-04  9:31 nnimap, nnimap-split-fancy and splitting functions Eric Knauel
2003-05-04 20:19 ` Simon Josefsson
2003-05-04 22:21 ` Ted Zlatanov
2003-05-06 12:09   ` Eric Knauel
2003-05-06 15:24     ` Ted Zlatanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).