summaryrefslogtreecommitdiff
path: root/lisp/electric.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2005-01-02 23:11:26 +0000
committerRichard M. Stallman <rms@gnu.org>2005-01-02 23:11:26 +0000
commitc45c149c3727ebd50f84a4c7cb06ec6be4ed5199 (patch)
tree35699e26c2795509e7dcaa555912950b67be41d3 /lisp/electric.el
parent303b04121058f35726d088c600a9a0e006235e91 (diff)
downloademacs-c45c149c3727ebd50f84a4c7cb06ec6be4ed5199.tar.gz
(Electric-pop-up-window): Use fit-window-to-buffer
instead of calculating the right size.
Diffstat (limited to 'lisp/electric.el')
-rw-r--r--lisp/electric.el20
1 files changed, 3 insertions, 17 deletions
diff --git a/lisp/electric.el b/lisp/electric.el
index 3d2bf140c8c..18a4d8388c5 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -144,31 +144,17 @@
(buf (get-buffer buffer))
(one-window (one-window-p t))
(pop-up-windows t)
- (pop-up-frames nil)
- (target-height)
- (lines))
+ (pop-up-frames nil))
(if (not buf)
(error "Buffer %s does not exist" buffer)
- (with-current-buffer buf
- (setq lines (count-lines (point-min) (point-max)))
- (setq target-height
- (min (max (if max-height (min max-height (1+ lines)) (1+ lines))
- window-min-height)
- (save-window-excursion
- (delete-other-windows)
- (1- (window-height (selected-window)))))))
(cond ((and (eq (window-buffer win) buf))
(select-window win))
(one-window
(pop-to-buffer buffer)
- (setq win (selected-window))
- (enlarge-window (- target-height (window-height win))))
+ (setq win (selected-window)))
(t
(switch-to-buffer buf)))
- (if (and (not max-height)
- (> target-height (window-height (selected-window))))
- (progn (goto-char (window-start win))
- (enlarge-window (- target-height (window-height win)))))
+ (fit-window-to-buffer win max-height)
(goto-char (point-min))
win)))