Re: upgrading to v 3

2011-12-29 Thread Roland Winkler
On Wed Dec 28 2011 Sam Steingold wrote:
 here is the fix:
 
 diff --git a/lisp/bbdb-mua.el b/lisp/bbdb-mua.el
 index e0059a1..2d515ab 100644
 --- a/lisp/bbdb-mua.el
 +++ b/lisp/bbdb-mua.el
 @@ -657,7 +657,8 @@ For interactive calls, see function
 `bbdb-mua-update-interactive-p'.
(interactive (list nil (bbdb-mua-update-interactive-p)))
(let (records)
  (bbdb-mua-wrapper
 - (setq records (bbdb-mua-update-records header-class update-p)))
 + (setq records (bbdb-mua-update-records
 +header-class (or update-p bbdb-mua-auto-update-p
  (if records (bbdb-display-records-internal records))
  records))

I am confused: What is this patch supposed to fix? Where / how is
bbdb-mua-display-records called such that it needs to use the
variable bbdb-mua-auto-update-p? The command
bbdb-mua-display-records is intended for interactive use, whereas
the variable bbdb-mua-auto-update-p and the function
bbdb-mua-auto-update are intended for noninteractive use. 

If the command bbdb-mua-display-records is used in some
noninteractive context, it appears to me it would be the cleaner
(more flexible) solution if the caller of bbdb-mua-display-records
sets its arg UPDATE-P appropriately. But anyway, such noninteractive
use should call bbdb-mua-auto-update.

Roland

--
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: bbdb-check-auto-save-file is broken

2011-12-29 Thread Roland Winkler
On Wed Dec 28 2011 Sam Steingold wrote:
 If I set bbdb-check-auto-save-file to t, modify the db and not save it
 right away, I am asked all the time about recovering bbdb from the auto
 save file.
 with v2, I was asked this only when bbdb was first loaded, which was useful.

This is one of the old features of BBDB where it is not clear to me
which problem they are supposed to address and what solution they
are supposed to provide. Under what conditions do you have an
auto-save file that is newer than your bbdb-file? In your opinion,
what would be a meaningful thing to do here, and why?

Roland

--
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: upgrading to v 3

2011-12-29 Thread Sam Steingold
 * Roland Winkler jvax...@tah.bet [2011-12-29 02:36:33 -0600]:

 On Wed Dec 28 2011 Sam Steingold wrote:
 here is the fix:
 
 diff --git a/lisp/bbdb-mua.el b/lisp/bbdb-mua.el
 index e0059a1..2d515ab 100644
 --- a/lisp/bbdb-mua.el
 +++ b/lisp/bbdb-mua.el
 @@ -657,7 +657,8 @@ For interactive calls, see function
 `bbdb-mua-update-interactive-p'.
