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

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

[elpa] externals/ebdb ed3e270 119/350: Reverse order of args in return v


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb ed3e270 119/350: Reverse order of args in return value of ebdb-popup-window
Date: Mon, 14 Aug 2017 11:46:19 -0400 (EDT)

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

    Reverse order of args in return value of ebdb-popup-window
    
    * ebdb-com.el (ebdb-popup-window): Should now return a three-element
      list where the horiz/vert argument is last. This is because that
      argument is almost always nil (meaning split based on the dimensions
      of the window in question) so we might as well leave it off.
      (ebdb-pop-up-window): Read arg correctly, and also fix a logic bug
      where the window would never have been split vertically.
---
 ebdb-com.el     | 29 +++++++++++++++++------------
 ebdb-gnus.el    |  2 +-
 ebdb-message.el |  4 ++--
 ebdb-mua.el     | 15 ++++++++-------
 4 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/ebdb-com.el b/ebdb-com.el
index 4ff2fbc..ea34427 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -647,9 +647,9 @@ buffer."
   "Display RECORDS using FMT.
 If APPEND is non-nil append RECORDS to the already displayed
 records.  Otherwise RECORDS overwrite the displayed records.
-SELECT and POP have the same meaning as in `ebdb-pop-up-window'.
-BUF indicates which *EBDB* buffer to use, or nil to generate a
-buffer name based on the current major mode."
+SELECT and POP are passed directly to `ebdb-pop-up-window'.  BUF
+indicates which *EBDB* buffer to use, or nil to generate a buffer
+name based on the current major mode."
 
   ;; All functions that call `ebdb-display-records' set the "fmt"
   ;; argument, but that's not guaranteed.
@@ -946,19 +946,21 @@ displayed records."
 (defun ebdb-pop-up-window (buf &optional select pop)
   "Display *EBDB* buffer BUF by popping up a new window.
 
-POP is typically a three-element list of (window horiz-p split),
-where WINDOW is the window to be split, HORIZ-P says whether to
-split it vertically or horizontally, and SPLIT says to split it
-by how much.  If HORIZ-P is nil, split the longest way.  If SPLIT
-is nil, split 0.5.
+POP is typically a three-element list of (window split
+horiz/vert), where WINDOW is the window to be split, SPLIT says
+to split it by how much, and HORIZ/VERT says whether to split it
+vertically or horizontally.  If HORIZ/VERT is nil, split the
+longest way.  If SPLIT is nil, split 0.5.
 
 If the whole POP argument is nil, just re-use the current
 buffer."
   (let* ((split-window (car-safe pop))
         (buffer-window (get-buffer-window buf t))
-        (horiz-p (or (cadr pop)
-                     (> (window-total-width split-window)
-                        (window-total-height split-window))))
+        (horiz/vert (or (cadr pop)
+                        (if (> (window-total-width split-window)
+                               (window-total-height split-window))
+                            'horiz
+                          'vert)))
         (size (cond ((null pop)
                      nil)
                     ((integerp (caddr pop)))
@@ -979,7 +981,10 @@ buffer."
           (setq buffer-window (get-buffer-window buf t)))
          (t
           ;; Otherwise split.
-          (setq buffer-window (split-window split-window size (if horiz-p 
'right 'below)))
+          (setq buffer-window (split-window split-window size
+                                            (if (eql horiz/vert 'vert)
+                                                'below
+                                              'right)))
           (set-window-buffer buffer-window buf)))
     (display-buffer-record-window 'window buffer-window buf)
     (when select
diff --git a/ebdb-gnus.el b/ebdb-gnus.el
index 939a0ec..cf5389c 100644
--- a/ebdb-gnus.el
+++ b/ebdb-gnus.el
@@ -422,7 +422,7 @@ Note that `\( is the backquote, NOT the quote '\(."
     (list win nil 0.3)))
 
 (cl-defmethod ebdb-popup-window (&context (major-mode gnus-article-mode))
-  (list (get-buffer-window) nil 0.3))
+  (list (get-buffer-window) 0.3))
 
 ;; It seems that `gnus-fetch-field' fetches decoded content of
 ;; `gnus-visible-headers', ignoring `gnus-ignored-headers'.
diff --git a/ebdb-message.el b/ebdb-message.el
index 150a855..94019d9 100644
--- a/ebdb-message.el
+++ b/ebdb-message.el
@@ -60,10 +60,10 @@
   (message-field-value header))
 
 (cl-defmethod ebdb-popup-window (&context (major-mode message-mode))
-  (list (get-buffer-window) nil 0.4))
+  (list (get-buffer-window) 0.4))
 
 (cl-defmethod ebdb-popup-window (&context (major-mode mail-mode))
-  (list (get-buffer-window) nil 0.4))
+  (list (get-buffer-window) 0.4))
 
 (defun ebdb-insinuate-message ()
   (when ebdb-complete-mail
diff --git a/ebdb-mua.el b/ebdb-mua.el
index 356995e..93de2c1 100644
--- a/ebdb-mua.el
+++ b/ebdb-mua.el
@@ -1094,11 +1094,13 @@ Dispatches on the value of major-mode."
 
 This generic function dispatches on the current value of
 major-mode.  The return value should be a three-element list
-of (window horiz-p split), in which WINDOW is the window to
-split, HORIZ-P is t if the window should be split horizontally,
-else vertically, 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.
+of (window split horiz/vert), 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 HORIZ-P is 'horiz if
+the window should be split horizontally, 'vert for vertically,
+and nil to split depending on the dimensions of the current
+window.
 
 Alternately, the return value can be nil, which means continue
 using the current window.")
@@ -1111,8 +1113,7 @@ Ie, don't pop up at all."
 
 (cl-defmethod ebdb-popup-window ()
   "When popping up from a random window, use half the window."
-  (let ((horiz-p (> (window-total-width) (window-total-height))))
-    (list (get-buffer-window) horiz-p 0.5)))
+  (list (get-buffer-window) 0.5))
 
 ;;;###autoload
 (defun ebdb-mua-update-records (&optional header-class all)



reply via email to

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