diff options
| author | Erik Naggum | 1996-10-06 16:17:41 +0000 |
|---|---|---|
| committer | Erik Naggum | 1996-10-06 16:17:41 +0000 |
| commit | 4628f7a447085d4a015ece9c3ff2a3dba7593a5e (patch) | |
| tree | 219cd010e11696291cf81e03c2f79d7f3a14a759 /src | |
| parent | 4f21aa66bfd229d172445c2ae1b03e2adccbcdc4 (diff) | |
| download | emacs-4628f7a447085d4a015ece9c3ff2a3dba7593a5e.tar.gz emacs-4628f7a447085d4a015ece9c3ff2a3dba7593a5e.zip | |
(Fspecial_display_p, Fsame_window_p): New functions.
(Fdisplay_buffer): Use them, instead of doing the work here.
(syms_of_window): Defsubr them.
Diffstat (limited to 'src')
| -rw-r--r-- | src/window.c | 123 |
1 files changed, 74 insertions, 49 deletions
diff --git a/src/window.c b/src/window.c index d280b739d92..014cd3cedfd 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -1979,6 +1979,72 @@ display_buffer_1 (window) | |||
| 1979 | return window; | 1979 | return window; |
| 1980 | } | 1980 | } |
| 1981 | 1981 | ||
| 1982 | DEFUN ("special-display-p", Fspecial_display_p, Sspecial_display_p, 1, 1, 0, | ||
| 1983 | "Returns non-nil if BUFFER-NAME would use a special display function. | ||
| 1984 | The value is actually t if the frame should be called with default frame | ||
| 1985 | parameters, and a list of frame parameters if they were specified. | ||
| 1986 | See `special-display-buffer-names', and `special-display-regexps'.") | ||
| 1987 | (buffer_name) | ||
| 1988 | Lisp_Object buffer_name; | ||
| 1989 | { | ||
| 1990 | Lisp_Object tem; | ||
| 1991 | |||
| 1992 | CHECK_STRING (buffer_name, 1); | ||
| 1993 | |||
| 1994 | tem = Fmember (buffer_name, Vspecial_display_buffer_names); | ||
| 1995 | if (!NILP (tem)) | ||
| 1996 | return Qt; | ||
| 1997 | |||
| 1998 | tem = Fassoc (buffer_name, Vspecial_display_buffer_names); | ||
| 1999 | if (!NILP (tem)) | ||
| 2000 | return XCDR (tem); | ||
| 2001 | |||
| 2002 | for (tem = Vspecial_display_regexps; CONSP (tem); tem = XCDR (tem)) | ||
| 2003 | { | ||
| 2004 | Lisp_Object car = XCAR (tem); | ||
| 2005 | if (STRINGP (car) | ||
| 2006 | && fast_string_match (car, buffer_name) >= 0) | ||
| 2007 | return Qt; | ||
| 2008 | else if (CONSP (car) | ||
| 2009 | && STRINGP (XCAR (car)) | ||
| 2010 | && fast_string_match (XCAR (car), buffer_name) >= 0) | ||
| 2011 | return XCDR (tem); | ||
| 2012 | } | ||
| 2013 | return Qnil; | ||
| 2014 | } | ||
| 2015 | |||
| 2016 | DEFUN ("same-window-p", Fsame_window_p, Ssame_window_p, 1, 1, 0, | ||
| 2017 | "Returns non-nil if a new buffer named BUFFER-NAME would use the same window. | ||
| 2018 | See `same-window-buffer-names' and `same-window-regexps'.") | ||
| 2019 | (buffer_name) | ||
| 2020 | Lisp_Object buffer_name; | ||
| 2021 | { | ||
| 2022 | Lisp_Object tem; | ||
| 2023 | |||
| 2024 | CHECK_STRING (buffer_name, 1); | ||
| 2025 | |||
| 2026 | tem = Fmember (buffer_name, Vsame_window_buffer_names); | ||
| 2027 | if (!NILP (tem)) | ||
| 2028 | return Qt; | ||
| 2029 | |||
| 2030 | tem = Fassoc (buffer_name, Vsame_window_buffer_names); | ||
| 2031 | if (!NILP (tem)) | ||
| 2032 | return Qt; | ||
| 2033 | |||
| 2034 | for (tem = Vsame_window_regexps; CONSP (tem); tem = XCDR (tem)) | ||
| 2035 | { | ||
| 2036 | Lisp_Object car = XCAR (tem); | ||
| 2037 | if (STRINGP (car) | ||
| 2038 | && fast_string_match (car, buffer_name) >= 0) | ||
| 2039 | return Qt; | ||
| 2040 | else if (CONSP (car) | ||
| 2041 | && STRINGP (XCAR (car)) | ||
| 2042 | && fast_string_match (XCAR (car), buffer_name) >= 0) | ||
| 2043 | return Qt; | ||
| 2044 | } | ||
| 2045 | return Qnil; | ||
| 2046 | } | ||
| 2047 | |||
| 1982 | DEFUN ("display-buffer", Fdisplay_buffer, Sdisplay_buffer, 1, 2, | 2048 | DEFUN ("display-buffer", Fdisplay_buffer, Sdisplay_buffer, 1, 2, |
| 1983 | "bDisplay buffer: \nP", | 2049 | "bDisplay buffer: \nP", |
| 1984 | "Make BUFFER appear in some window but don't select it.\n\ | 2050 | "Make BUFFER appear in some window but don't select it.\n\ |
| @@ -2011,38 +2077,12 @@ buffer names are handled.") | |||
| 2011 | in the selected window. */ | 2077 | in the selected window. */ |
| 2012 | if (NILP (not_this_window)) | 2078 | if (NILP (not_this_window)) |
| 2013 | { | 2079 | { |
| 2014 | tem = Fmember (XBUFFER (buffer)->name, Vsame_window_buffer_names); | 2080 | tem = Fsame_window_p (XBUFFER (buffer)->name); |
| 2015 | if (!NILP (tem)) | 2081 | if (!NILP (tem)) |
| 2016 | { | 2082 | { |
| 2017 | Fswitch_to_buffer (buffer, Qnil); | 2083 | Fswitch_to_buffer (buffer, Qnil); |
| 2018 | return display_buffer_1 (selected_window); | 2084 | return display_buffer_1 (selected_window); |
| 2019 | } | 2085 | } |
| 2020 | |||
| 2021 | tem = Fassoc (XBUFFER (buffer)->name, Vsame_window_buffer_names); | ||
| 2022 | if (!NILP (tem)) | ||
| 2023 | { | ||
| 2024 | Fswitch_to_buffer (buffer, Qnil); | ||
| 2025 | return display_buffer_1 (selected_window); | ||
| 2026 | } | ||
| 2027 | |||
| 2028 | for (tem = Vsame_window_regexps; CONSP (tem); tem = XCONS (tem)->cdr) | ||
| 2029 | { | ||
| 2030 | Lisp_Object car = XCONS (tem)->car; | ||
| 2031 | if (STRINGP (car) | ||
| 2032 | && fast_string_match (car, XBUFFER (buffer)->name) >= 0) | ||
| 2033 | { | ||
| 2034 | Fswitch_to_buffer (buffer, Qnil); | ||
| 2035 | return display_buffer_1 (selected_window); | ||
| 2036 | } | ||
| 2037 | else if (CONSP (car) | ||
| 2038 | && STRINGP (XCONS (car)->car) | ||
| 2039 | && fast_string_match (XCONS (car)->car, | ||
| 2040 | XBUFFER (buffer)->name) >= 0) | ||
| 2041 | { | ||
| 2042 | Fswitch_to_buffer (buffer, Qnil); | ||
| 2043 | return display_buffer_1 (selected_window); | ||
| 2044 | } | ||
| 2045 | } | ||
| 2046 | } | 2086 | } |
| 2047 | 2087 | ||
| 2048 | /* If pop_up_frames, | 2088 | /* If pop_up_frames, |
| @@ -2060,30 +2100,13 @@ buffer names are handled.") | |||
| 2060 | } | 2100 | } |
| 2061 | 2101 | ||
| 2062 | /* Certain buffer names get special handling. */ | 2102 | /* Certain buffer names get special handling. */ |
| 2063 | if (! NILP (Vspecial_display_function)) | 2103 | if (!NILP (Vspecial_display_function)) |
| 2064 | { | 2104 | { |
| 2065 | tem = Fmember (XBUFFER (buffer)->name, Vspecial_display_buffer_names); | 2105 | tem = Fspecial_display_p (XBUFFER (buffer)->name); |
| 2066 | if (!NILP (tem)) | 2106 | if (EQ (tem, Qt)) |
| 2067 | return call1 (Vspecial_display_function, buffer); | 2107 | return call1 (Vspecial_display_function, buffer); |
| 2068 | 2108 | if (CONSP (tem)) | |
| 2069 | tem = Fassoc (XBUFFER (buffer)->name, Vspecial_display_buffer_names); | 2109 | return call2 (Vspecial_display_function, buffer, tem); |
| 2070 | if (!NILP (tem)) | ||
| 2071 | return call2 (Vspecial_display_function, buffer, XCONS (tem)->cdr); | ||
| 2072 | |||
| 2073 | for (tem = Vspecial_display_regexps; CONSP (tem); tem = XCONS (tem)->cdr) | ||
| 2074 | { | ||
| 2075 | Lisp_Object car = XCONS (tem)->car; | ||
| 2076 | if (STRINGP (car) | ||
| 2077 | && fast_string_match (car, XBUFFER (buffer)->name) >= 0) | ||
| 2078 | return call1 (Vspecial_display_function, buffer); | ||
| 2079 | else if (CONSP (car) | ||
| 2080 | && STRINGP (XCONS (car)->car) | ||
| 2081 | && fast_string_match (XCONS (car)->car, | ||
| 2082 | XBUFFER (buffer)->name) >= 0) | ||
| 2083 | return call2 (Vspecial_display_function, | ||
| 2084 | buffer, | ||
| 2085 | XCONS (car)->cdr); | ||
| 2086 | } | ||
| 2087 | } | 2110 | } |
| 2088 | 2111 | ||
| 2089 | /* If there are no frames open that have more than a minibuffer, | 2112 | /* If there are no frames open that have more than a minibuffer, |
| @@ -3591,6 +3614,8 @@ If there is only one window, it is split regardless of this value."); | |||
| 3591 | defsubr (&Sdelete_window); | 3614 | defsubr (&Sdelete_window); |
| 3592 | defsubr (&Sset_window_buffer); | 3615 | defsubr (&Sset_window_buffer); |
| 3593 | defsubr (&Sselect_window); | 3616 | defsubr (&Sselect_window); |
| 3617 | defsubr (&Sspecial_display_p); | ||
| 3618 | defsubr (&Ssame_window_p); | ||
| 3594 | defsubr (&Sdisplay_buffer); | 3619 | defsubr (&Sdisplay_buffer); |
| 3595 | defsubr (&Ssplit_window); | 3620 | defsubr (&Ssplit_window); |
| 3596 | defsubr (&Senlarge_window); | 3621 | defsubr (&Senlarge_window); |