[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb a19ff0a 168/350: Simplify pop-up window splitting
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb a19ff0a 168/350: Simplify pop-up window splitting |
Date: |
Mon, 14 Aug 2017 11:46:29 -0400 (EDT) |
branch: externals/ebdb
commit a19ff0a0088dec7a79f0c83c45a2b06c7a694314
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Simplify pop-up window splitting
* ebdb-com.el (ebdb-pop-up-window): Use `display-buffer' with
`display-buffer-pop-up-window' rather than `split-window'. This is
a bit of an experiment -- doing it this way means we're no longer
able to specify horizontal vs vertical splitting, and instead rely
on Emacs to DTRT. The upside is that Emacs will DTRT, and the
resulting buffers are easier to use (the quit configuration is set
correctly, mostly).
---
ebdb-com.el | 45 ++++++++++++++++++---------------------------
ebdb-mua.el | 14 ++++++--------
2 files changed, 24 insertions(+), 35 deletions(-)
diff --git a/ebdb-com.el b/ebdb-com.el
index a342f85..a076b56 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -964,47 +964,38 @@ 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 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.
+POP is typically a two-element list of (window split), where
+WINDOW is the window to be split, and SPLIT says to split it by
+how much. SPLIT can be an integer number of lines/columns, or a
+float between 0 and 1. 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/vert (or (caddr pop)
- (if (> (window-total-width split-window)
- (window-total-height split-window))
- 'horiz
- 'vert)))
- (size (cond ((null pop)
- nil)
- ((integerp (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)))))))
+ (horiz/vert (if (> (window-total-width split-window)
+ (window-total-height split-window))
+ 'horiz
+ 'vert)))
(cond (buffer-window
;; It's already visible, re-use it.
- (or (null select)
- (select-window buffer-window)))
+ nil)
((and (null split-window) (null size))
;; Not splitting, but buffer isn't visible, just take up
;; the whole window.
(set-window-buffer (selected-window) buf)
- (setq buffer-window (get-buffer-window buf t)))
+ (setq buffer-window (get-buffer-window buf t))
+ (display-buffer-record-window 'reuse buffer-window buf))
(t
;; Otherwise split.
- (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)
+ (setq buffer-window
+ (display-buffer buf
+ `(display-buffer-pop-up-window
+ . ((,(if (eql horiz/vert 'vert)
+ 'window-height
+ 'window-width)
+ . ,(nth 1 pop))))))))
(when select
(select-window buffer-window))))
diff --git a/ebdb-mua.el b/ebdb-mua.el
index d132e32..0422ca2 100644
--- a/ebdb-mua.el
+++ b/ebdb-mua.el
@@ -1096,14 +1096,12 @@ Dispatches on the value of 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 three-element list
-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.
+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.")
- [elpa] externals/ebdb bf51b58 161/350: Fix ebdb-delete-redundant-mails, (continued)
- [elpa] externals/ebdb bf51b58 161/350: Fix ebdb-delete-redundant-mails, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 279eb56 169/350: Tweaks and additions to manual, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb eea0abf 165/350: VCard export is good enough, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 64b5e43 170/350: Fix autoloads in ebdb.el, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb a968dd3 143/350: First actually-working version of snarfing, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb a8e0221 179/350: Missing local variable binding, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e71548d 172/350: Allow for characters before mail addresses when snarfing, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 14b03b5 186/350: Fix menu entry of ebdb-create-record, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 10c1e76 185/350: When replying to messages, start with a populated EBDB buffer, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb b9e6034 187/350: Increase base field indentation in *EBDB* buffers, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb a19ff0a 168/350: Simplify pop-up window splitting,
Eric Abrahamsen <=
- [elpa] externals/ebdb 4c6b6f5 190/350: Protect gnus stuff behind eval-after-load, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e0c3311 177/350: Fix parsing of suffixes in names, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 429cdb0 183/350: Add safety check to ebdb-undisplay-records, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 744c829 182/350: Clear *EBDB-Message* buffers when composing new message, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 8ebba5d 178/350: Very basic test setup, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 927c2ac 188/350: Be more careful about name formatting, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e52e17e 192/350: Pop up EBDB buffer when using company to complete, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb fc1a480 191/350: Fix ebdb-delete-redundant-mails, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 61dcb8c 148/350: Re-initialize database records after reloading, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 8694194 150/350: Use string-match-p for searching on Org tags, Eric Abrahamsen, 2017/08/14