(interactive (list nil (bbdb-mua-update-interactive-p)))
(let (records)
  (bbdb-mua-wrapper
 - (setq records (bbdb-mua-update-records header-class update-p)))
 + (setq records (bbdb-mua-update-records
 +header-class (or update-p bbdb-mua-auto-update-p
  (if records (bbdb-display-records-internal records))
  records))

 I am confused: What is this patch supposed to fix? Where / how is
 bbdb-mua-display-records called such that it needs to use the
 variable bbdb-mua-auto-update-p?

because of
(add-hook 'gnus-article-prepare-hook 'bbdb-mua-display-sender)

I guess I will try without it...

thanks.

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://www.memritv.org http://pmw.org.il http://thereligionofpeace.com
http://dhimmi.com http://iris.org.il http://openvotingconsortium.org
The best propaganda of atheism is done by organized religion.


--
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: v3 window splitting: problem

2011-12-29 Thread Roland Winkler
On Wed Dec 28 2011 Sam Steingold wrote:
  * Sam Steingold f...@tah.bet [2011-12-28 12:44:25 -0500]:
 
  When I use the tall display, the *BBDB* window is vertical
  (i.e., it is split sideways, which is precisely what I want)
  When I use the wide display, the *BBDB* window is horizontal
  (i.e., it is split on the bottom top of another windows,
  which is _NOT_ what I want).
 
 I still have the problem, but now it's the other way around: wide
 display is split according to bbdb-message-pop-up == horiz and the tall
 display ignores is.
 The only difference I see is that after I restarted emacs, the first
 frame is tall and the second is wide.
 I.e., it appears that bbdb-message-pop-up is ignored in the first frame.
 
 Still confused...

Have you looked at bbdb-horiz-pop-up-window-size?

The new code for horizontal window splitting should give you the
same behavior as the old code, except for hard-coded numbers being
replaced by the user variable bbdb-horiz-pop-up-window-size.

Yet part of the problem might be that different people might have
different expectations what they consider meaningful and appropriate
here. If you have some ideas how to improve the code for everybody,
they will be appreciated.

Roland

--
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: v3 window splitting: problem

2011-12-29 Thread Sam Steingold
 * Roland Winkler jvax...@tah.bet [2011-12-29 04:31:47 -0600]:

 On Wed Dec 28 2011 Sam Steingold wrote:
  * Sam Steingold f...@tah.bet [2011-12-28 12:44:25 -0500]:
 
  When I use the tall display, the *BBDB* window is vertical
  (i.e., it is split sideways, which is precisely what I want)
  When I use the wide display, the *BBDB* window is horizontal
  (i.e., it is split on the bottom top of another windows,
  which is _NOT_ what I want).
 
 I still have the problem, but now it's the other way around: wide
 display is split according to bbdb-message-pop-up == horiz and the tall
 display ignores is.
 The only difference I see is that after I restarted emacs, the first
 frame is tall and the second is wide.
 I.e., it appears that bbdb-message-pop-up is ignored in the first frame.

nope, it is now appears to be completely unpredictable...

 Have you looked at bbdb-horiz-pop-up-window-size?

yes, it looks fine.
all my frames are big enough to be split horizontally.

 The new code for horizontal window splitting should give you the
 same behavior as the old code, except for hard-coded numbers being
 replaced by the user variable bbdb-horiz-pop-up-window-size.

I did not use the old code.

 Yet part of the problem might be that different people might have
 different expectations what they consider meaningful and appropriate
 here. If you have some ideas how to improve the code for everybody,
 they will be appreciated.

Okay, here is the patch.
It makes bbdb-pop-up-window IGNORE the horiz-p argument which I do not
understand and it makes it split horizontally the tallest window.
It seems to force the horizontal behavior when I want it.

diff --git a/lisp/bbdb.el b/lisp/bbdb.el
index 87f6c9f..4dc6a08 100644
--- a/lisp/bbdb.el
+++ b/lisp/bbdb.el
@@ -2982,6 +2982,13 @@ The *BBDB* buffer must be current when this is called.
 
 
 
+(defun bbdb-tallest-window ()
+  Find the tallest window.
+  (let ((tallest-window (selected-window)))
+(dolist (window (window-list) tallest-window)
+  (when ( (window-height window) (window-height tallest-window))
+(setq tallest-window window)
+
 ;;; window configuration hackery
 (defun bbdb-pop-up-window (optional select horiz-p)
   Find the largest window on the screen, and split it, displaying the
@@ -2997,25 +3004,21 @@ will be split vertically rather than horizontally.
 
 ;; try horizontal split
 ((and (eq bbdb-message-pop-up 'horiz)
-  horiz-p
   (= (frame-width) (car bbdb-horiz-pop-up-window-size))
   (let ((cbuffer (current-buffer))
-(window-list (window-list))
 (selected-window (selected-window))
 (b-width (cdr bbdb-horiz-pop-up-window-size))
-(search t) window)
-(while (and (setq window (pop window-list))
-(setq search (funcall horiz-p window
-(unless (or search (= (window-width window)
-   (car bbdb-horiz-pop-up-window-size)))
-  (select-window window)
+(tallest-window (bbdb-tallest-window)))
+(when ( (window-width tallest-window)
+ (car bbdb-horiz-pop-up-window-size))
+  (select-window tallest-window)
   (condition-case nil ; `split-window-horizontally' might fail
   (progn
 (split-window-horizontally
  (if (integerp b-width)
- (- (window-width window) b-width)
-   (round (* (- 1 b-width) (window-width window)
-(select-window (next-window window))
+ (- (window-width tallest-window) b-width)
+   (round (* (- 1 b-width) (window-width 
tallest-window)
+(select-window (next-window tallest-window))
 (let (pop-up-windows)
   (switch-to-buffer (get-buffer-create 
bbdb-buffer-name)))
 (unless select
@@ -3027,11 +3030,7 @@ will be split vertically rather than horizontally.
 (t ;; vertical split
  (let* ((cbuffer (current-buffer))
 (selected-window (selected-window))
-(tallest-window selected-window))
-   ;; find the tallest window...
-   (dolist (window (window-list))
- (if ( (window-height window) (window-height tallest-window))
- (setq tallest-window window)))
+(tallest-window (bbdb-tallest-window)))
(select-window tallest-window)   ; select it and split it...
(if (eql bbdb-pop-up-window-size 1.0)
;; select `bbdb-buffer-name'



-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://mideasttruth.com http://iris.org.il http://memri.org

Re: v3 window splitting: problem

2011-12-29 Thread Sam Steingold
here is the complete patch:
basically, I sacrifice the failed attempt to only split the mua windows
for the sake of robustness.

diff --git a/ChangeLog b/ChangeLog
index 6bbbe47..29b211c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-12-29  Sam Steingold  s...@gnu.org
+   * lisp/bbdb.el (bbdb-display-records)
+   (bbdb-display-records-internal): Do not accept horiz-p.
+   (bbdb-tallest-window): Extract from `bbdb-pop-up-window'.
+   (bbdb-pop-up-window): Do not accept horiz-p; always split the
+   tallest window when possible, whether horizontally or vertically.
+   * lisp/bbdb-mua.el (bbdb-mua-auto-update):
+   Do not pass horiz-p to `bbdb-display-records-internal'.
+
 2011-12-28  Sam Steingold  s...@gnu.org
* lisp/bbdb.el (bbdb-pop-up-window):
Shrink the vertical *BBDB* window when possible.
diff --git a/lisp/bbdb-mua.el b/lisp/bbdb-mua.el
index e0059a1..2f93b6f 100644
--- a/lisp/bbdb-mua.el
+++ b/lisp/bbdb-mua.el
@@ -786,22 +786,11 @@ See `bbdb-mua-display-records' and friends for 
interactive commands.
  (records (bbdb-mua-update-records header-class
(or update-p
bbdb-mua-auto-update-p
-(if bbdb-message-pop-up
-(let* ((mua (bbdb-mua))
-   (mode (cond ((eq mua 'vm) 'vm-mode)
-   ((eq mua 'gnus) 'gnus-article-mode)
-   ((eq mua 'rmail) 'rmail-mode)
-   ((eq mua 'mh) 'mh-folder-mode)
-   ((eq mua 'message) 'message-mode)
-   ((eq mua 'mail) 'mail-mode
-  (if records
-  (bbdb-display-records-internal
-   records nil nil nil
-   `(lambda (window)
-  (with-current-buffer (window-buffer window)
-(eq major-mode ',mode
-;; If there are no records, empty the BBDB window.
-(bbdb-undisplay-records
+(when bbdb-message-pop-up
+  (if records
+  (bbdb-display-records-internal records)
+;; If there are no records, empty the BBDB window.
+(bbdb-undisplay-records)))
 records))
 
 ;; Should the following be replaced by a minor mode??
diff --git a/lisp/bbdb.el b/lisp/bbdb.el
index 87f6c9f..ab6ace2 100644
--- a/lisp/bbdb.el
+++ b/lisp/bbdb.el
@@ -2801,7 +2801,7 @@ Move point to the end of the inserted record.
   (put-text-property beg (point) 'bbdb-record-number number
 
 (defun bbdb-display-records (optional records layout append
-   select horiz-p electric-p)
+   select electric-p)
   Display RECORDS using LAYOUT.
   (interactive (list (bbdb-completing-read-records Display records: )
  (bbdb-layout-prefix)))
@@ -2812,14 +2812,13 @@ Move point to the end of the inserted record.
 (progn
   (define-key bbdb-mode-map   'bbdb-electric-done)
   (bbdb-electric-display-records records))
-  (bbdb-display-records-internal records layout append select horiz-p)
+  (bbdb-display-records-internal records layout append select)
   ;; do not smash keybinding if they invoked `bbdb-display'
   ;; from inside an electric loop.
   (unless bbdb-inside-electric-display
 (define-key bbdb-mode-map   'undefined)
 
-(defun bbdb-display-records-internal (records optional layout append
-  select horiz-p)
+(defun bbdb-display-records-internal (records optional layout append select)
   Low-level function overlooking the setup of the *BBDB* buffer.
   (if (bbdb-append-display-p) (setq append t))
 
@@ -2852,7 +2851,7 @@ Move point to the end of the inserted record.
 (set (make-local-variable 'bbdb-buffer-name) new-name)
 
 (unless (get-buffer-window bbdb-buffer-name)
-  (bbdb-pop-up-window select horiz-p))
+  (bbdb-pop-up-window select))
 (set-buffer bbdb-buffer-name) ;; *BBDB*
 
 ;; If we're appending RECORDS to the ones already displayed,
@@ -2982,40 +2981,43 @@ The *BBDB* buffer must be current when this is called.
 
 
 
+(defun bbdb-tallest-window ()
+  Find the tallest window.
+  (let ((tallest-window (selected-window)))
+(dolist (window (window-list) tallest-window)
+  (when ( (window-height window) (window-height tallest-window))
+(setq tallest-window window)
+
 ;;; window configuration hackery
-(defun bbdb-pop-up-window (optional select horiz-p)
+(defun bbdb-pop-up-window (optional select)
   Find the largest window on the screen, and split it, displaying the
 *BBDB* buffer in the bottom `bbdb-pop-up-window-size' lines (unless
 the *BBDB* buffer is already visible, in which case do nothing.)
 Select this window if SELECT is non-nil.
 
-If `bbdb-message-pop-up' is 'horiz, and the first window matching
-HORIZ-P is sufficiently wide ( 112 

v3: how do I edit the organization?

2011-12-29 Thread Sam Steingold
with v2, I would hit RET or 'e' on the name field and would be offered
to edit first the name and then the organization (company).
now I am just offered the name.
how do I enter the organization?
-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://iris.org.il http://openvotingconsortium.org http://pmw.org.il
http://truepeace.org http://www.PetitionOnline.com/tap12009/
Democracy is like a car: you can ride it or you can run people over with it.


--
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: bbdb-check-auto-save-file is broken

2011-12-29 Thread Roland Winkler
On Thu Dec 29 2011 Sam Steingold wrote:
  * Roland Winkler jvax...@tah.bet [2011-12-29 02:48:14 -0600]:
  On Wed Dec 28 2011 Sam Steingold wrote:
  If I set bbdb-check-auto-save-file to t, modify the db and not
  save it right away, I am asked all the time about recovering
  bbdb from the auto save file. with v2, I was asked this only
  when bbdb was first loaded, which was useful.
 
  This is one of the old features of BBDB where it is not clear to me
  which problem they are supposed to address and what solution they are
  supposed to provide. Under what conditions do you have an auto-save
  file that is newer than your bbdb-file? In your opinion, what would be
  a meaningful thing to do here, and why?
 
 The idea was that you modify the db as you read news and you might
 forget to save it when done reading the news/mail.
 That was raison d'etre for bbdb-offer-save which you removed - offer to
 save the db when done reading news/mail.

I am still confused. Why is the current behavior not appropriate for
your needs? If BBDB detects that you have an auto-save-file that is
newer than bbdb-file, why is it not OK to save it and then go on?

(When I read once more your first post above, it appears to me that
then you were expecting something different from what you are
expecting now. Apologies for my confusion!)

Roland

--
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: upgrading to v 3

2011-12-29 Thread Sam Steingold
 * Sam Steingold f...@tah.bet [2011-12-27 13:19:50 -0500]:

 2. I want to avoid putting the email uid into the first name slot.
I.e., when creating a record for f...@bar.com, I want the names to
be void, not foo .
As a first step, I tried to find all such records I have:

 (defun address-name (address)
   (if (string-match @ address)
   (substring address 0 (match-beginning 0))
   address))

 (with-current-buffer (find-file-noselect bbdb-file)
   (dolist (rec bbdb-records)
 (when (and (equal (bbdb-record-lastname rec) )
(find (bbdb-record-firstname rec) (bbdb-record-mail rec)
  :key 'address-name :test 'equal))
   (print rec

Now, my question is: how do I modify these records?

   (setf (bbdb-record-lastname rec) nil
 (bbdb-record-firstname rec) nil)

   does not work.
   Thanks.

 The setters are:

 bbdb-record-set-lastname
 bbdb-record-set-firstname

 Will using them propagate to bbdb-file when I do bbdb-save?
 Presumably, yes, I am just trying to make sure...

nope.
so, how do transfer the changes effected by bbdb-record-set-firstname et
al into the bbdb-file?

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://ffii.org http://memri.org http://honestreporting.com
http://thereligionofpeace.com http://www.memritv.org http://palestinefacts.org
We are born naked, wet, and hungry.  Then things get worse.


--
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: meaningless names - how to avoid them?

2011-12-29 Thread Sam Steingold
 * Sam Steingold f...@tah.bet [2011-12-27 13:19:50 -0500]:

 Now, how do I prevent such useless first/last name from being set from
 the mail in the first place?

they are coming from this code:

;; first try to get a reasonable default name if not given
;; often I get things like firstname.surname@ ...
(if (or (null name) (and (stringp name) (string=  name)))
(if (string-match ^[^@]+ mail)
(setq name (bbdb-message-clean-name (match-string 0 mail)

I think this should be removed.
I can hardly imagine giving name foo to the record based on
f...@bar.com as something useful - especially since when you get a
message form John Doe f...@bar.com you will have to endure an
interrogation: use John Doe instead of foo? keep foo as an AKA?

At the very least it should be optional!

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://truepeace.org http://openvotingconsortium.org http://iris.org.il
http://ffii.org http://camera.org http://palestinefacts.org
Abandon all hope, all ye who press Enter.


--
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: v3: name matched against organization?!

2011-12-29 Thread Sam Steingold
 * Sam Steingold f...@tah.bet [2011-12-27 13:27:12 -0500]:

 When visiting an article from foo b...@baz.com who is not in my db,
 I am offered to add name foo and address b...@baz.com to the record
 of First Last - foo, i.e., a person whose _organization_ is foo.
 I think this is wrong: matching the name foo against organization
 foo.

this is because bbdb-hashtable hashes on organization too and
bbdb-message-search does not check that the record bbdb-gethash returns
actually has the right field.

1. why does bbdb-hashtable hash on organization?  I don't think it
should; organization is hardly unique.

2. bbdb-message-search should consider AKA in addition to
bbdb-record-name

3. bbdb-message-search should check that (bbdb-gethash mail) actually
returns records with matching mail (as opposed to, e.g., organization)
and (bbdb-gethash name) actually returns records with matching name or
AKA.

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://thereligionofpeace.com http://jihadwatch.org http://honestreporting.com
http://camera.org http://palestinefacts.org http://www.memritv.org
(when (or despair hope) (cerror Accept life as is. Bad attitude.))


--
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/