diff options
| author | Jim Blandy | 1992-01-31 20:02:34 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-01-31 20:02:34 +0000 |
| commit | f8026fd8345805bd465abea83b0aa1b982c4a18c (patch) | |
| tree | 0dd85b65421572d5550e5b5fac808b06fdc24eed /src | |
| parent | 4915b8d61b4ecc41c444cc200e7ff2bd437dc791 (diff) | |
| download | emacs-f8026fd8345805bd465abea83b0aa1b982c4a18c.tar.gz emacs-f8026fd8345805bd465abea83b0aa1b982c4a18c.zip | |
*** empty log message ***
Diffstat (limited to 'src')
| -rw-r--r-- | src/window.c | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/src/window.c b/src/window.c index 738227726f2..43a4a95b744 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -27,6 +27,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 27 | #include "indent.h" | 27 | #include "indent.h" |
| 28 | #include "termchar.h" | 28 | #include "termchar.h" |
| 29 | #include "disptab.h" | 29 | #include "disptab.h" |
| 30 | #include "keyboard.h" | ||
| 30 | 31 | ||
| 31 | Lisp_Object Qwindowp; | 32 | Lisp_Object Qwindowp; |
| 32 | 33 | ||
| @@ -1930,9 +1931,10 @@ window_internal_height (w) | |||
| 1930 | /* Scroll contents of window WINDOW up N lines. */ | 1931 | /* Scroll contents of window WINDOW up N lines. */ |
| 1931 | 1932 | ||
| 1932 | void | 1933 | void |
| 1933 | window_scroll (window, n) | 1934 | window_scroll (window, n, noerror) |
| 1934 | Lisp_Object window; | 1935 | Lisp_Object window; |
| 1935 | int n; | 1936 | int n; |
| 1937 | int noerror; | ||
| 1936 | { | 1938 | { |
| 1937 | register struct window *w = XWINDOW (window); | 1939 | register struct window *w = XWINDOW (window); |
| 1938 | register int opoint = point; | 1940 | register int opoint = point; |
| @@ -1961,14 +1963,14 @@ window_scroll (window, n) | |||
| 1961 | SET_PT (opoint); | 1963 | SET_PT (opoint); |
| 1962 | 1964 | ||
| 1963 | if (lose) | 1965 | if (lose) |
| 1964 | Fsignal (Qbeginning_of_buffer, Qnil); | 1966 | { |
| 1967 | if (noerror) | ||
| 1968 | return; | ||
| 1969 | else | ||
| 1970 | Fsignal (Qbeginning_of_buffer, Qnil); | ||
| 1971 | } | ||
| 1965 | 1972 | ||
| 1966 | if (pos < ZV) | 1973 | if (pos < ZV) |
| 1967 | #if 0 | ||
| 1968 | /* Allow scrolling to an empty screen (end of buffer) | ||
| 1969 | if that is exactly how far we wanted to go. */ | ||
| 1970 | || XINT (nmoved) == n) | ||
| 1971 | #endif | ||
| 1972 | { | 1974 | { |
| 1973 | set_marker_restricted (w->start, make_number (pos), w->buffer); | 1975 | set_marker_restricted (w->start, make_number (pos), w->buffer); |
| 1974 | w->start_at_line_beg = bolp; | 1976 | w->start_at_line_beg = bolp; |
| @@ -1987,7 +1989,12 @@ window_scroll (window, n) | |||
| 1987 | } | 1989 | } |
| 1988 | } | 1990 | } |
| 1989 | else | 1991 | else |
| 1990 | Fsignal (Qend_of_buffer, Qnil); | 1992 | { |
| 1993 | if (noerror) | ||
| 1994 | return; | ||
| 1995 | else | ||
| 1996 | Fsignal (Qend_of_buffer, Qnil); | ||
| 1997 | } | ||
| 1991 | } | 1998 | } |
| 1992 | 1999 | ||
| 1993 | /* This is the guts of Fscroll_up and Fscroll_down. */ | 2000 | /* This is the guts of Fscroll_up and Fscroll_down. */ |
| @@ -2000,29 +2007,27 @@ scroll_command (n, direction) | |||
| 2000 | register int defalt; | 2007 | register int defalt; |
| 2001 | int count = specpdl_ptr - specpdl; | 2008 | int count = specpdl_ptr - specpdl; |
| 2002 | 2009 | ||
| 2003 | /* If selected window's buffer isn't current, make it current for the moment. | 2010 | /* Code here used to set the current buffer to the selected window's |
| 2004 | But don't screw up if window_scroll gets an error. */ | 2011 | buffer, but since this command always operates on the selected |
| 2012 | window, the current buffer should always be the selected window's | ||
| 2013 | buffer already. Verify this assumption, so we won't be screwed | ||
| 2014 | if we're guessing wrong. */ | ||
| 2005 | if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) | 2015 | if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) |
| 2006 | { | 2016 | abort (); |
| 2007 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | ||
| 2008 | Fset_buffer (XWINDOW (selected_window)->buffer); | ||
| 2009 | } | ||
| 2010 | 2017 | ||
| 2011 | defalt = (window_internal_height (XWINDOW (selected_window)) | 2018 | defalt = (window_internal_height (XWINDOW (selected_window)) |
| 2012 | - next_screen_context_lines); | 2019 | - next_screen_context_lines); |
| 2013 | defalt = direction * (defalt < 1 ? 1 : defalt); | 2020 | defalt = direction * (defalt < 1 ? 1 : defalt); |
| 2014 | 2021 | ||
| 2015 | if (NILP (n)) | 2022 | if (NILP (n)) |
| 2016 | window_scroll (selected_window, defalt); | 2023 | window_scroll (selected_window, defalt, 0); |
| 2017 | else if (EQ (n, Qminus)) | 2024 | else if (EQ (n, Qminus)) |
| 2018 | window_scroll (selected_window, - defalt); | 2025 | window_scroll (selected_window, - defalt, 0); |
| 2019 | else | 2026 | else |
| 2020 | { | 2027 | { |
| 2021 | n = Fprefix_numeric_value (n); | 2028 | n = Fprefix_numeric_value (n); |
| 2022 | window_scroll (selected_window, XINT (n) * direction); | 2029 | window_scroll (selected_window, XINT (n) * direction, 0); |
| 2023 | } | 2030 | } |
| 2024 | |||
| 2025 | unbind_to (count, Qnil); | ||
| 2026 | } | 2031 | } |
| 2027 | 2032 | ||
| 2028 | DEFUN ("scroll-up", Fscroll_up, Sscroll_up, 0, 1, "P", | 2033 | DEFUN ("scroll-up", Fscroll_up, Sscroll_up, 0, 1, "P", |
| @@ -2093,15 +2098,15 @@ showing that buffer, popping the buffer up if necessary.") | |||
| 2093 | SET_PT (marker_position (w->pointm)); | 2098 | SET_PT (marker_position (w->pointm)); |
| 2094 | 2099 | ||
| 2095 | if (NILP (n)) | 2100 | if (NILP (n)) |
| 2096 | window_scroll (window, ht - next_screen_context_lines); | 2101 | window_scroll (window, ht - next_screen_context_lines, 1); |
| 2097 | else if (EQ (n, Qminus)) | 2102 | else if (EQ (n, Qminus)) |
| 2098 | window_scroll (window, next_screen_context_lines - ht); | 2103 | window_scroll (window, next_screen_context_lines - ht, 1); |
| 2099 | else | 2104 | else |
| 2100 | { | 2105 | { |
| 2101 | if (XTYPE (n) == Lisp_Cons) | 2106 | if (XTYPE (n) == Lisp_Cons) |
| 2102 | n = Fcar (n); | 2107 | n = Fcar (n); |
| 2103 | CHECK_NUMBER (n, 0); | 2108 | CHECK_NUMBER (n, 0); |
| 2104 | window_scroll (window, XINT (n)); | 2109 | window_scroll (window, XINT (n), 1); |
| 2105 | } | 2110 | } |
| 2106 | 2111 | ||
| 2107 | Fset_marker (w->pointm, make_number (point), Qnil); | 2112 | Fset_marker (w->pointm, make_number (point), Qnil); |