A year and a while ago, Robert Fenk dripped support for multiple
display layouts onto the bleeding edge of BBDB.  At the time, he said:

> The old variables bbdb-elided-display and
> bbdb-pop-up-elided-display are obsolete now,
> but still supported by a wrapper.

Trying to catch up, I couldn't find a wrapper; my elided display
preferences no longer have any effect.  I've only now tried to emulate
the old elided-display behaviour using the new functionality - here's
how I think I do it:

  1. Start with the default value of bbdb-display-layout-alist.  

  2. If you used to set bbdb-elided-display to t, 
        (setq bbdb-display-layout 'one-line)

     otherwise 
        (setq bbdb-display-layout 'multi-line)

  3. If you used to set bbdb-elided-display to a list of field names
     to be left out of the listing, tweak the 'omit' option for the
     'multi-line' layout type in bbdb-display-layout-alist to contain
     those fields.  Make sure you use 'phones' and 'addresses' instead
     of 'phone' or 'address', though.

  4. If you want the pop-up BBDB buffer (as displayed by the mail and
     news interfaces) to display one line per record,
        (setq bbdb-pop-up-display-layout 'one-line)

     alternatively, if you want the pop-up buffer to use exactly
     the same formats as displayed by M-x bbdb etc,
        (setq bbdb-pop-up-display-layout 'bbdb-display-layout)

     and otherwise, when you want the pop-up display to show
     different fields from the normal M-x bbdb display,
        (setq bbdb-pop-up-display-layout 'pop-up-multi-line)
     and add a new layout name 'pop-up-multi-line' to the
     bbdb-display-layout-alist.

  5. If you used to set bbdb-pop-up-elided-display to a list of field
     names to be left out of the listing, set the 'omit' option of
     your 'pop-up-multi-line' layout type in bbdb-display-layout-alist
     to contain those fields.  Make sure you use 'phones' and
     'addresses' instead of 'phone' or 'address', though.

  6. If you used to set bbdb-pop-up-elided-display-fields to a list of
     field names to display, set the 'order' option of your
     'pop-up-multi-line' layout type in bbdb-display-layout-alist to
     contain those fields.  Make sure you use 'phones' and 'addresses'
     instead of 'phone' or 'address', though.


As a real example, my settings are currently something like this:

      (setq bbdb-display-layout-alist 
            '((one-line (order phones net)
                        (name-end . 24) (toggle . t))
              (multi-line (omit timestamp)
                          (order net phones addresses mail-alias notes t)
                          (toggle . t))    
              (pop-up-multi-line 
               (omit addresses phones timestamp aka)
               (toggle . nil))
              (full-multi-line (toggle . nil)))) 

      (setq bbdb-display-layout 'multi-line)
      (setq bbdb-pop-up-display-layout 'pop-up-multi-line)

This seems to get close enough to what I had before, and I haven't had
to write any bespoke formatting functions (but then, I didn't have any
before, which I might have done).  Of course, I can now also tweak the
order in which fields appear more precisely than I did before, which
is great.  Apart from this, in my haste to stand still, I haven't
really scratched the surface of what the new interface affords.


I'm using the current 'testing' Debian package (2.34.cvs20020819-1)
but I've also tried this out in yesterday's CVS tarball (see, Ronan, I
do have faith!) and found no differences in behaviour.


Now, some observations:

  There still seems to be confusion over 'phone' vs. 'phones' etc -
  the custom settings use one, the display-layout code seems to use
  the other.

  Setting bbdb-display-layout to non-nil, even when you want the
  default multi-line display, seems to fix a minor bug where
  bbdb-toggle-records-display-layout fails to do anything the first
  time you try to toggle in a new BBDB buffer.

  In using the 'pop-up-multi-line' layout it looks like I'm relying on
  vestigial code which ended up incompletely supported - but at least
  it saved me from having to write any new functions.  By far the best
  thing would be to add 'pop-up-multi-line' to the default
  bbdb-display-layout-alist and document it properly.

  It might be neat if layout types could inherit behaviour from each
  other - so you could define multi-line layout as being just the same
  as full-multi-line but with specific omissions, for example.  Not
  that I'm suggesting that every emacs package of sufficient
  complexity should end up reimplementing cc-mode, you understand...

  The instructions above are too complicated.  Upward compatibility is
  important (even if it's not as important as sensible defaults or
  coherent documentation).  And we really need some documentation on
  how to write your own formatting functions.


And lastly, a couple of questions:  

If a record has several phone fields, is there any way to get only a
subset of them in my layout?  For instance, imagine I want only
'office' phone numbers to appear in the pop-up listing - do I have to
write my own special purpose formatting function?

I haven't found out how (again, short of hacking the layout functions)
to get back the blank line which used to be between each multi-line
record in the BBDB buffer.  Could this be implemented as yet another
layout option?

Patrick



-------------------------------------------------------
This sf.net email is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en
_______________________________________________
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to