aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-01-02 23:11:26 +0000
committerRichard M. Stallman2005-01-02 23:11:26 +0000
commitc45c149c3727ebd50f84a4c7cb06ec6be4ed5199 (patch)
tree35699e26c2795509e7dcaa555912950b67be41d3
parent303b04121058f35726d088c600a9a0e006235e91 (diff)
downloademacs-c45c149c3727ebd50f84a4c7cb06ec6be4ed5199.tar.gz
emacs-c45c149c3727ebd50f84a4c7cb06ec6be4ed5199.zip
(Electric-pop-up-window): Use fit-window-to-buffer
instead of calculating the right size.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/electric.el20
2 files changed, 9 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4eebddf0dc0..4501a5db72c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12005-01-02 Richard M. Stallman <rms@gnu.org>
2
3 * electric.el (Electric-pop-up-window): Use fit-window-to-buffer
4 instead of calculating the right size.
5
12005-01-02 Stefan <monnier@iro.umontreal.ca> 62005-01-02 Stefan <monnier@iro.umontreal.ca>
2 7
3 * vc-arch.el (vc-arch-workfile-version): Handle the empty-branch case. 8 * vc-arch.el (vc-arch-workfile-version): Handle the empty-branch case.
@@ -49,6 +54,7 @@
49 54
50 * ses.el (copy-region-as-kill): Deactivate mark. 55 * ses.el (copy-region-as-kill): Deactivate mark.
51 56
57>>>>>>> 1.6818
522005-01-01 Richard M. Stallman <rms@gnu.org> 582005-01-01 Richard M. Stallman <rms@gnu.org>
53 59
54 * replace.el (occur-1): If the output buffer is also an input, 60 * replace.el (occur-1): If the output buffer is also an input,
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 @@
144 (buf (get-buffer buffer)) 144 (buf (get-buffer buffer))
145 (one-window (one-window-p t)) 145 (one-window (one-window-p t))
146 (pop-up-windows t) 146 (pop-up-windows t)
147 (pop-up-frames nil) 147 (pop-up-frames nil))
148 (target-height)
149 (lines))
150 (if (not buf) 148 (if (not buf)
151 (error "Buffer %s does not exist" buffer) 149 (error "Buffer %s does not exist" buffer)
152 (with-current-buffer buf
153 (setq lines (count-lines (point-min) (point-max)))
154 (setq target-height
155 (min (max (if max-height (min max-height (1+ lines)) (1+ lines))
156 window-min-height)
157 (save-window-excursion
158 (delete-other-windows)
159 (1- (window-height (selected-window)))))))
160 (cond ((and (eq (window-buffer win) buf)) 150 (cond ((and (eq (window-buffer win) buf))
161 (select-window win)) 151 (select-window win))
162 (one-window 152 (one-window
163 (pop-to-buffer buffer) 153 (pop-to-buffer buffer)
164 (setq win (selected-window)) 154 (setq win (selected-window)))
165 (enlarge-window (- target-height (window-height win))))
166 (t 155 (t
167 (switch-to-buffer buf))) 156 (switch-to-buffer buf)))
168 (if (and (not max-height) 157 (fit-window-to-buffer win max-height)
169 (> target-height (window-height (selected-window))))
170 (progn (goto-char (window-start win))
171 (enlarge-window (- target-height (window-height win)))))
172 (goto-char (point-min)) 158 (goto-char (point-min))
173 win))) 159 win)))
174 160