Commit a3d794a1 authored by Dmitry Antipov's avatar Dmitry Antipov

Fix usage of set_buffer_internal.

* buffer.h (set_buffer_internal): Make it BUFFER_INLINE.
* buffer.c (set_buffer_if_live): Use set_buffer_internal.
* coding.c (decode_coding): Omit redundant test.
* fileio.c (decide_coding_unwind): Likewise.
* fns.c (secure_hash): Likewise.
* insdel.c (modify_region): Likewise.
* keyboard.c (command_loop_1): Likewise.
* print.c (PRINTFINISH): Likewise.
* xdisp.c (run_window_scroll_functions): Use set_buffer_internal.
parent 59ea14cd
2012-08-28 Dmitry Antipov <dmantipov@yandex.ru>
Fix usage of set_buffer_internal.
* buffer.h (set_buffer_internal): Make it BUFFER_INLINE.
* buffer.c (set_buffer_if_live): Use set_buffer_internal.
* coding.c (decode_coding): Omit redundant test.
* fileio.c (decide_coding_unwind): Likewise.
* fns.c (secure_hash): Likewise.
* insdel.c (modify_region): Likewise.
* keyboard.c (command_loop_1): Likewise.
* print.c (PRINTFINISH): Likewise.
* xdisp.c (run_window_scroll_functions): Use set_buffer_internal.
2012-08-27 Paul Eggert <eggert@cs.ucla.edu>
* dispnew.c: Use bool for boolean.
......
......@@ -2099,22 +2099,6 @@ DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0,
XSETBUFFER (buf, current_buffer);
return buf;
}
/* Set the current buffer to B.
We previously set windows_or_buffers_changed here to invalidate
global unchanged information in beg_unchanged and end_unchanged.
This is no longer necessary because we now compute unchanged
information on a buffer-basis. Every action affecting other
windows than the selected one requires a select_window at some
time, and that increments windows_or_buffers_changed. */
void
set_buffer_internal (register struct buffer *b)
{
if (current_buffer != b)
set_buffer_internal_1 (b);
}
/* Set the current buffer to B, and do not set windows_or_buffers_changed.
This is used by redisplay. */
......@@ -2226,7 +2210,7 @@ Lisp_Object
set_buffer_if_live (Lisp_Object buffer)
{
if (! NILP (BVAR (XBUFFER (buffer), name)))
Fset_buffer (buffer);
set_buffer_internal (XBUFFER (buffer));
return Qnil;
}
......
......@@ -1014,7 +1014,6 @@ extern ptrdiff_t sort_overlays (Lisp_Object *, ptrdiff_t, struct window *);
extern void recenter_overlay_lists (struct buffer *, ptrdiff_t);
extern ptrdiff_t overlay_strings (ptrdiff_t, struct window *, unsigned char **);
extern void validate_region (Lisp_Object *, Lisp_Object *);
extern void set_buffer_internal (struct buffer *);
extern void set_buffer_internal_1 (struct buffer *);
extern void set_buffer_temp (struct buffer *);
extern Lisp_Object buffer_local_value_1 (Lisp_Object, Lisp_Object);
......@@ -1023,6 +1022,22 @@ extern _Noreturn void buffer_slot_type_mismatch (Lisp_Object, int);
extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t);
extern void mmap_set_vars (bool);
/* Set the current buffer to B.
We previously set windows_or_buffers_changed here to invalidate
global unchanged information in beg_unchanged and end_unchanged.
This is no longer necessary because we now compute unchanged
information on a buffer-basis. Every action affecting other
windows than the selected one requires a select_window at some
time, and that increments windows_or_buffers_changed. */
BUFFER_INLINE void
set_buffer_internal (struct buffer *b)
{
if (current_buffer != b)
set_buffer_internal_1 (b);
}
/* Get overlays at POSN into array OVERLAYS with NOVERLAYS elements.
If NEXTP is non-NULL, return next overlay there.
See overlay_at arg CHANGE_REQ for meaning of CHRQ arg. */
......
......@@ -7006,8 +7006,7 @@ decode_coding (struct coding_system *coding)
undo_list = Qt;
if (BUFFERP (coding->dst_object))
{
if (current_buffer != XBUFFER (coding->dst_object))
set_buffer_internal (XBUFFER (coding->dst_object));
set_buffer_internal (XBUFFER (coding->dst_object));
if (GPT != PT)
move_gap_both (PT, PT_BYTE);
......
......@@ -3142,8 +3142,7 @@ decide_coding_unwind (Lisp_Object unwind_data)
undo_list = XCAR (unwind_data);
buffer = XCDR (unwind_data);
if (current_buffer != XBUFFER (buffer))
set_buffer_internal (XBUFFER (buffer));
set_buffer_internal (XBUFFER (buffer));
adjust_markers_for_delete (BEG, BEG_BYTE, Z, Z_BYTE);
adjust_overlays_for_delete (BEG, Z - BEG);
set_buffer_intervals (current_buffer, NULL);
......
......@@ -4661,8 +4661,7 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_
CHECK_BUFFER (object);
bp = XBUFFER (object);
if (bp != current_buffer)
set_buffer_internal (bp);
set_buffer_internal (bp);
if (NILP (start))
b = BEGV;
......@@ -4749,8 +4748,7 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_
}
object = make_buffer_string (b, e, 0);
if (prev != current_buffer)
set_buffer_internal (prev);
set_buffer_internal (prev);
/* Discard the unwind protect for recovering the current
buffer. */
specpdl_ptr--;
......
......@@ -1779,8 +1779,7 @@ modify_region (struct buffer *buffer, ptrdiff_t start, ptrdiff_t end,
{
struct buffer *old_buffer = current_buffer;
if (buffer != old_buffer)
set_buffer_internal (buffer);
set_buffer_internal (buffer);
prepare_to_modify_buffer (start, end, NULL);
......@@ -1794,8 +1793,7 @@ modify_region (struct buffer *buffer, ptrdiff_t start, ptrdiff_t end,
bset_point_before_scroll (buffer, Qnil);
if (buffer != old_buffer)
set_buffer_internal (old_buffer);
set_buffer_internal (old_buffer);
}
/* Check that it is okay to modify the buffer between START and END,
......
......@@ -1434,8 +1434,7 @@ command_loop_1 (void)
Fkill_emacs (Qnil);
/* Make sure the current window's buffer is selected. */
if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
/* Display any malloc warning that just came out. Use while because
displaying one warning can cause another. */
......@@ -1513,8 +1512,7 @@ command_loop_1 (void)
/* A filter may have run while we were reading the input. */
if (! FRAME_LIVE_P (XFRAME (selected_frame)))
Fkill_emacs (Qnil);
if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
++num_input_keys;
......
......@@ -197,8 +197,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
? PT - start_point : 0), \
old_point_byte + (old_point_byte >= start_point_byte \
? PT_BYTE - start_point_byte : 0)); \
if (old != current_buffer) \
set_buffer_internal (old);
set_buffer_internal (old);
#define PRINTCHAR(ch) printchar (ch, printcharfun)
......
......@@ -14551,8 +14551,7 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp)
make_number (CHARPOS (startp)));
SET_TEXT_POS_FROM_MARKER (startp, w->start);
/* In case the hook functions switch buffers. */
if (current_buffer != XBUFFER (w->buffer))
set_buffer_internal_1 (XBUFFER (w->buffer));
set_buffer_internal (XBUFFER (w->buffer));
}
return startp;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment