Gnus development mailing list
 help / color / mirror / Atom feed
* gnus-summary-copy-article: choose group based on sender?
@ 2003-02-20  4:47 Graham Guttocks
  2003-02-20 10:22 ` Kai Großjohann
  0 siblings, 1 reply; 14+ messages in thread
From: Graham Guttocks @ 2003-02-20  4:47 UTC (permalink / raw)


Greetings,

I gather that `gnus-move-split-methods' is what I need to customize in
order to influence the group name chosen when copying articles.

Does anyone have a definition of `gnus-move-split-methods' which picks
the destination group based on the article's sender? (i.e, LHS of the
e-mail address)

Or, put another way, how do I get access to the sender name from within 
a `gnus-move-split-methods' definition?

=====
Regards,
Graham

http://mobile.yahoo.com.au - Yahoo! Mobile
- Exchange IMs with Messenger friends on your Telstra or Vodafone mobile phone.



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

* Re: gnus-summary-copy-article: choose group based on sender?
  2003-02-20  4:47 gnus-summary-copy-article: choose group based on sender? Graham Guttocks
@ 2003-02-20 10:22 ` Kai Großjohann
  2003-02-20 16:51   ` Graham Guttocks
  0 siblings, 1 reply; 14+ messages in thread
From: Kai Großjohann @ 2003-02-20 10:22 UTC (permalink / raw)


Graham Guttocks <graham_guttocks@yahoo.co.nz> writes:

> Or, put another way, how do I get access to the sender name from within 
> a `gnus-move-split-methods' definition?

It seems that entries like ("^From:.*jrl@" "nnml:to-jrl") might do
the trick.
-- 
A preposition is not a good thing to end a sentence with.



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

* Re: gnus-summary-copy-article: choose group based on sender?
  2003-02-20 10:22 ` Kai Großjohann
@ 2003-02-20 16:51   ` Graham Guttocks
  2003-02-20 18:26     ` David S Goldberg
  0 siblings, 1 reply; 14+ messages in thread
From: Graham Guttocks @ 2003-02-20 16:51 UTC (permalink / raw)


Kai Großjohann <kai.grossjohann@uni-duisburg.de> wrote: 
>
> > Or, put another way, how do I get access to the sender name from within 
> > a `gnus-move-split-methods' definition?
> 
> It seems that entries like ("^From:.*jrl@" "nnml:to-jrl") might do
> the trick.

This isn't dynamic enough. I'd have to have an entry for every
possible sender. I'm looking for something like this:

(".*" "nnml:$SENDER")

Where $SENDER is the LHS of the sender e-mail address. e.g, 
nnml:kai.grossjohann

I know the above syntax isn't right, but hopefully it will
illustrate my point.

=====
Regards,
Graham

http://mobile.yahoo.com.au - Yahoo! Mobile
- Exchange IMs with Messenger friends on your Telstra or Vodafone mobile phone.



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

* Re: gnus-summary-copy-article: choose group based on sender?
  2003-02-20 16:51   ` Graham Guttocks
@ 2003-02-20 18:26     ` David S Goldberg
  2003-02-20 19:19       ` Graham Guttocks
  2003-02-20 20:25       ` Kai Großjohann
  0 siblings, 2 replies; 14+ messages in thread
From: David S Goldberg @ 2003-02-20 18:26 UTC (permalink / raw)


I have gnus-move-split-methods set to this:

(((lambda (arg)
    (let ((grp (dsg-get-appropriate-group arg)))
      (cond ((stringp grp)
             (list grp))
            ((listp grp)
             grp)
            t "nnimap+linus:INBOX.in-box")))))

Where arg is the name of the group (I think that's in the info since
it's not in the documentation string).  dsg-get-appropriate-group is
an overly complicated function.  It relies on the fact that the
function is run with current-buffer set to the article (or maybe
original article; I forget).  You don't want my definition of it,
which has a lot of my work stuff hard coded.  It's easy enough to
search for a given header and dynamically return a group name based on
it.  If the group doesn't exist, you will be prompted to create it
when you confirm the copy/move.

-- 
Dave Goldberg
david.goldberg6@verizon.net





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

* Re: gnus-summary-copy-article: choose group based on sender?
  2003-02-20 18:26     ` David S Goldberg
