emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ebdb 7921f6a 11/16: Have ebdb-pop-up-window better hono


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 7921f6a 11/16: Have ebdb-pop-up-window better honor ebdb-default-window-size
Date: Sun, 16 Jun 2019 12:23:08 -0400 (EDT)

branch: externals/ebdb
commit 7921f6a35b5bdd5ce80ef9ad263083ef8599b67c
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Have ebdb-pop-up-window better honor ebdb-default-window-size
    
    * ebdb-com.el (ebdb-pop-up-window): There was still a hard-coded 0.5
      in here. Check ebdb-default-window-size for all its potential
      values.
      (ebdb-popup-window): Fix docstring to mention that the return spec
      can also include a direction symbol.
---
 ebdb-com.el | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/ebdb-com.el b/ebdb-com.el
index 826c745..37e6d89 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -800,15 +800,19 @@ buffer."
 (cl-defgeneric ebdb-popup-window (major-mode)
   "Return a spec for how to pop up a window on an *EBDB* buffer.
 This generic function dispatches on the current value of
-major-mode.  The return value should be a two-element list
-of (window split), in which WINDOW is the window to split, and
-SPLIT is either an integer, specifying number of rows/columns, or
-a float specifying what percentage of window real estate the
-pop-up should occupy.  SPLIT can also be nil, in which case the
-window will probably take up half the available space.
-
-Alternately, the return value can be nil, which means continue
-using the current window.")
+major-mode.  The return value should be a three-element list
+of (window split direction), in which WINDOW is the window to
+split, SPLIT is either an integer, specifying number of
+rows/columns, or a float specifying what percentage of window
+real estate the pop-up should occupy, and DIRECTION is one of the
+symbols `left', `right', `above' or `below'.  SPLIT can be nil,
+in which case the value of `ebdb-default-window-size' will be
+used.  DIRECTION can also be nil, in which case the direction
+will either be `right' or `below', depending on the height and
+width of the window to be split.
+
+Alternately, the entire return value can be nil, which means
+continue using the current window.")
 
 (cl-defmethod ebdb-popup-window (&context (major-mode ebdb-mode))
   "When popping up from an existing *EBDB* buffer, just reuse the window.
@@ -1172,11 +1176,13 @@ popped up from."
                      nil)
                     ((integerp (cadr pop))
                      (cadr pop))
-                    (t
-                     (let ((ratio (- 1 (or (cadr pop) 0.5)))
-                           (dimension (max (window-total-width split-window)
-                                           (window-total-height 
split-window))))
-                       (round (* dimension ratio)))))))
+                    ((or (floatp (cadr pop)) (floatp ebdb-default-window-size))
+                     (let ((flt (or (cadr pop) ebdb-default-window-size)))
+                       (round (* (max (window-total-width split-window)
+                                      (window-total-height split-window))
+                                 (- 1 flt)))))
+                    ((integerp ebdb-default-window-size)
+                     ebdb-default-window-size))))
 
     (cond (buffer-window
           ;; It's already visible, re-use it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]