Mercurial > emacs
comparison src/window.c @ 16390:77051008303f
(Fspecial_display_p, Fsame_window_p): New functions.
(Fdisplay_buffer): Use them, instead of doing the work here.
(syms_of_window): Defsubr them.
author | Erik Naggum <erik@naggum.no> |
---|---|
date | Sun, 06 Oct 1996 16:17:41 +0000 |
parents | c39e44468b7a |
children | de5de2aefc4e |
comparison
equal
deleted
inserted
replaced
16389:30e3d4ddca44 | 16390:77051008303f |
---|---|
1977 Fraise_frame (WINDOW_FRAME (XWINDOW (window))); | 1977 Fraise_frame (WINDOW_FRAME (XWINDOW (window))); |
1978 } | 1978 } |
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\ |
1985 BUFFER can be a buffer or a buffer name.\n\ | 2051 BUFFER can be a buffer or a buffer name.\n\ |
1986 If BUFFER is shown already in some window, just use that one,\n\ | 2052 If BUFFER is shown already in some window, just use that one,\n\ |
2009 | 2075 |
2010 /* See if the user has specified this buffer should appear | 2076 /* See if the user has specified this buffer should appear |
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 } | |
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 } | 2085 } |
2046 } | 2086 } |
2047 | 2087 |
2048 /* If pop_up_frames, | 2088 /* If pop_up_frames, |
2049 look for a window showing BUFFER on any visible or iconified frame. | 2089 look for a window showing BUFFER on any visible or iconified frame. |
2058 { | 2098 { |
2059 return display_buffer_1 (window); | 2099 return display_buffer_1 (window); |
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, |
2090 we need to create a new frame. */ | 2113 we need to create a new frame. */ |
2091 if (pop_up_frames || last_nonminibuf_frame == 0) | 2114 if (pop_up_frames || last_nonminibuf_frame == 0) |
3589 defsubr (&Sdelete_windows_on); | 3612 defsubr (&Sdelete_windows_on); |
3590 defsubr (&Sreplace_buffer_in_windows); | 3613 defsubr (&Sreplace_buffer_in_windows); |
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); |
3597 defsubr (&Sshrink_window); | 3622 defsubr (&Sshrink_window); |
3598 defsubr (&Sscroll_up); | 3623 defsubr (&Sscroll_up); |