aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2014-06-06 10:37:05 -0400
committerStefan Monnier2014-06-06 10:37:05 -0400
commit3da983f8c4ec64a3964ce6ad4d7ae8ef8abe7aec (patch)
tree2ae457e0f1fedeb438b85577c042b4f615fdbd14 /src
parent631de55bc19931ca2d778e8399697921228902a8 (diff)
downloademacs-3da983f8c4ec64a3964ce6ad4d7ae8ef8abe7aec.tar.gz
emacs-3da983f8c4ec64a3964ce6ad4d7ae8ef8abe7aec.zip
* src/window.c (Frecenter): Signal an error if window-buffer is not
current-buffer.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/window.c25
2 files changed, 15 insertions, 13 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 06847a72de3..9c17d3d1dbc 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
12014-06-06 Stefan Monnier <monnier@iro.umontreal.ca> 12014-06-06 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * window.c (Frecenter): Signal an error if window-buffer is not
4 current-buffer.
5
3 * keyboard.c (make_lispy_position): Don't include a buffer position in 6 * keyboard.c (make_lispy_position): Don't include a buffer position in
4 mode/header-line mouse events. 7 mode/header-line mouse events.
5 8
diff --git a/src/window.c b/src/window.c
index 919cc7b1c4e..46024614179 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4867,7 +4867,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror)
4867 /* If PT is not visible in WINDOW, move back one half of 4867 /* If PT is not visible in WINDOW, move back one half of
4868 the screen. Allow PT to be partially visible, otherwise 4868 the screen. Allow PT to be partially visible, otherwise
4869 something like (scroll-down 1) with PT in the line before 4869 something like (scroll-down 1) with PT in the line before
4870 the partially visible one would recenter. */ 4870 the partially visible one would recenter. */
4871 4871
4872 if (!pos_visible_p (w, PT, &x, &y, &rtop, &rbot, &rowh, &vpos)) 4872 if (!pos_visible_p (w, PT, &x, &y, &rtop, &rbot, &rowh, &vpos))
4873 { 4873 {
@@ -4896,7 +4896,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror)
4896 } 4896 }
4897 else if (auto_window_vscroll_p) 4897 else if (auto_window_vscroll_p)
4898 { 4898 {
4899 if (rtop || rbot) /* partially visible */ 4899 if (rtop || rbot) /* Partially visible. */
4900 { 4900 {
4901 int px; 4901 int px;
4902 int dy = frame_line_height; 4902 int dy = frame_line_height;
@@ -5643,14 +5643,16 @@ and redisplay normally--don't erase and redraw the frame. */)
5643{ 5643{
5644 struct window *w = XWINDOW (selected_window); 5644 struct window *w = XWINDOW (selected_window);
5645 struct buffer *buf = XBUFFER (w->contents); 5645 struct buffer *buf = XBUFFER (w->contents);
5646 struct buffer *obuf = current_buffer;
5647 bool center_p = 0; 5646 bool center_p = 0;
5648 ptrdiff_t charpos, bytepos; 5647 ptrdiff_t charpos, bytepos;
5649 EMACS_INT iarg IF_LINT (= 0); 5648 EMACS_INT iarg IF_LINT (= 0);
5650 int this_scroll_margin; 5649 int this_scroll_margin;
5651 5650
5651 if (buf != current_buffer)
5652 error ("`recenter'ing a window that does not display current-buffer.");
5653
5652 /* If redisplay is suppressed due to an error, try again. */ 5654 /* If redisplay is suppressed due to an error, try again. */
5653 obuf->display_error_modiff = 0; 5655 buf->display_error_modiff = 0;
5654 5656
5655 if (NILP (arg)) 5657 if (NILP (arg))
5656 { 5658 {
@@ -5672,7 +5674,7 @@ and redisplay normally--don't erase and redraw the frame. */)
5672 5674
5673 center_p = 1; 5675 center_p = 1;
5674 } 5676 }
5675 else if (CONSP (arg)) /* Just C-u. */ 5677 else if (CONSP (arg)) /* Just C-u. */
5676 center_p = 1; 5678 center_p = 1;
5677 else 5679 else
5678 { 5680 {
@@ -5681,12 +5683,10 @@ and redisplay normally--don't erase and redraw the frame. */)
5681 iarg = XINT (arg); 5683 iarg = XINT (arg);
5682 } 5684 }
5683 5685
5684 set_buffer_internal (buf);
5685
5686 /* Do this after making BUF current 5686 /* Do this after making BUF current
5687 in case scroll_margin is buffer-local. */ 5687 in case scroll_margin is buffer-local. */
5688 this_scroll_margin = 5688 this_scroll_margin
5689 max (0, min (scroll_margin, w->total_lines / 4)); 5689 = max (0, min (scroll_margin, w->total_lines / 4));
5690 5690
5691 /* Handle centering on a graphical frame specially. Such frames can 5691 /* Handle centering on a graphical frame specially. Such frames can
5692 have variable-height lines and centering point on the basis of 5692 have variable-height lines and centering point on the basis of
@@ -5734,7 +5734,7 @@ and redisplay normally--don't erase and redraw the frame. */)
5734 h -= it.current_y; 5734 h -= it.current_y;
5735 else 5735 else
5736 { 5736 {
5737 /* Last line has no newline */ 5737 /* Last line has no newline. */
5738 h -= line_bottom_y (&it); 5738 h -= line_bottom_y (&it);
5739 it.vpos++; 5739 it.vpos++;
5740 } 5740 }
@@ -5813,10 +5813,9 @@ and redisplay normally--don't erase and redraw the frame. */)
5813 5813
5814 w->optional_new_start = 1; 5814 w->optional_new_start = 1;
5815 5815
5816 w->start_at_line_beg = (bytepos == BEGV_BYTE || 5816 w->start_at_line_beg = (bytepos == BEGV_BYTE
5817 FETCH_BYTE (bytepos - 1) == '\n'); 5817 || FETCH_BYTE (bytepos - 1) == '\n');
5818 5818
5819 set_buffer_internal (obuf);
5820 return Qnil; 5819 return Qnil;
5821} 5820}
5822 5821