* 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-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.
XSETBUFFER (buf, current_buffer);
return buf;
}
-\f
-/* 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. */
set_buffer_if_live (Lisp_Object buffer)
{
if (! NILP (BVAR (XBUFFER (buffer), name)))
- Fset_buffer (buffer);
+ set_buffer_internal (XBUFFER (buffer));
return Qnil;
}
\f
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);
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. */
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);
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);
CHECK_BUFFER (object);
bp = XBUFFER (object);
- if (bp != current_buffer)
- set_buffer_internal (bp);
+ set_buffer_internal (bp);
if (NILP (start))
b = BEGV;
}
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--;
{
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);
bset_point_before_scroll (buffer, Qnil);
- if (buffer != old_buffer)
- set_buffer_internal (old_buffer);
+ set_buffer_internal (old_buffer);
}
\f
/* Check that it is okay to modify the buffer between START and END,
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. */
/* 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;
? 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)
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;