@ 2003-02-20 19:19       ` Graham Guttocks
  2003-02-20 20:04         ` David S Goldberg
  2003-02-20 20:24         ` Kai Großjohann
  2003-02-20 20:25       ` Kai Großjohann
  1 sibling, 2 replies; 14+ messages in thread
From: Graham Guttocks @ 2003-02-20 19:19 UTC (permalink / raw)


David S Goldberg <david.goldberg6@verizon.net> wrote:
>
> It's easy enough to search for a given header and dynamically 
> return a group name based on it.

Well, this is my question. It's not obvious to me how I would
do this. A documentation pointer would be fine too if such a 
thing exists.

=====
Regards,
Graham

http://mobile.yahoo.com.au - Yahoo! Mobile
- Exchange IMs with Messenger friends on your Telstra or Vodafone mobile phone.



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

* Re: gnus-summary-copy-article: choose group based on sender?
  2003-02-20 19:19       ` Graham Guttocks
@ 2003-02-20 20:04         ` David S Goldberg
  2003-02-20 21:39           ` Graham Guttocks
  2003-02-20 20:24         ` Kai Großjohann
  1 sibling, 1 reply; 14+ messages in thread
From: David S Goldberg @ 2003-02-20 20:04 UTC (permalink / raw)


>>>>> On Fri, 21 Feb 2003 08:19:56 +1300 (NZDT), Graham Guttocks
>>>>> <graham_guttocks@yahoo.co.nz> said:

> David S Goldberg <david.goldberg6@verizon.net> wrote:
>> 
>> It's easy enough to search for a given header and dynamically 
>> return a group name based on it.

> Well, this is my question. It's not obvious to me how I would
> do this. A documentation pointer would be fine too if such a 
> thing exists.

See the function mail-fetch-field to get the value of a given field.
Then use concat to construct a group name based on that value and
return it.
-- 
Dave Goldberg
david.goldberg6@verizon.net





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

* Re: gnus-summary-copy-article: choose group based on sender?
  2003-02-20 19:19       ` Graham Guttocks
  2003-02-20 20:04         ` David S Goldberg
@ 2003-02-20 20:24         ` Kai Großjohann
  1 sibling, 0 replies; 14+ messages in thread
From: Kai Großjohann @ 2003-02-20 20:24 UTC (permalink / raw)


Graham Guttocks <graham_guttocks@yahoo.co.nz> writes:

> Well, this is my question. It's not obvious to me how I would
> do this. A documentation pointer would be fine too if such a 
> thing exists.

M-x apropos RET fetch-field RET
-- 
A preposition is not a good thing to end a sentence with.



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

* Re: gnus-summary-copy-article: choose group based on sender?
  2003-02-20 18:26     ` David S Goldberg
  2003-02-20 19:19       ` Graham Guttocks
@ 2003-02-20 20:25       ` Kai Großjohann
  1 sibling, 0 replies; 14+ messages in thread
From: Kai Großjohann @ 2003-02-20 20:25 UTC (permalink / raw)


David S Goldberg <david.goldberg6@verizon.net> writes:

> Where arg is the name of the group (I think that's in the info since
> it's not in the documentation string).

The docs for gnus-move-split-methods point to gnus-split-methods, and
its docstring has the info.
-- 
A preposition is not a good thing to end a sentence with.



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

* Re: gnus-summary-copy-article: choose group based on sender?
  2003-02-20 20:04         ` David S Goldberg
@ 2003-02-20 21:39           ` Graham Guttocks
  2003-02-21 15:39             ` Kai Großjohann
  0 siblings, 1 reply; 14+ messages in thread
From: Graham Guttocks @ 2003-02-20 21:39 UTC (permalink / raw)


David S Goldberg <david.goldberg6@verizon.net> wrote: 
>
> See the function mail-fetch-field to get the value of a given field.
> Then use concat to construct a group name based on that value and
> return it.

Ugh, I'm really struggling here. This is what I have, but something
isn't quite right:

(setq gnus-move-split-methods
      '((".*" (lambda ()
		(concat "saved." (mail-fetch-field "from"))
		"nnml:"))))


=====
Regards,
Graham

http://mobile.yahoo.com.au - Yahoo! Mobile
- Exchange IMs with Messenger friends on your Telstra or Vodafone mobile phone.



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

* Re: gnus-summary-copy-article: choose group based on sender?
  2003-02-20 21:39           ` Graham Guttocks
@ 2003-02-21 15:39             ` Kai Großjohann
  2003-02-25  2:10               ` Graham Guttocks
  0 siblings, 1 reply; 14+ messages in thread
From: Kai Großjohann @ 2003-02-21 15:39 UTC (permalink / raw)


Graham Guttocks <graham_guttocks@yahoo.co.nz> writes:

> Ugh, I'm really struggling here. This is what I have, but something
> isn't quite right:
>
> (setq gnus-move-split-methods
>       '((".*" (lambda ()
> 		(concat "saved." (mail-fetch-field "from"))
> 		"nnml:"))))

Hm.  First, you concat "saved." and the from header, then you throw
that data away.  Then the function returns the string "nnml:".

Maybe you meant this:

    (concat "saved."
            (mail-fetch-field "from")
            "nnml:")

Suppose the From header is "Kai Grossjohann <kai@frob.org>", then the
above will produce a group name like this:

    saved.Kai Grossjohann <kai@frob.org>nnml:

It looks weird.  There is a function mail-header-parse-address, btw,
such that

    (mail-header-parse-address "Kai Grossjohann <kai@frob.org>")

will return 

    ("kai@frob.org" . "Kai Grossjohann")

which appears somewhat more useful :-)

Does this help?  (Give a man a fish... teach... you know...)
-- 
A preposition is not a good thing to end a sentence with.



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

* Re: gnus-summary-copy-article: choose group based on sender?
  2003-02-21 15:39             ` Kai Großjohann
@ 2003-02-25  2:10               ` Graham Guttocks
  2003-02-25  6:51                 ` Kai Großjohann
  0 siblings, 1 reply; 14+ messages in thread
From: Graham Guttocks @ 2003-02-25  2:10 UTC (permalink / raw)
  Cc: ding

Kai Großjohann <kai.grossjohann@uni-duisburg.de> wrote: 
>
> It looks weird.  There is a function mail-header-parse-address, btw,
> such that
>
>     (mail-header-parse-address "Kai Grossjohann <kai@frob.org>")
>
> will return 
>
>     ("kai@frob.org" . "Kai Grossjohann")
>
> which appears somewhat more useful :-)
>
> Does this help?

It does help, thanks.  Now the problem is that my News directory is
being prepended to the group name.  For example,

/home/graham/News/nnml:save.kai@frob.org

This is what I have in my .gnus:

(defun sender-save-name (group)
  (concat "nnml:save."
	  (car (mail-header-parse-address 
		(mail-fetch-field "from")))))

(setq gnus-move-split-methods
      '((sender-save-name)))

Why is the News directory even in the picture, and how can I get rid
of it?  I just want the literal "nnml:save.kai@frob.org". 

=====
Regards,
Graham

http://mobile.yahoo.com.au - Yahoo! Mobile
- Exchange IMs with Messenger friends on your Telstra or Vodafone mobile phone.



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

* Re: gnus-summary-copy-article: choose group based on sender?
  2003-02-25  2:10               ` Graham Guttocks
@ 2003-02-25  6:51                 ` Kai Großjohann
  2003-02-25 18:15                   ` Graham Guttocks
  0 siblings, 1 reply; 14+ messages in thread
From: Kai Großjohann @ 2003-02-25  6:51 UTC (permalink / raw)
  Cc: ding

Graham Guttocks <graham_guttocks@yahoo.co.nz> writes:

