> * 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
http://openvotingconsortium.org http://thereligionofpeace.com http://pmw.org.il
Life is like Tetris: failures accumulate, successes fade.


------------------------------------------------------------------------------
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/

Reply via email to