Re: To-From-Newsgroup and BBDB

2013-04-18 Thread Roland Winkler
On Wed Apr 17 2013 Vincent Beffara wrote:
> Finally flet is deprecated, and the suggested replacement cl-flet
> does lexical rather than dynamical meaning that it cannot do what
> I want.

For the "public code" of BBDB I have avoided cl completely.
But for your personal customization that's fine as long as you
understand what you do. And this should remain fine for many more
years, as cl has been around for so long.

Your code looks fine to me, too (as a personal customization of
gnus!). An alternative strategy would be to use the %u format
specifier for this. But I do not know enough about gnus internal to
see how involved that would be.

Roland


> A reasonable replacement is simply to overload the function
> gnus-summary-extract-address-component globally, it is only used
> in %f expansion. So, it might make sense to do this while
> insinuating gnus:
> 
> (require 'gnus-sum)
> (defun gnus-summary-extract-address-component (x)
>(bbdb-mua-summary-unify x))
> 
> and then using plain %f. There is also a gnus-extract-address-component
> which is used much more globally, and it might make sense to tweak that
> instead, but I'm a bit afraid of the unintented consequences and have
> little time to test this.
> 
> What do you think?

--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: To-From-Newsgroup and BBDB

2013-04-17 Thread Vincent Beffara

>> (defun gnus-user-format-function-f (header)
>>   (flet ((gnus-summary-extract-address-component 
>>   (x) (bbdb-mua-summary-unify x)))
>> (gnus-summary-from-or-to-or-newsgroups
>>   gnus-tmp-header gnus-tmp-from)))
>> 
>> It doesn't put the To: field through bbdb because of an 'inline' in the
>> gnus function, but that's basically fine, that field is generated from
>> the bbdb anyway most of the time.
>
> It looks like you know yet better than me the details of gnus to get
> what you want. -- bbdb-mua-summary-unify should come useful in more
> such cases.

Finally flet is deprecated, and the suggested replacement cl-flet does
lexical rather than dynamical meaning that it cannot do what I want. A
reasonable replacement is simply to overload the function
gnus-summary-extract-address-component globally, it is only used in %f
expansion. So, it might make sense to do this while insinuating gnus:

(require 'gnus-sum)
(defun gnus-summary-extract-address-component (x)
   (bbdb-mua-summary-unify x))

and then using plain %f. There is also a gnus-extract-address-component
which is used much more globally, and it might make sense to tweak that
instead, but I'm a bit afraid of the unintented consequences and have
little time to test this.

What do you think?

 /v

-- 
Vincent Beffara

--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: To-From-Newsgroup and BBDB

2013-04-16 Thread Roland Winkler
On Tue Apr 16 2013 Vincent Beffara wrote:
> (defun gnus-user-format-function-f (header)
>   (flet ((gnus-summary-extract-address-component 
>   (x) (bbdb-mua-summary-unify x)))
> (gnus-summary-from-or-to-or-newsgroups
>   gnus-tmp-header gnus-tmp-from)))
> 
> It doesn't put the To: field through bbdb because of an 'inline' in the
> gnus function, but that's basically fine, that field is generated from
> the bbdb anyway most of the time.

It looks like you know yet better than me the details of gnus to get
what you want. -- bbdb-mua-summary-unify should come useful in more
such cases.

Roland

--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: To-From-Newsgroup and BBDB

2013-04-16 Thread Vincent Beffara

Hi,

>> What would be wonderful would be to combine the two, i.e. first
>> determine if the message is from me or from somebody else like %f does,
>> and then once the correct address for display is chosen, look it up in
>> the db like %uB does.
>
> I am sorry, in BBDB v3 there is currently nothing beyond
> bbdb-mua-summary-unify and the customization that goes with it.
> You need to extend gnus-user-format-function-B defined in
> bbdb-insinuate-gnus. The code should be sufficiently modular for
> that.

Actually I went the other way, like this:

(defun gnus-user-format-function-f (header)
  (flet ((gnus-summary-extract-address-component 
  (x) (bbdb-mua-summary-unify x)))
(gnus-summary-from-or-to-or-newsgroups
  gnus-tmp-header gnus-tmp-from)))

It doesn't put the To: field through bbdb because of an 'inline' in the
gnus function, but that's basically fine, that field is generated from
the bbdb anyway most of the time.

Now I understand why lisp was a good choice :-)

Cheers,

/v

-- 
Vincent Beffara

--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: To-From-Newsgroup and BBDB

2013-04-16 Thread Roland Winkler
On Tue Apr 16 2013 Vincent Beffara wrote:
> For some reason this reply wont go through to the mailing list ... Maybe
> it will eventually and there will be 2 copies, sorry if that happens!
> 
> >> Is there a way to combine BBDB with the functionality of %f in summary
> >> buffers (displaying the recipient if the mail is from me, with a nice
> >> "-> " in front) ?
> >
> > What is BBDB supposed to contribute here? I do not understand what
> > you want to achieve.
> 
> Sorry for not being clear, let me provide some context here. In Gnus,
> summary buffers provide a list of messages in a given mailbox/feed and
> this is of course customizable. Typically, you would put the date, the
> subject, and the author of the message. But for your own messages, it is
> much more convenient to display the recipient instead, with some
> graphical indication that this is what is shown. Typically, this would
> be done by prefixing something like "-> " to the displayed name.
> 
> This is all done automatically by Gnus, the %f formatting code does
> exactly this, using a regexp match (gnus-ignored-from-addresses) to the
> From: field to determine whether you are the author.
> 
> OTOH, Gnus only uses information contained in the message. If the From:
> field contains no full name, for instance, the email address is
> displayed instead. This is where BBDB can help, by looking up the
> address and replacing it with the full name from the db - looks much
> neater this way. This is achieved by the %uB code. In addition, one gets
> an indicator of whether the author is in the db or not, typically a '+'
> in front of the name.
> 
> What would be wonderful would be to combine the two, i.e. first
> determine if the message is from me or from somebody else like %f does,
> and then once the correct address for display is chosen, look it up in
> the db like %uB does.

I am sorry, in BBDB v3 there is currently nothing beyond
bbdb-mua-summary-unify and the customization that goes with it.
You need to extend gnus-user-format-function-B defined in
bbdb-insinuate-gnus. The code should be sufficiently modular for
that.

Roland

--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: To-From-Newsgroup and BBDB

2013-04-15 Thread Roland Winkler
On Mon Apr 15 2013 Vincent Beffara wrote:
> Is there a way to combine BBDB with the functionality of %f in summary
> buffers (displaying the recipient if the mail is from me, with a nice
> "-> " in front) ?

What is BBDB supposed to contribute here? I do not understand what
you want to achieve.

--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/