Mercurial > hg > xemacs-beta
comparison lisp/window.el @ 730:3e321319c5ba
[xemacs-hg @ 2002-01-12 00:19:50 by janv]
Implement (quit-window) (sync from FSF 21.1)
author | janv |
---|---|
date | Sat, 12 Jan 2002 00:19:50 +0000 |
parents | 223736d75acb |
children | a5954632b187 |
comparison
equal
deleted
inserted
replaced
729:217aff1c578d | 730:3e321319c5ba |
---|---|
220 The uppermost window gets ARG lines and the other gets the rest. | 220 The uppermost window gets ARG lines and the other gets the rest. |
221 Negative arg means select the size of the lowermost window instead. | 221 Negative arg means select the size of the lowermost window instead. |
222 With no argument, split equally or close to it. | 222 With no argument, split equally or close to it. |
223 Both windows display the same buffer now current. | 223 Both windows display the same buffer now current. |
224 | 224 |
225 If the variable split-window-keep-point is non-nil, both new windows | 225 If the variable `split-window-keep-point' is non-nil, both new windows |
226 will get the same value of point as the current window. This is often | 226 will get the same value of point as the current window. This is often |
227 more convenient for editing. | 227 more convenient for editing. |
228 | 228 |
229 Otherwise, we choose window starts so as to minimize the amount of | 229 Otherwise, we choose window starts so as to minimize the amount of |
230 redisplay; this is convenient on slow terminals. The new selected | 230 redisplay; this is convenient on slow terminals. The new selected |
340 (let ((buffer (current-buffer))) | 340 (let ((buffer (current-buffer))) |
341 (delete-window (selected-window)) | 341 (delete-window (selected-window)) |
342 (kill-buffer buffer)) | 342 (kill-buffer buffer)) |
343 (error "Aborted"))) | 343 (error "Aborted"))) |
344 | 344 |
345 (defun window-list (&optional minibuf which-frames which-devices) | 345 (defun quit-window (&optional kill window) |
346 "Return a list of existing windows. | 346 "Quit the current buffer. Bury it, and maybe delete the selected frame. |
347 If the optional argument MINIBUF is non-nil, then include minibuffer | 347 \(The frame is deleted if it is contains a dedicated window for the buffer.) |
348 windows in the result. | 348 With a prefix argument, kill the buffer instead. |
349 | 349 |
350 By default, only the windows in the selected frame are returned. | 350 Noninteractively, if KILL is non-nil, then kill the current buffer, |
351 The optional argument WHICH-FRAMES changes this behavior: | 351 otherwise bury it. |
352 WHICH-FRAMES = `visible' means include windows on all visible frames. | 352 |
353 WHICH-FRAMES = 0 means include windows on all visible and iconified frames. | 353 If WINDOW is non-nil, it specifies a window; we delete that window, |
354 WHICH-FRAMES = t means include windows on all frames including invisible frames. | 354 and the buffer that is killed or buried is the one in that window." |
355 Anything else means restrict to the selected frame. | 355 (interactive "P") |
356 | 356 (let ((buffer (window-buffer window)) |
357 The optional fourth argument WHICH-DEVICES further clarifies on which | 357 (frame (window-frame (or window (selected-window)))) |
358 devices to search for frames as specified by WHICH-FRAMES. This value | 358 (window-solitary |
359 is only meaningful if WHICH-FRAMES is non-nil. | 359 (save-selected-window |
360 If nil or omitted, search all devices on the selected console. | 360 (if window |
361 If a device, only search that device. | 361 (select-window window)) |
362 If a console, search all devices on that console. | 362 (one-window-p t))) |
363 If a device type, search all devices of that type. | 363 window-handled) |
364 If `window-system', search all devices on window-system consoles. | 364 |
365 Any other non-nil value means search all devices." | 365 (save-selected-window |
366 (let ((wins nil)) | 366 (if window |
367 (walk-windows (lambda (win) | 367 (select-window window)) |
368 (push win wins)) | 368 (or (window-minibuffer-p) |
369 minibuf which-frames which-devices) | 369 (window-dedicated-p (selected-window)) |
370 wins)) | 370 (switch-to-buffer (other-buffer)))) |
371 | |
372 ;; Get rid of the frame, if it has just one dedicated window | |
373 ;; and other visible frames exist. | |
374 (and (or (window-minibuffer-p) (window-dedicated-p window)) | |
375 (delq frame (visible-frame-list)) | |
376 window-solitary | |
377 (if (and (eq default-minibuffer-frame frame) | |
378 (= 1 (length (minibuffer-frame-list)))) | |
379 (setq window nil) | |
380 (delete-frame frame) | |
381 (setq window-handled t))) | |
382 | |
383 ;; Deal with the buffer. | |
384 (if kill | |
385 (kill-buffer buffer) | |
386 (bury-buffer buffer)) | |
387 | |
388 ;; Maybe get rid of the window. | |
389 (and window (not window-handled) (not window-solitary) | |
390 (delete-window window)))) | |
371 | 391 |
372 ;;; window.el ends here | 392 ;;; window.el ends here |