comparison lisp/calc/calc-misc.el @ 44248:50c7ae7c1bdc

(calc-delete-windows-keep): Function deleted.
author Colin Walters <walters@gnu.org>
date Fri, 29 Mar 2002 22:55:53 +0000
parents be3e9c2f0159
children f4d68f97221e
comparison
equal deleted inserted replaced
44247:b50c25ecef92 44248:50c7ae7c1bdc
150 (lambda (v) 150 (lambda (v)
151 (set-default v (symbol-value v)))) calc-local-var-list)) 151 (set-default v (symbol-value v)))) calc-local-var-list))
152 (set-buffer (generate-new-buffer "*Calculator*")) 152 (set-buffer (generate-new-buffer "*Calculator*"))
153 (pop-to-buffer (current-buffer)) 153 (pop-to-buffer (current-buffer))
154 (calc-mode)) 154 (calc-mode))
155
156
157 ;;; Make an attempt to preserve the window configuration, while deleting
158 ;;; windows on "bufs". Emacs 19's delete-window function will probably
159 ;;; make this kludgery unnecessary, but Emacs 18's tendency to grow all
160 ;;; windows on the screen to take up the slack from the deleted windows
161 ;;; can be annoying when Calc was called during another multi-window
162 ;;; application, such as GNUS.
163
164 (defun calc-delete-windows-keep (&rest bufs)
165 (if (one-window-p)
166 (mapcar 'delete-windows-on bufs)
167 (let* ((w (car calc-was-split))
168 (e (window-edges w))
169 (wins nil)
170 w2 e2)
171 (while (progn
172 (setq w2 (previous-window w)
173 e2 (window-edges w2))
174 (and (= (car e2) (car e))
175 (= (nth 2 e2) (nth 2 e))
176 (< (nth 1 e2) (nth 1 e))))
177 (setq w w2 e e2))
178 (setq w2 w e2 e)
179 (while (progn
180 (setq wins (cons (list w (nth 1 e) (window-buffer w)
181 (window-point w) (window-start w))
182 wins)
183 w (next-window w)
184 e (window-edges w))
185 (and (not (eq w w2))
186 (= (car e2) (car e))
187 (= (nth 2 e2) (nth 2 e)))))
188 (setq wins (nreverse wins))
189 (mapcar 'delete-windows-on bufs)
190 (or (one-window-p)
191 (let ((w wins)
192 (main nil)
193 (mainpos 0)
194 (sel (if (window-point (nth 2 calc-was-split))
195 (nth 2 calc-was-split)
196 (selected-window))))
197 (while w
198 (if (window-point (car (car w)))
199 (if main
200 (delete-window (car (car w)))
201 (setq main (car (car w))
202 mainpos (nth 1 (car w))
203 wins (cdr wins)))
204 (setq wins (delq (car w) wins)))
205 (setq w (cdr w)))
206 (while wins
207 (setq w (split-window main
208 (if (eq main (car calc-was-split))
209 (nth 1 calc-was-split)
210 (- (nth 1 (car wins)) mainpos))))
211 (set-window-buffer w (nth 2 (car wins)))
212 (set-window-point w (nth 3 (car wins)))
213 (set-window-start w (nth 4 (car wins)))
214 (if (eq sel (car (car wins)))
215 (select-window w))
216 (setq main w
217 mainpos (nth 1 (car wins))
218 wins (cdr wins)))
219 (if (window-point sel)
220 (select-window sel)))))))
221
222 155
223 (defun calc-info () 156 (defun calc-info ()
224 "Run the Emacs Info system on the Calculator documentation." 157 "Run the Emacs Info system on the Calculator documentation."
225 (interactive) 158 (interactive)
226 (select-window (get-largest-window)) 159 (select-window (get-largest-window))