[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb dd675a6 223/350: Revert changes to pop-up routine.
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb dd675a6 223/350: Revert changes to pop-up routine. |
Date: |
Mon, 14 Aug 2017 11:46:42 -0400 (EDT) |
branch: externals/ebdb
commit dd675a616cc7e5f6962c683c3fb0b17dd541839d
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Revert changes to pop-up routine.
* ebdb-com.el (ebdb-pop-up-window): I'd changed from `split-window' to
`display-buffer', because the quit configuration was better. But the
splitting behavior was wonky, so I'm changing back. Still have to
solve the quit-restore problem, though.
---
ebdb-com.el | 61 +++++++++++++++++++++++++++++--------------------------------
1 file changed, 29 insertions(+), 32 deletions(-)
diff --git a/ebdb-com.el b/ebdb-com.el
index 20d9515..33eebf9 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -986,50 +986,47 @@ 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 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.
+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/vert (if (and split-window
- (> (window-total-width split-window)
- (window-total-height split-window)))
- 'horiz
- 'vert))
- ;; This is a hack, necessitated by my ignorance about window
- ;; splitting. We were originally using `split-window'
- ;; directly; I changed that because it seemed better to be
- ;; using a higher-level function, and because
- ;; `display-buffer-pop-up-window' sets the `quit-restore'
- ;; window parameter correctly. But it's also too clever, and
- ;; won't split windows on small screens, and we essentially
- ;; don't ever want *EBDB* to reuse an existing window.
- ;; Probably I should just go back to using `split-window',
- ;; and figure out how to manually set `quit-restore'.
- (split-width-threshold (/ split-width-threshold 2))
- (split-height-threshold (/ split-height-threshold 2)))
+ (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)))))))
+
(cond (buffer-window
;; It's already visible, re-use it.
- nil)
- ((null pop)
+ (or (null select)
+ (select-window buffer-window)))
+ ((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))
- (display-buffer-record-window 'reuse buffer-window buf))
+ (setq buffer-window (get-buffer-window buf t)))
(t
;; Otherwise split.
- (setq buffer-window
- (display-buffer buf
- `(display-buffer-pop-up-window
- . ((,(if (eql horiz/vert 'vert)
- 'window-height
- 'window-width)
- . ,(nth 1 pop))))))))
+ (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
(select-window buffer-window))))
- [elpa] externals/ebdb 0ccfc0a 215/350: Write generics for ebdb-db-add/remove-record, (continued)
- [elpa] externals/ebdb 0ccfc0a 215/350: Write generics for ebdb-db-add/remove-record, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 498a580 214/350: Allow user transformation of search strings, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 760fd91 204/350: More informative warning when deleting record fields, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 762f027 219/350: Add Makefile, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 325426e 207/350: Add ebdb-complete.el (#32), Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ea13778 221/350: Autoload calendar-absolute-from-gregorian, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb af13080 218/350: Support sending text messages via Signal, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 94749fd 224/350: Expand gnus-user-format-function-%s, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb c9f8f33 226/350: Be more when careful migrating timestamps, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb b7a28f3 227/350: Be more forgiving about contents of BBDB file when migrating, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb dd675a6 223/350: Revert changes to pop-up routine.,
Eric Abrahamsen <=
- [elpa] externals/ebdb 1096c6e 230/350: Search read transform functions needs to work for all methods, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb adfe13f 235/350: Fix stupidity, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 817414a 234/350: Drop object-print for cl-print-object, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb a629bde 236/350: Last tweak to pop-up buffers, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 444f762 231/350: Fix condition-case catch in ebdb-i18n-* methods, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 2de4f0e 241/350: Apparently I was spelling vCard wrong, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb f9d5af6 243/350: Add close parenthesis to email regexp delimiter, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 4882f66 238/350: Include addresses in vcard output, plus escaping, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 440cb9e 245/350: More search functions can use prefixes: mention in manual, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb c8bdb70 194/350: Don't assume Chinese names have both surname and given-names, Eric Abrahamsen, 2017/08/14