> This is what I have in my .gnus:
>
> (defun sender-save-name (group)
>   (concat "nnml:save."
> 	  (car (mail-header-parse-address 
> 		(mail-fetch-field "from")))))
>
> (setq gnus-move-split-methods
>       '((sender-save-name)))
>
> Why is the News directory even in the picture, and how can I get rid
> of it?  I just want the literal "nnml:save.kai@frob.org". 

There are variables gnus-split-methods and gnus-move-split-methods,
where the former specifies filenames (for the `o' command, I guess)
and the latter specifies group names (for `B m').

The above behavior could be explained if you have set
gnus-split-methods to a similar value and use `o' or one of the `O'
commands instead of `B m'.

If that wasn't it, I have no idea.
-- 
A preposition is not a good thing to end a sentence with.



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

* Re: gnus-summary-copy-article: choose group based on sender?
  2003-02-25  6:51                 ` Kai Großjohann
@ 2003-02-25 18:15                   ` Graham Guttocks
  2003-02-25 20:25                     ` Kai Großjohann
  0 siblings, 1 reply; 14+ messages in thread
From: Graham Guttocks @ 2003-02-25 18:15 UTC (permalink / raw)
  Cc: ding

Kai Großjohann <kai.grossjohann@uni-duisburg.de> wrote: 
>
> > (defun sender-save-name (group)
> >   (concat "nnml:save."
> > 	  (car (mail-header-parse-address 
> > 		(mail-fetch-field "from")))))
> >
> > (setq gnus-move-split-methods
> >       '((sender-save-name)))
> >
> > Why is the News directory even in the picture, and how can I get rid
> > of it?  I just want the literal "nnml:save.kai@frob.org". 
> 
> There are variables gnus-split-methods and gnus-move-split-methods,
> where the former specifies filenames (for the `o' command, I guess)
> and the latter specifies group names (for `B m').
> 
> The above behavior could be explained if you have set
> gnus-split-methods to a similar value and use `o' or one of the `O'
> commands instead of `B m'.

I haven't set gnus-split-methods.  gnus-move-split-methods is set
as shown above.  I'm not using `o' or `O', but rather `B c', and 
I'm still seeing the ~/News directory prepended to the group name.

At this point, it's almost beyond imagination that something this
seemingly simple has consumed so much time and effort.

=====
Regards,
Graham

http://mobile.yahoo.com.au - Yahoo! Mobile
- Exchange IMs with Messenger friends on your Telstra or Vodafone mobile phone.



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

* Re: gnus-summary-copy-article: choose group based on sender?
  2003-02-25 18:15                   ` Graham Guttocks
@ 2003-02-25 20:25                     ` Kai Großjohann
  0 siblings, 0 replies; 14+ messages in thread
From: Kai Großjohann @ 2003-02-25 20:25 UTC (permalink / raw)
  Cc: ding

Graham Guttocks <graham_guttocks@yahoo.co.nz> writes:

> I haven't set gnus-split-methods.  gnus-move-split-methods is set
> as shown above.  I'm not using `o' or `O', but rather `B c', and 
> I'm still seeing the ~/News directory prepended to the group name.

I'm flabbergasted.

Does anyone have an idea?

The next thing to do would be to find where gnus-move-split-methods
is accessed (or what does gnus-summary-move-article do), then do M-x
edebug-defun RET on that function, then watch it compute the wrong
result.

> At this point, it's almost beyond imagination that something this
> seemingly simple has consumed so much time and effort.

Reality surpasses our wildest dreams sometimes...
-- 
A preposition is not a good thing to end a sentence with.



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

end of thread, other threads:[~2003-02-25 20:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-20  4:47 gnus-summary-copy-article: choose group based on sender? Graham Guttocks
2003-02-20 10:22 ` Kai Großjohann
2003-02-20 16:51   ` Graham Guttocks
2003-02-20 18:26     ` David S Goldberg
2003-02-20 19:19       ` Graham Guttocks
2003-02-20 20:04         ` David S Goldberg
2003-02-20 21:39           ` Graham Guttocks
2003-02-21 15:39             ` Kai Großjohann
2003-02-25  2:10               ` Graham Guttocks
2003-02-25  6:51                 ` Kai Großjohann
2003-02-25 18:15                   ` Graham Guttocks
2003-02-25 20:25                     ` Kai Großjohann
2003-02-20 20:24         ` Kai Großjohann
2003-02-20 20:25       ` Kai Großjohann

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).