diff options
| author | Richard M. Stallman | 1994-07-16 20:18:53 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-07-16 20:18:53 +0000 |
| commit | cee67da9c0f2c0cdc851853d031bd7e325eadc24 (patch) | |
| tree | 8ca7f15c445884322c8056a4b9856c4d6f90f7b2 | |
| parent | 899b130edfe2dab12ad4a754c735d3d0388f9cf3 (diff) | |
| download | emacs-cee67da9c0f2c0cdc851853d031bd7e325eadc24.tar.gz emacs-cee67da9c0f2c0cdc851853d031bd7e325eadc24.zip | |
(Fdisplay_buffer): Cope with unsplittable frames and dedicated windows.
| -rw-r--r-- | src/window.c | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/src/window.c b/src/window.c index 37266261c74..493e2889537 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -1313,6 +1313,7 @@ window_loop (type, obj, mini, frames) | |||
| 1313 | DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0, | 1313 | DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0, |
| 1314 | "Return the window least recently selected or used for display.\n\ | 1314 | "Return the window least recently selected or used for display.\n\ |
| 1315 | If optional argument FRAME is `visible', search all visible frames.\n\ | 1315 | If optional argument FRAME is `visible', search all visible frames.\n\ |
| 1316 | If FRAME is 0, search all visible and iconified frames.\n\ | ||
| 1316 | If FRAME is t, search all frames.\n\ | 1317 | If FRAME is t, search all frames.\n\ |
| 1317 | If FRAME is nil, search only the selected frame.\n\ | 1318 | If FRAME is nil, search only the selected frame.\n\ |
| 1318 | If FRAME is a frame, search only that frame.") | 1319 | If FRAME is a frame, search only that frame.") |
| @@ -1331,6 +1332,7 @@ If FRAME is a frame, search only that frame.") | |||
| 1331 | DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 1, 0, | 1332 | DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 1, 0, |
| 1332 | "Return the largest window in area.\n\ | 1333 | "Return the largest window in area.\n\ |
| 1333 | If optional argument FRAME is `visible', search all visible frames.\n\ | 1334 | If optional argument FRAME is `visible', search all visible frames.\n\ |
| 1335 | If FRAME is 0, search all visible and iconified frames.\n\ | ||
| 1334 | If FRAME is t, search all frames.\n\ | 1336 | If FRAME is t, search all frames.\n\ |
| 1335 | If FRAME is nil, search only the selected frame.\n\ | 1337 | If FRAME is nil, search only the selected frame.\n\ |
| 1336 | If FRAME is a frame, search only that frame.") | 1338 | If FRAME is a frame, search only that frame.") |
| @@ -1806,6 +1808,9 @@ Returns the window displaying BUFFER.") | |||
| 1806 | if (pop_up_windows | 1808 | if (pop_up_windows |
| 1807 | #ifdef MULTI_FRAME | 1809 | #ifdef MULTI_FRAME |
| 1808 | || FRAME_MINIBUF_ONLY_P (selected_frame) | 1810 | || FRAME_MINIBUF_ONLY_P (selected_frame) |
| 1811 | /* If the current frame is a special display frame, | ||
| 1812 | don't try to reuse its windows. */ | ||
| 1813 | || !NILP (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->dedicated) | ||
| 1809 | #endif | 1814 | #endif |
| 1810 | ) | 1815 | ) |
| 1811 | { | 1816 | { |
| @@ -1820,8 +1825,27 @@ Returns the window displaying BUFFER.") | |||
| 1820 | if (split_height_threshold < window_min_height << 1) | 1825 | if (split_height_threshold < window_min_height << 1) |
| 1821 | split_height_threshold = window_min_height << 1; | 1826 | split_height_threshold = window_min_height << 1; |
| 1822 | 1827 | ||
| 1823 | window = Fget_largest_window (frames); | 1828 | /* Note that both Fget_largest_window and Fget_lru_window |
| 1829 | ignore minibuffers and dedicated windows. | ||
| 1830 | This means they can return nil. */ | ||
| 1824 | 1831 | ||
| 1832 | /* If the frame we would try to split cannot be split, | ||
| 1833 | try other frames. */ | ||
| 1834 | if (FRAME_NO_SPLIT_P (NILP (frames) ? selected_frame | ||
| 1835 | : last_nonminibuf_frame)) | ||
| 1836 | { | ||
| 1837 | /* Try visible frames first. */ | ||
| 1838 | window = Fget_largest_window (Qvisible); | ||
| 1839 | /* If that didn't work, try iconified frames. */ | ||
| 1840 | if (NILP (window)) | ||
| 1841 | window = Fget_largest_window (make_number (0)); | ||
| 1842 | if (NILP (window)) | ||
| 1843 | window = Fget_largest_window (Qt); | ||
| 1844 | } | ||
| 1845 | else | ||
| 1846 | window = Fget_largest_window (frames); | ||
| 1847 | |||
| 1848 | /* If we got a tall enough full-width window, split it. */ | ||
| 1825 | if (!NILP (window) | 1849 | if (!NILP (window) |
| 1826 | && window_height (window) >= split_height_threshold | 1850 | && window_height (window) >= split_height_threshold |
| 1827 | && (XFASTINT (XWINDOW (window)->width) | 1851 | && (XFASTINT (XWINDOW (window)->width) |
| @@ -1830,10 +1854,31 @@ Returns the window displaying BUFFER.") | |||
| 1830 | else | 1854 | else |
| 1831 | { | 1855 | { |
| 1832 | window = Fget_lru_window (frames); | 1856 | window = Fget_lru_window (frames); |
| 1833 | if ((EQ (window, selected_window) | 1857 | /* If the LRU window is selected, and big enough, split it. */ |
| 1834 | || EQ (XWINDOW (window)->parent, Qnil)) | 1858 | if (!NILP (window) |
| 1859 | && (EQ (window, selected_window) | ||
| 1860 | || EQ (XWINDOW (window)->parent, Qnil)) | ||
| 1835 | && window_height (window) >= window_min_height << 1) | 1861 | && window_height (window) >= window_min_height << 1) |
| 1836 | window = Fsplit_window (window, Qnil, Qnil); | 1862 | window = Fsplit_window (window, Qnil, Qnil); |
| 1863 | #ifdef MULTI_FRAME | ||
| 1864 | /* If Fget_lru_window returned nil, try other approaches. */ | ||
| 1865 | /* Try visible frames first. */ | ||
| 1866 | if (NILP (window)) | ||
| 1867 | window = Fget_largest_window (Qvisible); | ||
| 1868 | /* If that didn't work, try iconified frames. */ | ||
| 1869 | if (NILP (window)) | ||
| 1870 | window = Fget_largest_window (make_number (0)); | ||
| 1871 | /* Try invisible frames. */ | ||
| 1872 | if (NILP (window)) | ||
| 1873 | window = Fget_largest_window (Qt); | ||
| 1874 | /* As a last resort, make a new frame. */ | ||
| 1875 | if (NILP (window)) | ||
| 1876 | window = Fframe_selected_window (call0 (Vpop_up_frame_function)); | ||
| 1877 | #else | ||
| 1878 | /* As a last resort, use a non minibuffer window. */ | ||
| 1879 | if (NILP (window)) | ||
| 1880 | window = Fframe_first_window (Fselected_frame ()); | ||
| 1881 | #endif | ||
| 1837 | } | 1882 | } |
| 1838 | } | 1883 | } |
| 1839 | else | 1884 | else |