Mercurial > hg > xemacs-beta
comparison lisp/window-xemacs.el @ 272:c5d627a313b1 r21-0b34
Import from CVS: tag r21-0b34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:28:48 +0200 |
parents | 11cf20601dec |
children | 7df0dd720c89 |
comparison
equal
deleted
inserted
replaced
271:c7b7086b0a39 | 272:c5d627a313b1 |
---|---|
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | 17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19 ;; General Public License for more details. | 19 ;; General Public License for more details. |
20 | 20 |
21 ;; You should have received a copy of the GNU General Public License | 21 ;; You should have received a copy of the GNU General Public License |
22 ;; along with XEmacs; see the file COPYING. If not, write to the | 22 ;; along with XEmacs; see the file COPYING. If not, write to the |
23 ;; Free Software Foundation, 59 Temple Place - Suite 330, | 23 ;; Free Software Foundation, 59 Temple Place - Suite 330, |
24 ;; Boston, MA 02111-1307, USA. | 24 ;; Boston, MA 02111-1307, USA. |
25 | 25 |
26 ;;; Synched up with: Not synched. | 26 ;;; Synched up with: Not synched. |
27 | 27 |
44 This is just like calling `other-window' with the arg negated." | 44 This is just like calling `other-window' with the arg negated." |
45 (interactive "p") | 45 (interactive "p") |
46 (other-window (- arg) all-frames device)) | 46 (other-window (- arg) all-frames device)) |
47 | 47 |
48 (defun windows-of-buffer (&optional buffer) | 48 (defun windows-of-buffer (&optional buffer) |
49 "Returns a list of windows that have BUFFER in them. | 49 "Return a list of windows that have BUFFER in them. |
50 If BUFFER is not specified, the current buffer will be used." | 50 If BUFFER is not specified, the current buffer will be used." |
51 (or (bufferp buffer) | 51 (or (bufferp buffer) |
52 (if (stringp buffer) | 52 (if (stringp buffer) |
53 (setq buffer (or (get-buffer buffer) | 53 (setq buffer (or (get-buffer buffer) |
54 (get-file-buffer buffer))) | 54 (get-file-buffer buffer))) |
55 (setq buffer (current-buffer)))) | 55 (setq buffer (current-buffer)))) |
56 (let* ((firstwin (next-window nil nil t)) | 56 (let* ((firstwin (next-window nil nil t)) |
57 (wind firstwin) | 57 (wind firstwin) |
58 (done nil) | 58 (done nil) |
59 window-list) | 59 window-list) |
60 (while (not done) | 60 (while (not done) |
61 (if (eq (window-buffer wind) buffer) | 61 (if (eq (window-buffer wind) buffer) |
62 (setq window-list (append window-list (list wind)))) | 62 (setq window-list (append window-list (list wind)))) |
73 (current-buffer))) | 73 (current-buffer))) |
74 (> (length (windows-of-buffer buffer)) 1)) | 74 (> (length (windows-of-buffer buffer)) 1)) |
75 | 75 |
76 (defun window-list (&optional frame minibuf window) | 76 (defun window-list (&optional frame minibuf window) |
77 "Return a list of windows on FRAME, beginning with WINDOW. | 77 "Return a list of windows on FRAME, beginning with WINDOW. |
78 FRAME and WINDOW default to the selected ones. | 78 FRAME and WINDOW default to the selected ones. |
79 Optional second arg MINIBUF t means count the minibuffer window | 79 Optional second arg MINIBUF t means count the minibuffer window |
80 even if not active. If MINIBUF is neither t nor nil it means | 80 even if not active. If MINIBUF is neither t nor nil it means |
81 not to count the minibuffer even if it is active." | 81 not to count the minibuffer even if it is active." |
82 (setq window (or window (selected-window)) | 82 (setq window (or window (selected-window)) |
83 frame (or frame (selected-frame))) | 83 frame (or frame (selected-frame))) |
417 ;; is no longer the same as it was on entry -- it's the | 417 ;; is no longer the same as it was on entry -- it's the |
418 ;; selected-window of target_frame instead of old_frame, | 418 ;; selected-window of target_frame instead of old_frame, |
419 ;; so it's a fine candidate for display. | 419 ;; so it's a fine candidate for display. |
420 (if (not (eq old-frame target-frame)) | 420 (if (not (eq old-frame target-frame)) |
421 (setq not-this-window-p nil)) | 421 (setq not-this-window-p nil)) |
422 | 422 |
423 ;; if it's in the selected window, and that's ok, then we're done. | 423 ;; if it's in the selected window, and that's ok, then we're done. |
424 (if (and (not not-this-window-p) | 424 (if (and (not not-this-window-p) |
425 (eq buffer (window-buffer (selected-window)))) | 425 (eq buffer (window-buffer (selected-window)))) |
426 (throw 'done (display-buffer-1 (selected-window)))) | 426 (throw 'done (display-buffer-1 (selected-window)))) |
427 | 427 |
428 ;; See if the user has specified this buffer should appear | 428 ;; See if the user has specified this buffer should appear |
429 ;; in the selected window. | 429 ;; in the selected window. |
430 | 430 |
431 (if not-this-window-p | 431 (if not-this-window-p |
432 nil | 432 nil |
433 | 433 |
434 (if (or (member (buffer-name buffer) same-window-buffer-names) | 434 (if (or (member (buffer-name buffer) same-window-buffer-names) |
435 (assoc (buffer-name buffer) same-window-buffer-names)) | 435 (assoc (buffer-name buffer) same-window-buffer-names)) |
436 (progn | 436 (progn |
437 (switch-to-buffer buffer) | 437 (switch-to-buffer buffer) |
438 (throw 'done (display-buffer-1 (selected-window))))) | 438 (throw 'done (display-buffer-1 (selected-window))))) |
439 | 439 |
440 (let ((tem same-window-regexps)) | 440 (let ((tem same-window-regexps)) |
441 (while tem | 441 (while tem |
442 (let ((car (car tem))) | 442 (let ((car (car tem))) |
443 (if (or | 443 (if (or |
444 (and (stringp car) | 444 (and (stringp car) |
448 (progn | 448 (progn |
449 (switch-to-buffer buffer) | 449 (switch-to-buffer buffer) |
450 (throw 'done (display-buffer-1 | 450 (throw 'done (display-buffer-1 |
451 (selected-window)))))) | 451 (selected-window)))))) |
452 (setq tem (cdr tem))))) | 452 (setq tem (cdr tem))))) |
453 | 453 |
454 ;; If pop-up-frames, look for a window showing BUFFER on | 454 ;; If pop-up-frames, look for a window showing BUFFER on |
455 ;; any visible or iconified frame. Otherwise search only | 455 ;; any visible or iconified frame. Otherwise search only |
456 ;; the current frame. | 456 ;; the current frame. |
457 (if (and (not explicit-frame) | 457 (if (and (not explicit-frame) |
458 (or pop-up-frames (not (last-nonminibuf-frame)))) | 458 (or pop-up-frames (not (last-nonminibuf-frame)))) |
459 (setq target-frame 0)) | 459 (setq target-frame 0)) |
460 | 460 |
461 ;; Otherwise, find some window that it's already in, and | 461 ;; Otherwise, find some window that it's already in, and |
462 ;; return that, unless that window is the selected window | 462 ;; return that, unless that window is the selected window |
463 ;; and that isn't ok. What a contorted mess! | 463 ;; and that isn't ok. What a contorted mess! |
464 (setq window (or (if (not explicit-frame) | 464 (setq window (or (if (not explicit-frame) |
465 ;; search the selected frame | 465 ;; search the selected frame |
564 other) | 564 other) |
565 (setq window (get-lru-window target-frame)) | 565 (setq window (get-lru-window target-frame)) |
566 ;; If the LRU window is selected, and big enough, | 566 ;; If the LRU window is selected, and big enough, |
567 ;; and can be split, split it. | 567 ;; and can be split, split it. |
568 (if (and window | 568 (if (and window |
569 (not (frame-property (window-frame window) | 569 (not (frame-property (window-frame window) |
570 'unsplittable)) | 570 'unsplittable)) |
571 (or (eq window (selected-window)) | 571 (or (eq window (selected-window)) |
572 (not (window-parent window))) | 572 (not (window-parent window))) |
573 (>= (window-height window) | 573 (>= (window-height window) |
574 (* 2 window-min-height))) | 574 (* 2 window-min-height))) |