unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: The rest of xVARs
       [not found] ` <jwvlihqih7o.fsf-monnier+emacs@gnu.org>
@ 2012-08-09  6:14   ` Dmitry Antipov
  2012-08-09 12:52     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Antipov @ 2012-08-09  6:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs development discussions

On 08/08/2012 12:30 AM, Stefan Monnier wrote:

>> Should we also try to get rid of INTERNAL_FIELD, (B|K)VARs
>> but provide (B|K)SET macros similar to (F|W)SET?
>
> BVAR and KVAR were introduced for a different need: these fields are
> exported as Lisp vars, so they can be let-bound, and in the concurrency
> branch this will require special treatment both for reads and for writes
> (basically, while it's a single field, it can contain various values:
> one per thread).

We're very, very far from the full-featured Lisp threads; for me, even
a new GC looks simpler and more realistic :-). (I don't believe that we
will have multithreaded buffer processing in the foreseeable future,
but rather believe in a kind of implicit, i.e. invisible for Lisp,
concurrency like thread-per-buffer (sometimes) or thread-per-frame).

I can't continue without solving (B|K)VARs issue, and X = B->field/
BSET(B, field, X) is enough for my purposes; so I'm voting for doing
it so unless there is a plan to merge something from the concurrency
branch which can conflict with this. IIUC, real support for per-thread
values is not ever designed anyway.

> I dislike the current BVAR/KVAR mostly because it receives a field name
> as parameter (so it looks like a variable, while it's only a field
> name).  Maybe we can use TGET (foo->bar) and let the concurrency branch
> make the "bar" field into a different type than Lisp_Object.

So you should hate DEFUN which receives function pointer, Lisp_Subr name
and even a comment as parameters :-). I dislike it too, but consider them
as the smallest possible evil rather than a nightmare.

Dmitry




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: The rest of xVARs
  2012-08-09  6:14   ` The rest of xVARs Dmitry Antipov
@ 2012-08-09 12:52     ` Stefan Monnier
       [not found]       ` <5023F621.1020107@yandex.ru>
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2012-08-09 12:52 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Emacs development discussions

> I can't continue without solving (B|K)VARs issue, and X = B->field/
> BSET(B, field, X) is enough for my purposes;

You can split the BVAR into a BGET and BSET for now.

> So you should hate DEFUN which receives function pointer, Lisp_Subr name
> and even a comment as parameters :-). I dislike it too, but consider them
> as the smallest possible evil rather than a nightmare.

I'm not fond of DEFUN, but since it's placed at the top-level, it's
syntactically obvious that it's not a function call, so there's no
expectation that its arguments be valid expressions.


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: The rest of xVARs
       [not found]         ` <jwvipcr7tgm.fsf-monnier+emacs@gnu.org>
@ 2012-08-10  5:19           ` Dmitry Antipov
  2012-08-10 15:18             ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Antipov @ 2012-08-10  5:19 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs development discussions

[-- Attachment #1: Type: text/plain, Size: 729 bytes --]

On 08/09/2012 11:32 PM, Stefan Monnier wrote:

>>>> I can't continue without solving (B|K)VARs issue, and X = B->field/
>>>> BSET(B, field, X) is enough for my purposes;
>>> You can split the BVAR into a BGET and BSET for now.
>> OK, the patch is > 200K uncompressed.
>
> Here's a simpler solution: split BVAR into BVAR and BSET.  I'm sure the
> patch will substantially smaller and hence cause much fewer conflicts.

OK

> Stefan "tired of resolving cosmetic conflicts with your patches"

Coccinelle tends to eat spaces and tabs (especially between function name and
'(' opens an argument list),so I do quite a lot of manual adjustments to
fit our coding style; but sometimes I can miss the poorly formatted entry :-(.

Dmitry


[-- Attachment #2: bset.patch --]
[-- Type: text/plain, Size: 48204 bytes --]

=== modified file 'src/buffer.c'
--- src/buffer.c	2012-08-08 14:47:11 +0000
+++ src/buffer.c	2012-08-10 04:52:39 +0000
@@ -370,7 +370,7 @@
 
   b->newline_cache = 0;
   b->width_run_cache = 0;
-  BVAR (b, width_table) = Qnil;
+  BSET (b, width_table, Qnil);
   b->prevent_redisplay_optimizations_p = 1;
 
   /* Put this on the chain of all buffers including killed ones.  */
@@ -379,20 +379,20 @@
 
   /* An ordinary buffer normally doesn't need markers
      to handle BEGV and ZV.  */
-  BVAR (b, pt_marker) = Qnil;
-  BVAR (b, begv_marker) = Qnil;
-  BVAR (b, zv_marker) = Qnil;
+  BSET (b, pt_marker, Qnil);
+  BSET (b, begv_marker, Qnil);
+  BSET (b, zv_marker, Qnil);
 
   name = Fcopy_sequence (buffer_or_name);
   string_set_intervals (name, NULL);
-  BVAR (b, name) = name;
+  BSET (b, name, name);
 
-  BVAR (b, undo_list) = (SREF (name, 0) != ' ') ? Qnil : Qt;
+  BSET (b, undo_list, (SREF (name, 0) != ' ') ? Qnil : Qt);
 
   reset_buffer (b);
   reset_buffer_local_variables (b, 1);
 
-  BVAR (b, mark) = Fmake_marker ();
+  BSET (b, mark, Fmake_marker ());
   BUF_MARKERS (b) = NULL;
 
   /* Put this in the alist of all live buffers.  */
@@ -481,7 +481,7 @@
 
   /* Get (a copy of) the alist of Lisp-level local variables of FROM
      and install that in TO.  */
-  BVAR (to, local_var_alist) = buffer_lisp_local_variables (from, 1);
+  BSET (to, local_var_alist, buffer_lisp_local_variables (from, 1));
 }
 
 
@@ -584,7 +584,7 @@
 
   b->newline_cache = 0;
   b->width_run_cache = 0;
-  BVAR (b, width_table) = Qnil;
+  BSET (b, width_table, Qnil);
 
   /* Put this on the chain of all buffers including killed ones.  */
   b->header.next.buffer = all_buffers;
@@ -592,7 +592,7 @@
 
   name = Fcopy_sequence (name);
   string_set_intervals (name, NULL);
-  BVAR (b, name) = name;
+  BSET (b, name, name);
 
   reset_buffer (b);
   reset_buffer_local_variables (b, 1);
@@ -601,10 +601,10 @@
   XSETBUFFER (buf, b);
   Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil));
 
-  BVAR (b, mark) = Fmake_marker ();
+  BSET (b, mark, Fmake_marker ());
 
   /* The multibyte status belongs to the base buffer.  */
-  BVAR (b, enable_multibyte_characters) = BVAR (b->base_buffer, enable_multibyte_characters);
+  BSET (b, enable_multibyte_characters, BVAR (b->base_buffer, enable_multibyte_characters));
 
   /* Make sure the base buffer has markers for its narrowing.  */
   if (NILP (BVAR (b->base_buffer, pt_marker)))
@@ -612,14 +612,14 @@
       eassert (NILP (BVAR (b->base_buffer, begv_marker)));
       eassert (NILP (BVAR (b->base_buffer, zv_marker)));
 
-      BVAR (b->base_buffer, pt_marker)
-	= build_marker (b->base_buffer, b->base_buffer->pt, b->base_buffer->pt_byte);
-
-      BVAR (b->base_buffer, begv_marker)
-	= build_marker (b->base_buffer, b->base_buffer->begv, b->base_buffer->begv_byte);
-
-      BVAR (b->base_buffer, zv_marker)
-	= build_marker (b->base_buffer, b->base_buffer->zv, b->base_buffer->zv_byte);
+      BSET (b->base_buffer, pt_marker,
+	    build_marker (b->base_buffer, b->base_buffer->pt, b->base_buffer->pt_byte));
+
+      BSET (b->base_buffer, begv_marker,
+	    build_marker (b->base_buffer, b->base_buffer->begv, b->base_buffer->begv_byte));
+
+      BSET (b->base_buffer, zv_marker,
+	    build_marker (b->base_buffer, b->base_buffer->zv, b->base_buffer->zv_byte));
 
       XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1;
     }
@@ -627,9 +627,9 @@
   if (NILP (clone))
     {
       /* Give the indirect buffer markers for its narrowing.  */
-      BVAR (b, pt_marker) = build_marker (b, b->pt, b->pt_byte);
-      BVAR (b, begv_marker) = build_marker (b, b->begv, b->begv_byte);
-      BVAR (b, zv_marker) = build_marker (b, b->zv, b->zv_byte);
+      BSET (b, pt_marker, build_marker (b, b->pt, b->pt_byte));
+      BSET (b, begv_marker, build_marker (b, b->begv, b->begv_byte));
+      BSET (b, zv_marker, build_marker (b, b->zv, b->zv_byte));
       XMARKER (BVAR (b, zv_marker))->insertion_type = 1;
     }
   else
@@ -637,11 +637,11 @@
       struct buffer *old_b = current_buffer;
 
       clone_per_buffer_values (b->base_buffer, b);
-      BVAR (b, filename) = Qnil;
-      BVAR (b, file_truename) = Qnil;
-      BVAR (b, display_count) = make_number (0);
-      BVAR (b, backed_up) = Qnil;
-      BVAR (b, auto_save_file_name) = Qnil;
+      BSET (b, filename, Qnil);
+      BSET (b, file_truename, Qnil);
+      BSET (b, display_count, make_number (0));
+      BSET (b, backed_up, Qnil);
+      BSET (b, auto_save_file_name, Qnil);
       set_buffer_internal_1 (b);
       Fset (intern ("buffer-save-without-query"), Qnil);
       Fset (intern ("buffer-file-number"), Qnil);
@@ -704,9 +704,10 @@
 void
 reset_buffer (register struct buffer *b)
 {
-  BVAR (b, filename) = Qnil;
-  BVAR (b, file_truename) = Qnil;
-  BVAR (b, directory) = (current_buffer) ? BVAR (current_buffer, directory) : Qnil;
+  BSET (b, filename, Qnil);
+  BSET (b, file_truename, Qnil);
+  BSET (b, directory,
+	(current_buffer) ? BVAR (current_buffer, directory) : Qnil);
   b->modtime = make_emacs_time (0, UNKNOWN_MODTIME_NSECS);
   b->modtime_size = -1;
   XSETFASTINT (BVAR (b, save_length), 0);
@@ -714,24 +715,25 @@
   /* It is more conservative to start out "changed" than "unchanged".  */
   b->clip_changed = 0;
   b->prevent_redisplay_optimizations_p = 1;
-  BVAR (b, backed_up) = Qnil;
+  BSET (b, backed_up, Qnil);
   BUF_AUTOSAVE_MODIFF (b) = 0;
   b->auto_save_failure_time = 0;
-  BVAR (b, auto_save_file_name) = Qnil;
-  BVAR (b, read_only) = Qnil;
+  BSET (b, auto_save_file_name, Qnil);
+  BSET (b, read_only, Qnil);
   buffer_set_overlays (b, NULL, OV_BEFORE);
   buffer_set_overlays (b, NULL, OV_AFTER);
   b->overlay_center = BEG;
-  BVAR (b, mark_active) = Qnil;
-  BVAR (b, point_before_scroll) = Qnil;
-  BVAR (b, file_format) = Qnil;
-  BVAR (b, auto_save_file_format) = Qt;
-  BVAR (b, last_selected_window) = Qnil;
-  XSETINT (BVAR (b, display_count), 0);
-  BVAR (b, display_time) = Qnil;
-  BVAR (b, enable_multibyte_characters) = BVAR (&buffer_defaults, enable_multibyte_characters);
-  BVAR (b, cursor_type) = BVAR (&buffer_defaults, cursor_type);
-  BVAR (b, extra_line_spacing) = BVAR (&buffer_defaults, extra_line_spacing);
+  BSET (b, mark_active, Qnil);
+  BSET (b, point_before_scroll, Qnil);
+  BSET (b, file_format, Qnil);
+  BSET (b, auto_save_file_format, Qt);
+  BSET (b, last_selected_window, Qnil);
+  BSET (b, display_count, make_number (0));
+  BSET (b, display_time, Qnil);
+  BSET (b, enable_multibyte_characters,
+       BVAR (&buffer_defaults, enable_multibyte_characters));
+  BSET (b, cursor_type, BVAR (&buffer_defaults, cursor_type));
+  BSET (b, extra_line_spacing, BVAR (&buffer_defaults, extra_line_spacing));
 
   b->display_error_modiff = 0;
 }
@@ -755,10 +757,10 @@
      things that depend on the major mode.
      default-major-mode is handled at a higher level.
      We ignore it here.  */
-  BVAR (b, major_mode) = Qfundamental_mode;
-  BVAR (b, keymap) = Qnil;
-  BVAR (b, mode_name) = QSFundamental;
-  BVAR (b, minor_modes) = Qnil;
+  BSET (b, major_mode, Qfundamental_mode);
+  BSET (b, keymap, Qnil);
+  BSET (b, mode_name, QSFundamental);
+  BSET (b, minor_modes, Qnil);
 
   /* If the standard case table has been altered and invalidated,
      fix up its insides first.  */
@@ -767,15 +769,15 @@
 	 && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2])))
     Fset_standard_case_table (Vascii_downcase_table);
 
-  BVAR (b, downcase_table) = Vascii_downcase_table;
-  BVAR (b, upcase_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[0];
-  BVAR (b, case_canon_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[1];
-  BVAR (b, case_eqv_table) = XCHAR_TABLE (Vascii_downcase_table)->extras[2];
-  BVAR (b, invisibility_spec) = Qt;
+  BSET (b, downcase_table, Vascii_downcase_table);
+  BSET (b, upcase_table, XCHAR_TABLE (Vascii_downcase_table)->extras[0]);
+  BSET (b, case_canon_table, XCHAR_TABLE (Vascii_downcase_table)->extras[1]);
+  BSET (b, case_eqv_table, XCHAR_TABLE (Vascii_downcase_table)->extras[2]);
+  BSET (b, invisibility_spec, Qt);
 
   /* Reset all (or most) per-buffer variables to their defaults.  */
   if (permanent_too)
-    BVAR (b, local_var_alist) = Qnil;
+    BSET (b, local_var_alist, Qnil);
   else
     {
       Lisp_Object tmp, prop, last = Qnil;
@@ -809,7 +811,7 @@
 	  }
 	/* Delete this local variable.  */
 	else if (NILP (last))
-	  BVAR (b, local_var_alist) = XCDR (tmp);
+	  BSET (b, local_var_alist, XCDR (tmp));
 	else
 	  XSETCDR (last, XCDR (tmp));
     }
@@ -1286,7 +1288,7 @@
 	error ("Buffer name `%s' is in use", SDATA (newname));
     }
 
-  BVAR (current_buffer, name) = newname;
+  BSET (current_buffer, name, newname);
 
   /* Catch redisplay's attention.  Unless we do this, the mode lines for
      any windows displaying current_buffer will stay unchanged.  */
@@ -1431,7 +1433,7 @@
     }
 
   if (EQ (BVAR (XBUFFER (real_buffer), undo_list), Qt))
-    BVAR (XBUFFER (real_buffer), undo_list) = Qnil;
+    BSET (XBUFFER (real_buffer), undo_list, Qnil);
 
   return Qnil;
 }
@@ -1703,7 +1705,7 @@
   swap_out_buffer_local_variables (b);
   reset_buffer_local_variables (b, 1);
 
-  BVAR (b, name) = Qnil;
+  BSET (b, name, Qnil);
 
   BLOCK_INPUT;
   if (b->base_buffer)
@@ -1727,9 +1729,9 @@
       free_region_cache (b->width_run_cache);
       b->width_run_cache = 0;
     }
-  BVAR (b, width_table) = Qnil;
+  BSET (b, width_table, Qnil);
   UNBLOCK_INPUT;
-  BVAR (b, undo_list) = Qnil;
+  BSET (b, undo_list, Qnil);
 
   /* Run buffer-list-update-hook.  */
   if (!NILP (Vrun_hooks))
@@ -1910,7 +1912,7 @@
       /* Put the undo list back in the base buffer, so that it appears
 	 that an indirect buffer shares the undo list of its base.  */
       if (old_buf->base_buffer)
-	BVAR (old_buf->base_buffer, undo_list) = BVAR (old_buf, undo_list);
+	BSET (old_buf->base_buffer, undo_list, BVAR (old_buf, undo_list));
 
       /* If the old current buffer has markers to record PT, BEGV and ZV
 	 when it is not current, update them now.  */
@@ -1920,7 +1922,7 @@
   /* Get the undo list from the base buffer, so that it appears
      that an indirect buffer shares the undo list of its base.  */
   if (b->base_buffer)
-    BVAR (b, undo_list) = BVAR (b->base_buffer, undo_list);
+    BSET (b, undo_list, BVAR (b->base_buffer, undo_list));
 
   /* If the new current buffer has markers to record PT, BEGV and ZV
      when it is not current, fetch them now.  */
@@ -2118,8 +2120,8 @@
 #define swapfield_(field, type) \
   do {							\
     type tmp##field = BVAR (other_buffer, field);		\
-    BVAR (other_buffer, field) = BVAR (current_buffer, field);	\
-    BVAR (current_buffer, field) = tmp##field;			\
+    BSET (other_buffer, field, BVAR (current_buffer, field));	\
+    BSET (current_buffer, field, tmp##field);			\
   } while (0)
 
   swapfield (own_text, struct buffer_text);
@@ -2159,8 +2161,8 @@
   swapfield_ (pt_marker, Lisp_Object);
   swapfield_ (begv_marker, Lisp_Object);
   swapfield_ (zv_marker, Lisp_Object);
-  BVAR (current_buffer, point_before_scroll) = Qnil;
-  BVAR (other_buffer, point_before_scroll) = Qnil;
+  BSET (current_buffer, point_before_scroll, Qnil);
+  BSET (other_buffer, point_before_scroll, Qnil);
 
   current_buffer->text->modiff++;	  other_buffer->text->modiff++;
   current_buffer->text->chars_modiff++;	  other_buffer->text->chars_modiff++;
@@ -2249,7 +2251,7 @@
 
   /* Don't record these buffer changes.  We will put a special undo entry
      instead.  */
-  BVAR (current_buffer, undo_list) = Qt;
+  BSET (current_buffer, undo_list, Qt);
 
   /* If the cached position is for this buffer, clear it out.  */
   clear_charpos_cache (current_buffer);
@@ -2271,7 +2273,7 @@
 	 to calculate the old correspondences.  */
       set_intervals_multibyte (0);
 
-      BVAR (current_buffer, enable_multibyte_characters) = Qnil;
+      BSET (current_buffer, enable_multibyte_characters, Qnil);
 
       Z = Z_BYTE;
       BEGV = BEGV_BYTE;
@@ -2409,7 +2411,7 @@
 
       /* Do this first, so that chars_in_text asks the right question.
 	 set_intervals_multibyte needs it too.  */
-      BVAR (current_buffer, enable_multibyte_characters) = Qt;
+      BSET (current_buffer, enable_multibyte_characters, Qt);
 
       GPT_BYTE = advance_to_char_boundary (GPT_BYTE);
       GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG;
@@ -2467,10 +2469,11 @@
   if (!EQ (old_undo, Qt))
     {
       /* Represent all the above changes by a special undo entry.  */
-      BVAR (current_buffer, undo_list) = Fcons (list3 (Qapply,
-						intern ("set-buffer-multibyte"),
-						NILP (flag) ? Qt : Qnil),
-					 old_undo);
+      BSET (current_buffer, undo_list,
+	    Fcons (list3 (Qapply,
+			  intern ("set-buffer-multibyte"),
+			  NILP (flag) ? Qt : Qnil),
+		   old_undo));
     }
 
   UNGCPRO;
@@ -4929,55 +4932,55 @@
   /* Must do these before making the first buffer! */
 
   /* real setup is done in bindings.el */
-  BVAR (&buffer_defaults, mode_line_format) = build_pure_c_string ("%-");
-  BVAR (&buffer_defaults, header_line_format) = Qnil;
-  BVAR (&buffer_defaults, abbrev_mode) = Qnil;
-  BVAR (&buffer_defaults, overwrite_mode) = Qnil;
-  BVAR (&buffer_defaults, case_fold_search) = Qt;
-  BVAR (&buffer_defaults, auto_fill_function) = Qnil;
-  BVAR (&buffer_defaults, selective_display) = Qnil;
-  BVAR (&buffer_defaults, selective_display_ellipses) = Qt;
-  BVAR (&buffer_defaults, abbrev_table) = Qnil;
-  BVAR (&buffer_defaults, display_table) = Qnil;
-  BVAR (&buffer_defaults, undo_list) = Qnil;
-  BVAR (&buffer_defaults, mark_active) = Qnil;
-  BVAR (&buffer_defaults, file_format) = Qnil;
-  BVAR (&buffer_defaults, auto_save_file_format) = Qt;
+  BSET (&buffer_defaults, mode_line_format, build_pure_c_string ("%-"));
+  BSET (&buffer_defaults, header_line_format, Qnil);
+  BSET (&buffer_defaults, abbrev_mode, Qnil);
+  BSET (&buffer_defaults, overwrite_mode, Qnil);
+  BSET (&buffer_defaults, case_fold_search, Qt);
+  BSET (&buffer_defaults, auto_fill_function, Qnil);
+  BSET (&buffer_defaults, selective_display, Qnil);
+  BSET (&buffer_defaults, selective_display_ellipses, Qt);
+  BSET (&buffer_defaults, abbrev_table, Qnil);
+  BSET (&buffer_defaults, display_table, Qnil);
+  BSET (&buffer_defaults, undo_list, Qnil);
+  BSET (&buffer_defaults, mark_active, Qnil);
+  BSET (&buffer_defaults, file_format, Qnil);
+  BSET (&buffer_defaults, auto_save_file_format, Qt);
   buffer_defaults.overlays_before = NULL;
   buffer_defaults.overlays_after = NULL;
   buffer_defaults.overlay_center = BEG;
 
   XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8);
-  BVAR (&buffer_defaults, truncate_lines) = Qnil;
-  BVAR (&buffer_defaults, word_wrap) = Qnil;
-  BVAR (&buffer_defaults, ctl_arrow) = Qt;
-  BVAR (&buffer_defaults, bidi_display_reordering) = Qt;
-  BVAR (&buffer_defaults, bidi_paragraph_direction) = Qnil;
-  BVAR (&buffer_defaults, cursor_type) = Qt;
-  BVAR (&buffer_defaults, extra_line_spacing) = Qnil;
-  BVAR (&buffer_defaults, cursor_in_non_selected_windows) = Qt;
+  BSET (&buffer_defaults, truncate_lines, Qnil);
+  BSET (&buffer_defaults, word_wrap, Qnil);
+  BSET (&buffer_defaults, ctl_arrow, Qt);
+  BSET (&buffer_defaults, bidi_display_reordering, Qt);
+  BSET (&buffer_defaults, bidi_paragraph_direction, Qnil);
+  BSET (&buffer_defaults, cursor_type, Qt);
+  BSET (&buffer_defaults, extra_line_spacing, Qnil);
+  BSET (&buffer_defaults, cursor_in_non_selected_windows, Qt);
 
-  BVAR (&buffer_defaults, enable_multibyte_characters) = Qt;
-  BVAR (&buffer_defaults, buffer_file_coding_system) = Qnil;
+  BSET (&buffer_defaults, enable_multibyte_characters, Qt);
+  BSET (&buffer_defaults, buffer_file_coding_system, Qnil);
   XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70);
   XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0);
-  BVAR (&buffer_defaults, cache_long_line_scans) = Qnil;
-  BVAR (&buffer_defaults, file_truename) = Qnil;
+  BSET (&buffer_defaults, cache_long_line_scans, Qnil);
+  BSET (&buffer_defaults, file_truename, Qnil);
   XSETFASTINT (BVAR (&buffer_defaults, display_count), 0);
   XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0);
   XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0);
-  BVAR (&buffer_defaults, left_fringe_width) = Qnil;
-  BVAR (&buffer_defaults, right_fringe_width) = Qnil;
-  BVAR (&buffer_defaults, fringes_outside_margins) = Qnil;
-  BVAR (&buffer_defaults, scroll_bar_width) = Qnil;
-  BVAR (&buffer_defaults, vertical_scroll_bar_type) = Qt;
-  BVAR (&buffer_defaults, indicate_empty_lines) = Qnil;
-  BVAR (&buffer_defaults, indicate_buffer_boundaries) = Qnil;
-  BVAR (&buffer_defaults, fringe_indicator_alist) = Qnil;
-  BVAR (&buffer_defaults, fringe_cursor_alist) = Qnil;
-  BVAR (&buffer_defaults, scroll_up_aggressively) = Qnil;
-  BVAR (&buffer_defaults, scroll_down_aggressively) = Qnil;
-  BVAR (&buffer_defaults, display_time) = Qnil;
+  BSET (&buffer_defaults, left_fringe_width, Qnil);
+  BSET (&buffer_defaults, right_fringe_width, Qnil);
+  BSET (&buffer_defaults, fringes_outside_margins, Qnil);
+  BSET (&buffer_defaults, scroll_bar_width, Qnil);
+  BSET (&buffer_defaults, vertical_scroll_bar_type, Qt);
+  BSET (&buffer_defaults, indicate_empty_lines, Qnil);
+  BSET (&buffer_defaults, indicate_buffer_boundaries, Qnil);
+  BSET (&buffer_defaults, fringe_indicator_alist, Qnil);
+  BSET (&buffer_defaults, fringe_cursor_alist, Qnil);
+  BSET (&buffer_defaults, scroll_up_aggressively, Qnil);
+  BSET (&buffer_defaults, scroll_down_aggressively, Qnil);
+  BSET (&buffer_defaults, display_time, Qnil);
 
   /* Assign the local-flags to the slots that have default values.
      The local flag is a bit that is used in the buffer
@@ -4989,24 +4992,24 @@
 
   /* 0 means not a lisp var, -1 means always local, else mask */
   memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
-  XSETINT (BVAR (&buffer_local_flags, filename), -1);
-  XSETINT (BVAR (&buffer_local_flags, directory), -1);
-  XSETINT (BVAR (&buffer_local_flags, backed_up), -1);
-  XSETINT (BVAR (&buffer_local_flags, save_length), -1);
-  XSETINT (BVAR (&buffer_local_flags, auto_save_file_name), -1);
-  XSETINT (BVAR (&buffer_local_flags, read_only), -1);
-  XSETINT (BVAR (&buffer_local_flags, major_mode), -1);
-  XSETINT (BVAR (&buffer_local_flags, mode_name), -1);
-  XSETINT (BVAR (&buffer_local_flags, undo_list), -1);
-  XSETINT (BVAR (&buffer_local_flags, mark_active), -1);
-  XSETINT (BVAR (&buffer_local_flags, point_before_scroll), -1);
-  XSETINT (BVAR (&buffer_local_flags, file_truename), -1);
-  XSETINT (BVAR (&buffer_local_flags, invisibility_spec), -1);
-  XSETINT (BVAR (&buffer_local_flags, file_format), -1);
-  XSETINT (BVAR (&buffer_local_flags, auto_save_file_format), -1);
-  XSETINT (BVAR (&buffer_local_flags, display_count), -1);
-  XSETINT (BVAR (&buffer_local_flags, display_time), -1);
-  XSETINT (BVAR (&buffer_local_flags, enable_multibyte_characters), -1);
+  BSET (&buffer_local_flags, filename, make_number (-1));
+  BSET (&buffer_local_flags, directory, make_number (-1));
+  BSET (&buffer_local_flags, backed_up, make_number (-1));
+  BSET (&buffer_local_flags, save_length, make_number (-1));
+  BSET (&buffer_local_flags, auto_save_file_name, make_number (-1));
+  BSET (&buffer_local_flags, read_only, make_number (-1));
+  BSET (&buffer_local_flags, major_mode, make_number (-1));
+  BSET (&buffer_local_flags, mode_name, make_number (-1));
+  BSET (&buffer_local_flags, undo_list, make_number (-1));
+  BSET (&buffer_local_flags, mark_active, make_number (-1));
+  BSET (&buffer_local_flags, point_before_scroll, make_number (-1));
+  BSET (&buffer_local_flags, file_truename, make_number (-1));
+  BSET (&buffer_local_flags, invisibility_spec, make_number (-1));
+  BSET (&buffer_local_flags, file_format, make_number (-1));
+  BSET (&buffer_local_flags, auto_save_file_format, make_number (-1));
+  BSET (&buffer_local_flags, display_count, make_number (-1));
+  BSET (&buffer_local_flags, display_time, make_number (-1));
+  BSET (&buffer_local_flags, enable_multibyte_characters, make_number (-1));
 
   idx = 1;
   XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx;
@@ -5062,7 +5065,7 @@
   QSFundamental = build_pure_c_string ("Fundamental");
 
   Qfundamental_mode = intern_c_string ("fundamental-mode");
-  BVAR (&buffer_defaults, major_mode) = Qfundamental_mode;
+  BSET (&buffer_defaults, major_mode, Qfundamental_mode);
 
   Qmode_class = intern_c_string ("mode-class");
 
@@ -5125,13 +5128,13 @@
       len++;
     }
 
-  BVAR (current_buffer, directory) = make_unibyte_string (pwd, len);
+  BSET (current_buffer, directory, make_unibyte_string (pwd, len));
   if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))
     /* At this moment, we still don't know how to decode the
        directory name.  So, we keep the bytes in multibyte form so
        that ENCODE_FILE correctly gets the original bytes.  */
-    BVAR (current_buffer, directory)
-      = string_to_multibyte (BVAR (current_buffer, directory));
+    BSET (current_buffer, directory,
+         string_to_multibyte (BVAR (current_buffer, directory)));
 
   /* Add /: to the front of the name
      if it would otherwise be treated as magic.  */
@@ -5142,11 +5145,11 @@
 	 However, it is not necessary to turn / into /:/.
 	 So avoid doing that.  */
       && strcmp ("/", SSDATA (BVAR (current_buffer, directory))))
-    BVAR (current_buffer, directory)
-      = concat2 (build_string ("/:"), BVAR (current_buffer, directory));
+    BSET (current_buffer, directory,
+         concat2 (build_string ("/:"), BVAR (current_buffer, directory)));
 
   temp = get_minibuffer (0);
-  BVAR (XBUFFER (temp), directory) = BVAR (current_buffer, directory);
+  BSET (XBUFFER (temp), directory, BVAR (current_buffer, directory));
 
   free (pwd);
 }

=== modified file 'src/buffer.h'
--- src/buffer.h	2012-08-08 14:47:11 +0000
+++ src/buffer.h	2012-08-10 04:52:39 +0000
@@ -477,6 +477,7 @@
 /* Most code should use this macro to access Lisp fields in struct buffer.  */
 
 #define BVAR(buf, field) ((buf)->INTERNAL_FIELD (field))
+#define BSET(buf, field, value) ((buf)->INTERNAL_FIELD (field) = (value))
 
 /* This is the structure that the buffer Lisp object points to.  */
 

=== modified file 'src/casetab.c'
--- src/casetab.c	2012-06-16 12:24:15 +0000
+++ src/casetab.c	2012-08-10 04:52:39 +0000
@@ -158,10 +158,10 @@
     }
   else
     {
-      BVAR (current_buffer, downcase_table) = table;
-      BVAR (current_buffer, upcase_table) = up;
-      BVAR (current_buffer, case_canon_table) = canon;
-      BVAR (current_buffer, case_eqv_table) = eqv;
+      BSET (current_buffer, downcase_table, table);
+      BSET (current_buffer, upcase_table, up);
+      BSET (current_buffer, case_canon_table, canon);
+      BSET (current_buffer, case_eqv_table, eqv);
     }
 
   return table;

=== modified file 'src/cmds.c'
--- src/cmds.c	2012-08-07 13:37:21 +0000
+++ src/cmds.c	2012-08-10 04:52:39 +0000
@@ -301,7 +301,7 @@
 	 added be explicit calls to undo-boundary.  */
       && EQ (BVAR (current_buffer, undo_list), last_undo_boundary))
     /* Remove the undo_boundary that was just pushed.  */
-    BVAR (current_buffer, undo_list) = XCDR (BVAR (current_buffer, undo_list));
+    BSET (current_buffer, undo_list, XCDR (BVAR (current_buffer, undo_list)));
 
   /* Barf if the key that invoked this was not a character.  */
   if (!CHARACTERP (last_command_event))

=== modified file 'src/coding.c'
--- src/coding.c	2012-08-09 05:14:23 +0000
+++ src/coding.c	2012-08-10 04:52:39 +0000
@@ -7103,7 +7103,7 @@
       if (GPT != PT)
 	move_gap_both (PT, PT_BYTE);
       undo_list = BVAR (current_buffer, undo_list);
-      BVAR (current_buffer, undo_list) = Qt;
+      BSET (current_buffer, undo_list, Qt);
     }
 
   coding->consumed = coding->consumed_char = 0;
@@ -7200,7 +7200,7 @@
     decode_eol (coding);
   if (BUFFERP (coding->dst_object))
     {
-      BVAR (current_buffer, undo_list) = undo_list;
+      BSET (current_buffer, undo_list, undo_list);
       record_insert (coding->dst_pos, coding->produced_char);
     }
   return coding->result;
@@ -7568,8 +7568,8 @@
      doesn't compile new regexps.  */
   Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt);
   Ferase_buffer ();
-  BVAR (current_buffer, undo_list) = Qt;
-  BVAR (current_buffer, enable_multibyte_characters) = multibyte ? Qt : Qnil;
+  BSET (current_buffer, undo_list, Qt);
+  BSET (current_buffer, enable_multibyte_characters, multibyte ? Qt : Qnil);
   set_buffer_internal (current);
   return workbuf;
 }

=== modified file 'src/data.c'
--- src/data.c	2012-08-07 13:37:21 +0000
+++ src/data.c	2012-08-10 04:52:39 +0000
@@ -1211,8 +1211,8 @@
 		       bindings, not for frame-local bindings.  */
 		    eassert (!blv->frame_local);
 		    tem1 = Fcons (symbol, XCDR (blv->defcell));
-		    BVAR (XBUFFER (where), local_var_alist)
-		      = Fcons (tem1, BVAR (XBUFFER (where), local_var_alist));
+		    BSET (XBUFFER (where), local_var_alist,
+			  Fcons (tem1, BVAR (XBUFFER (where), local_var_alist)));
 		  }
 	      }
 
@@ -1651,9 +1651,9 @@
 	 default value.  */
       find_symbol_value (variable);
 
-      BVAR (current_buffer, local_var_alist)
-        = Fcons (Fcons (variable, XCDR (blv->defcell)),
-		 BVAR (current_buffer, local_var_alist));
+      BSET (current_buffer, local_var_alist,
+	    Fcons (Fcons (variable, XCDR (blv->defcell)),
+		   BVAR (current_buffer, local_var_alist)));
 
       /* Make sure symbol does not think it is set up for this buffer;
 	 force it to look once again for this buffer's value.  */
@@ -1721,8 +1721,8 @@
   XSETSYMBOL (variable, sym);	/* Propagate variable indirection.  */
   tem = Fassq (variable, BVAR (current_buffer, local_var_alist));
   if (!NILP (tem))
-    BVAR (current_buffer, local_var_alist)
-      = Fdelq (tem, BVAR (current_buffer, local_var_alist));
+    BSET (current_buffer, local_var_alist,
+	  Fdelq (tem, BVAR (current_buffer, local_var_alist)));
 
   /* If the symbol is set up with the current buffer's binding
      loaded, recompute its value.  We have to do it now, or else

=== modified file 'src/editfns.c'
--- src/editfns.c	2012-08-08 14:47:11 +0000
+++ src/editfns.c	2012-08-10 04:52:39 +0000
@@ -882,7 +882,7 @@
   info = XCDR (info);
   tem = XCAR (info);
   tem1 = BVAR (current_buffer, mark_active);
-  BVAR (current_buffer, mark_active) = tem;
+  BSET (current_buffer, mark_active, tem);
 
   /* If mark is active now, and either was not active
      or was at a different place, run the activate hook.  */
@@ -2816,13 +2816,13 @@
 static Lisp_Object
 subst_char_in_region_unwind (Lisp_Object arg)
 {
-  return BVAR (current_buffer, undo_list) = arg;
+  return BSET (current_buffer, undo_list, arg);
 }
 
 static Lisp_Object
 subst_char_in_region_unwind_1 (Lisp_Object arg)
 {
-  return BVAR (current_buffer, filename) = arg;
+  return BSET (current_buffer, filename, arg);
 }
 
 DEFUN ("subst-char-in-region", Fsubst_char_in_region,
@@ -2896,11 +2896,11 @@
     {
       record_unwind_protect (subst_char_in_region_unwind,
 			     BVAR (current_buffer, undo_list));
-      BVAR (current_buffer, undo_list) = Qt;
+      BSET (current_buffer, undo_list, Qt);
       /* Don't do file-locking.  */
       record_unwind_protect (subst_char_in_region_unwind_1,
 			     BVAR (current_buffer, filename));
-      BVAR (current_buffer, filename) = Qnil;
+      BSET (current_buffer, filename, Qnil);
     }
 
   if (pos_byte < GPT_BYTE)
@@ -2982,7 +2982,7 @@
 		INC_POS (pos_byte_next);
 
 	      if (! NILP (noundo))
-		BVAR (current_buffer, undo_list) = tem;
+		BSET (current_buffer, undo_list, tem);
 
 	      UNGCPRO;
 	    }

=== modified file 'src/fileio.c'
--- src/fileio.c	2012-08-08 14:47:11 +0000
+++ src/fileio.c	2012-08-10 04:52:39 +0000
@@ -3149,8 +3149,8 @@
   TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
 
   /* Now we are safe to change the buffer's multibyteness directly.  */
-  BVAR (current_buffer, enable_multibyte_characters) = multibyte;
-  BVAR (current_buffer, undo_list) = undo_list;
+  BSET (current_buffer, enable_multibyte_characters, multibyte);
+  BSET (current_buffer, undo_list, undo_list);
 
   return Qnil;
 }
@@ -3486,16 +3486,16 @@
 		  buf = XBUFFER (workbuf);
 
 		  delete_all_overlays (buf);
-		  BVAR (buf, directory) = BVAR (current_buffer, directory);
-		  BVAR (buf, read_only) = Qnil;
-		  BVAR (buf, filename) = Qnil;
-		  BVAR (buf, undo_list) = Qt;
+		  BSET (buf, directory, BVAR (current_buffer, directory));
+		  BSET (buf, read_only, Qnil);
+		  BSET (buf, filename, Qnil);
+		  BSET (buf, undo_list, Qt);
 		  eassert (buffer_get_overlays (buf, OV_BEFORE) == NULL);
 		  eassert (buffer_get_overlays (buf, OV_AFTER) == NULL);
 
 		  set_buffer_internal (buf);
 		  Ferase_buffer ();
-		  BVAR (buf, enable_multibyte_characters) = Qnil;
+		  BSET (buf, enable_multibyte_characters, Qnil);
 
 		  insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0);
 		  TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
@@ -4104,8 +4104,8 @@
 	  unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters),
 			       Fcons (BVAR (current_buffer, undo_list),
 				      Fcurrent_buffer ()));
-	  BVAR (current_buffer, enable_multibyte_characters) = Qnil;
-	  BVAR (current_buffer, undo_list) = Qt;
+	  BSET (current_buffer, enable_multibyte_characters, Qnil);
+	  BSET (current_buffer, undo_list, Qt);
 	  record_unwind_protect (decide_coding_unwind, unwind_data);
 
 	  if (inserted > 0 && ! NILP (Vset_auto_coding_function))
@@ -4153,7 +4153,7 @@
 	  && NILP (replace))
 	/* Visiting a file with these coding system makes the buffer
 	   unibyte. */
-	BVAR (current_buffer, enable_multibyte_characters) = Qnil;
+	BSET (current_buffer, enable_multibyte_characters, Qnil);
     }
 
   coding.dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
@@ -4196,13 +4196,13 @@
   if (!NILP (visit))
     {
       if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange)
-	BVAR (current_buffer, undo_list) = Qnil;
+	BSET (current_buffer, undo_list, Qnil);
 
       if (NILP (handler))
 	{
 	  current_buffer->modtime = mtime;
 	  current_buffer->modtime_size = st.st_size;
-	  BVAR (current_buffer, filename) = orig_filename;
+	  BSET (current_buffer, filename, orig_filename);
 	}
 
       SAVE_MODIFF = MODIFF;
@@ -4247,7 +4247,7 @@
 
       /* Save old undo list and don't record undo for decoding.  */
       old_undo = BVAR (current_buffer, undo_list);
-      BVAR (current_buffer, undo_list) = Qt;
+      BSET (current_buffer, undo_list, Qt);
 
       if (NILP (replace))
 	{
@@ -4339,7 +4339,7 @@
 
       if (NILP (visit))
 	{
-	  BVAR (current_buffer, undo_list) = old_undo;
+	  BSET (current_buffer, undo_list, old_undo);
 	  if (CONSP (old_undo) && inserted != old_inserted)
 	    {
 	      /* Adjust the last undo record for the size change during
@@ -4354,7 +4354,7 @@
       else
 	/* If undo_list was Qt before, keep it that way.
 	   Otherwise start with an empty undo_list.  */
-	BVAR (current_buffer, undo_list) = EQ (old_undo, Qt) ? Qt : Qnil;
+	BSET (current_buffer, undo_list, EQ (old_undo, Qt) ? Qt : Qnil);
 
       unbind_to (count1, Qnil);
     }
@@ -4594,7 +4594,7 @@
 	{
 	  SAVE_MODIFF = MODIFF;
 	  XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
-	  BVAR (current_buffer, filename) = visit_file;
+	  BSET (current_buffer, filename, visit_file);
 	}
       UNGCPRO;
       return val;
@@ -4810,7 +4810,7 @@
     {
       SAVE_MODIFF = MODIFF;
       XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
-      BVAR (current_buffer, filename) = visit_file;
+      BSET (current_buffer, filename, visit_file);
       update_mode_lines++;
     }
   else if (quietly)

=== modified file 'src/frame.c'
--- src/frame.c	2012-08-07 07:33:18 +0000
+++ src/frame.c	2012-08-10 04:52:39 +0000
@@ -1677,7 +1677,7 @@
       w = XWINDOW (window);
 
       if (!NILP (w->buffer))
-	BVAR (XBUFFER (w->buffer), display_time) = Fcurrent_time ();
+	BSET (XBUFFER (w->buffer), display_time, Fcurrent_time ());
 
       if (!NILP (w->vchild))
 	make_frame_visible_1 (w->vchild);

=== modified file 'src/indent.c'
--- src/indent.c	2012-08-08 14:47:11 +0000
+++ src/indent.c	2012-08-10 04:52:39 +0000
@@ -141,7 +141,7 @@
   struct Lisp_Vector *widthtab;
 
   if (!VECTORP (BVAR (buf, width_table)))
-    BVAR (buf, width_table) = Fmake_vector (make_number (256), make_number (0));
+    BSET (buf, width_table, Fmake_vector (make_number (256), make_number (0)));
   widthtab = XVECTOR (BVAR (buf, width_table));
   if (widthtab->header.size != 256)
     abort ();
@@ -166,7 +166,7 @@
         {
           free_region_cache (current_buffer->width_run_cache);
           current_buffer->width_run_cache = 0;
-          BVAR (current_buffer, width_table) = Qnil;
+          BSET (current_buffer, width_table, Qnil);
         }
     }
   else

=== modified file 'src/insdel.c'
--- src/insdel.c	2012-08-08 14:47:11 +0000
+++ src/insdel.c	2012-08-10 04:52:39 +0000
@@ -1792,7 +1792,7 @@
   if (! preserve_chars_modiff)
     CHARS_MODIFF = MODIFF;
 
-  BVAR (buffer, point_before_scroll) = Qnil;
+  BSET (buffer, point_before_scroll, Qnil);
 
   if (buffer != old_buffer)
     set_buffer_internal (old_buffer);

=== modified file 'src/intervals.c'
--- src/intervals.c	2012-08-08 14:47:11 +0000
+++ src/intervals.c	2012-08-10 04:52:39 +0000
@@ -1857,7 +1857,7 @@
   int have_overlays;
   ptrdiff_t original_position;
 
-  BVAR (current_buffer, point_before_scroll) = Qnil;
+  BSET (current_buffer, point_before_scroll, Qnil);
 
   if (charpos == PT)
     return;

=== modified file 'src/keymap.c'
--- src/keymap.c	2012-08-07 07:33:18 +0000
+++ src/keymap.c	2012-08-10 04:52:39 +0000
@@ -1854,7 +1854,7 @@
   if (!NILP (keymap))
     keymap = get_keymap (keymap, 1, 1);
 
-  BVAR (current_buffer, keymap) = keymap;
+  BSET (current_buffer, keymap, keymap);
 
   return Qnil;
 }

=== modified file 'src/minibuf.c'
--- src/minibuf.c	2012-08-07 07:33:18 +0000
+++ src/minibuf.c	2012-08-10 04:52:39 +0000
@@ -562,11 +562,11 @@
 
   /* Defeat (setq-default truncate-lines t), since truncated lines do
      not work correctly in minibuffers.  (Bug#5715, etc)  */
-  BVAR (current_buffer, truncate_lines) = Qnil;
+  BSET (current_buffer, truncate_lines, Qnil);
 
   /* If appropriate, copy enable-multibyte-characters into the minibuffer.  */
   if (inherit_input_method)
-    BVAR (current_buffer, enable_multibyte_characters) = enable_multibyte;
+    BSET (current_buffer, enable_multibyte_characters, enable_multibyte);
 
   /* The current buffer's default directory is usually the right thing
      for our minibuffer here.  However, if you're typing a command at
@@ -577,7 +577,7 @@
      you think of something better to do?  Find another buffer with a
      better directory, and use that one instead.  */
   if (STRINGP (ambient_dir))
-    BVAR (current_buffer, directory) = ambient_dir;
+    BSET (current_buffer, directory, ambient_dir);
   else
     {
       Lisp_Object buf_list;
@@ -591,7 +591,8 @@
 	  other_buf = XCDR (XCAR (buf_list));
 	  if (STRINGP (BVAR (XBUFFER (other_buf), directory)))
 	    {
-	      BVAR (current_buffer, directory) = BVAR (XBUFFER (other_buf), directory);
+	      BSET (current_buffer, directory,
+                   BVAR (XBUFFER (other_buf), directory));
 	      break;
 	    }
 	}
@@ -664,7 +665,7 @@
     }
 
   clear_message (1, 1);
-  BVAR (current_buffer, keymap) = map;
+  BSET (current_buffer, keymap, map);
 
   /* Turn on an input method stored in INPUT_METHOD if any.  */
   if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method)))
@@ -673,7 +674,7 @@
   Frun_hooks (1, &Qminibuffer_setup_hook);
 
   /* Don't allow the user to undo past this point.  */
-  BVAR (current_buffer, undo_list) = Qnil;
+  BSET (current_buffer, undo_list, Qnil);
 
   recursive_edit_1 ();
 

=== modified file 'src/print.c'
--- src/print.c	2012-08-08 14:47:11 +0000
+++ src/print.c	2012-08-10 04:52:39 +0000
@@ -494,14 +494,14 @@
 
   Fkill_all_local_variables ();
   delete_all_overlays (current_buffer);
-  BVAR (current_buffer, directory) = BVAR (old, directory);
-  BVAR (current_buffer, read_only) = Qnil;
-  BVAR (current_buffer, filename) = Qnil;
-  BVAR (current_buffer, undo_list) = Qt;
+  BSET (current_buffer, directory, BVAR (old, directory));
+  BSET (current_buffer, read_only, Qnil);
+  BSET (current_buffer, filename, Qnil);
+  BSET (current_buffer, undo_list, Qt);
   eassert (buffer_get_overlays (NULL, OV_BEFORE) == NULL);
   eassert (buffer_get_overlays (NULL, OV_AFTER) == NULL);
-  BVAR (current_buffer, enable_multibyte_characters)
-    = BVAR (&buffer_defaults, enable_multibyte_characters);
+  BSET (current_buffer, enable_multibyte_characters,
+       BVAR (&buffer_defaults, enable_multibyte_characters));
   specbind (Qinhibit_read_only, Qt);
   specbind (Qinhibit_modification_hooks, Qt);
   Ferase_buffer ();

=== modified file 'src/process.c'
--- src/process.c	2012-08-07 07:42:34 +0000
+++ src/process.c	2012-08-10 04:52:39 +0000
@@ -5246,7 +5246,7 @@
       old_begv_byte = BEGV_BYTE;
       old_zv_byte = ZV_BYTE;
 
-      BVAR (current_buffer, read_only) = Qnil;
+      BSET (current_buffer, read_only, Qnil);
 
       /* Insert new output into buffer
 	 at the current end-of-output marker,
@@ -5337,7 +5337,7 @@
 	Fnarrow_to_region (make_number (old_begv), make_number (old_zv));
 
 
-      BVAR (current_buffer, read_only) = old_read_only;
+      BSET (current_buffer, read_only, old_read_only);
       SET_PT_BOTH (opoint, opoint_byte);
     }
   /* Handling the process output should not deactivate the mark.  */
@@ -6671,13 +6671,13 @@
 	      before_byte = PT_BYTE;
 
 	      tem = BVAR (current_buffer, read_only);
-	      BVAR (current_buffer, read_only) = Qnil;
+	      BSET (current_buffer, read_only, Qnil);
 	      insert_string ("\nProcess ");
 	      { /* FIXME: temporary kludge */
 		Lisp_Object tem2 = p->name; Finsert (1, &tem2); }
 	      insert_string (" ");
 	      Finsert (1, &msg);
-	      BVAR (current_buffer, read_only) = tem;
+	      BSET (current_buffer, read_only, tem);
 	      set_marker_both (p->mark, p->buffer, PT, PT_BYTE);
 
 	      if (opoint >= before)

=== modified file 'src/syntax.c'
--- src/syntax.c	2012-08-08 06:11:29 +0000
+++ src/syntax.c	2012-08-10 04:52:39 +0000
@@ -836,7 +836,7 @@
 {
   int idx;
   check_syntax_table (table);
-  BVAR (current_buffer, syntax_table) = table;
+  BSET (current_buffer, syntax_table, table);
   /* Indicate that this buffer now has a specified syntax table.  */
   idx = PER_BUFFER_VAR_IDX (syntax_table);
   SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);

=== modified file 'src/undo.c'
--- src/undo.c	2012-07-10 23:24:36 +0000
+++ src/undo.c	2012-08-10 04:52:39 +0000
@@ -104,8 +104,9 @@
   if (at_boundary
       && current_buffer == last_boundary_buffer
       && last_boundary_position != pt)
-    BVAR (current_buffer, undo_list)
-      = Fcons (make_number (last_boundary_position), BVAR (current_buffer, undo_list));
+    BSET (current_buffer, undo_list,
+	  Fcons (make_number (last_boundary_position),
+		 BVAR (current_buffer, undo_list)));
 }
 
 /* Record an insertion that just happened or is about to happen,
@@ -141,8 +142,8 @@
 
   XSETFASTINT (lbeg, beg);
   XSETINT (lend, beg + length);
-  BVAR (current_buffer, undo_list) = Fcons (Fcons (lbeg, lend),
-                                     BVAR (current_buffer, undo_list));
+  BSET (current_buffer, undo_list,
+	Fcons (Fcons (lbeg, lend), BVAR (current_buffer, undo_list)));
 }
 
 /* Record that a deletion is about to take place,
@@ -167,8 +168,8 @@
       record_point (beg);
     }
 
-  BVAR (current_buffer, undo_list)
-    = Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list));
+  BSET (current_buffer, undo_list,
+       Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list)));
 }
 
 /* Record the fact that MARKER is about to be adjusted by ADJUSTMENT.
@@ -190,9 +191,9 @@
     Fundo_boundary ();
   last_undo_buffer = current_buffer;
 
-  BVAR (current_buffer, undo_list)
-    = Fcons (Fcons (marker, make_number (adjustment)),
-	     BVAR (current_buffer, undo_list));
+  BSET (current_buffer, undo_list,
+	Fcons (Fcons (marker, make_number (adjustment)),
+	       BVAR (current_buffer, undo_list)));
 }
 
 /* Record that a replacement is about to take place,
@@ -225,9 +226,9 @@
   if (base_buffer->base_buffer)
     base_buffer = base_buffer->base_buffer;
 
-  BVAR (current_buffer, undo_list) =
-    Fcons (Fcons (Qt, make_lisp_time (base_buffer->modtime)),
-	   BVAR (current_buffer, undo_list));
+  BSET (current_buffer, undo_list,
+	Fcons (Fcons (Qt, make_lisp_time (base_buffer->modtime)),
+	       BVAR (current_buffer, undo_list)));
 }
 
 /* Record a change in property PROP (whose old value was VAL)
@@ -265,7 +266,8 @@
   XSETINT (lbeg, beg);
   XSETINT (lend, beg + length);
   entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend))));
-  BVAR (current_buffer, undo_list) = Fcons (entry, BVAR (current_buffer, undo_list));
+  BSET (current_buffer, undo_list,
+	Fcons (entry, BVAR (current_buffer, undo_list)));
 
   current_buffer = obuf;
 }
@@ -288,11 +290,11 @@
 	  /* If we have preallocated the cons cell to use here,
 	     use that one.  */
 	  XSETCDR (pending_boundary, BVAR (current_buffer, undo_list));
-	  BVAR (current_buffer, undo_list) = pending_boundary;
+	  BSET (current_buffer, undo_list, pending_boundary);
 	  pending_boundary = Qnil;
 	}
       else
-	BVAR (current_buffer, undo_list) = Fcons (Qnil, BVAR (current_buffer, undo_list));
+	BSET (current_buffer, undo_list, Fcons (Qnil, BVAR (current_buffer, undo_list)));
     }
   last_boundary_position = PT;
   last_boundary_buffer = current_buffer;
@@ -433,7 +435,7 @@
     XSETCDR (last_boundary, Qnil);
   /* There's nothing we decided to keep, so clear it out.  */
   else
-    BVAR (b, undo_list) = Qnil;
+    BSET (b, undo_list, Qnil);
 
   unbind_to (count, Qnil);
 }
@@ -648,8 +650,8 @@
      will work right.  */
   if (did_apply
       && EQ (oldlist, BVAR (current_buffer, undo_list)))
-    BVAR (current_buffer, undo_list)
-      = Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list));
+    BSET (current_buffer, undo_list,
+	  Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list)));
 
   UNGCPRO;
   return unbind_to (count, list);

=== modified file 'src/w32fns.c'
--- src/w32fns.c	2012-08-07 07:33:18 +0000
+++ src/w32fns.c	2012-08-10 04:52:39 +0000
@@ -5212,7 +5212,7 @@
   Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
   old_buffer = current_buffer;
   set_buffer_internal_1 (XBUFFER (buffer));
-  BVAR (current_buffer, truncate_lines) = Qnil;
+  BSET (current_buffer, truncate_lines, Qnil);
   specbind (Qinhibit_read_only, Qt);
   specbind (Qinhibit_modification_hooks, Qt);
   Ferase_buffer ();
@@ -5642,7 +5642,7 @@
   /* Display the tooltip text in a temporary buffer.  */
   old_buffer = current_buffer;
   set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
-  BVAR (current_buffer, truncate_lines) = Qnil;
+  BSET (current_buffer, truncate_lines, Qnil);
   clear_glyph_matrix (w->desired_matrix);
   clear_glyph_matrix (w->current_matrix);
   SET_TEXT_POS (pos, BEGV, BEGV_BYTE);

=== modified file 'src/window.c'
--- src/window.c	2012-08-07 07:33:18 +0000
+++ src/window.c	2012-08-10 04:52:39 +0000
@@ -373,7 +373,7 @@
 
   Fset_buffer (w->buffer);
 
-  BVAR (XBUFFER (w->buffer), last_selected_window) = window;
+  BSET (XBUFFER (w->buffer), last_selected_window, window);
 
   /* Go to the point recorded in the window.
      This is important when the buffer is in more
@@ -1812,7 +1812,7 @@
 
   if (WINDOWP (BVAR (b, last_selected_window))
       && w == XWINDOW (BVAR (b, last_selected_window)))
-    BVAR (b, last_selected_window) = Qnil;
+    BSET (b, last_selected_window, Qnil);
 }
 
 /* Put NEW into the window structure in place of OLD.  SETFLAG zero
@@ -2990,15 +2990,15 @@
   WSET (w, buffer, buffer);
 
   if (EQ (window, selected_window))
-    BVAR (b, last_selected_window) = window;
+    BSET (b, last_selected_window, window);
 
   /* Let redisplay errors through.  */
   b->display_error_modiff = 0;
 
   /* Update time stamps of buffer display.  */
   if (INTEGERP (BVAR (b, display_count)))
-    XSETINT (BVAR (b, display_count), XINT (BVAR (b, display_count)) + 1);
-  BVAR (b, display_time) = Fcurrent_time ();
+    BSET (b, display_count, make_number (XINT (BVAR (b, display_count)) + 1));
+  BSET (b, display_time, Fcurrent_time ());
 
   WSET (w, window_end_pos, make_number (0));
   WSET (w, window_end_vpos, make_number (0));
@@ -3189,7 +3189,7 @@
   register Lisp_Object window;
   register struct window *w;
 
-  BVAR (XBUFFER (buf), directory) = BVAR (current_buffer, directory);
+  BSET (XBUFFER (buf), directory, BVAR (current_buffer, directory));
 
   Fset_buffer (buf);
   BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF;

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2012-08-08 19:53:44 +0000
+++ src/xdisp.c	2012-08-10 04:52:39 +0000
@@ -9318,7 +9318,7 @@
       old_deactivate_mark = Vdeactivate_mark;
       oldbuf = current_buffer;
       Fset_buffer (Fget_buffer_create (Vmessages_buffer_name));
-      BVAR (current_buffer, undo_list) = Qt;
+      BSET (current_buffer, undo_list, Qt);
 
       oldpoint = message_dolog_marker1;
       set_marker_restricted (oldpoint, make_number (PT), Qnil);
@@ -9880,7 +9880,7 @@
 	old_buffer = echo_buffer[i];
 	echo_buffer[i] = Fget_buffer_create
 	  (make_formatted_string (name, " *Echo Area %d*", i));
-	BVAR (XBUFFER (echo_buffer[i]), truncate_lines) = Qnil;
+	BSET (XBUFFER (echo_buffer[i]), truncate_lines, Qnil);
 	/* to force word wrap in echo area -
 	   it was decided to postpone this*/
 	/* XBUFFER (echo_buffer[i])->word_wrap = Qt; */
@@ -9973,8 +9973,8 @@
       set_marker_both (w->pointm, buffer, BEG, BEG_BYTE);
     }
 
-  BVAR (current_buffer, undo_list) = Qt;
-  BVAR (current_buffer, read_only) = Qnil;
+  BSET (current_buffer, undo_list, Qt);
+  BSET (current_buffer, read_only, Qnil);
   specbind (Qinhibit_read_only, Qt);
   specbind (Qinhibit_modification_hooks, Qt);
 
@@ -10087,7 +10087,7 @@
 
       /* Switch to that buffer and clear it.  */
       set_buffer_internal (XBUFFER (echo_area_buffer[0]));
-      BVAR (current_buffer, truncate_lines) = Qnil;
+      BSET (current_buffer, truncate_lines, Qnil);
 
       if (Z > BEG)
 	{
@@ -10130,7 +10130,7 @@
 	{
 	  /* Someone switched buffers between print requests.  */
 	  set_buffer_internal (XBUFFER (echo_area_buffer[0]));
-	  BVAR (current_buffer, truncate_lines) = Qnil;
+	  BSET (current_buffer, truncate_lines, Qnil);
 	}
     }
 }
@@ -10582,9 +10582,9 @@
       != !NILP (BVAR (current_buffer, enable_multibyte_characters)))
     Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil);
 
-  BVAR (current_buffer, truncate_lines) = message_truncate_lines ? Qt : Qnil;
+  BSET (current_buffer, truncate_lines, message_truncate_lines ? Qt : Qnil);
   if (!NILP (BVAR (current_buffer, bidi_display_reordering)))
-    BVAR (current_buffer, bidi_paragraph_direction) = Qleft_to_right;
+    BSET (current_buffer, bidi_paragraph_direction, Qleft_to_right);
 
   /* Insert new message at BEG.  */
   TEMP_SET_PT_BOTH (BEG, BEG_BYTE);

=== modified file 'src/xfns.c'
--- src/xfns.c	2012-08-07 07:33:18 +0000
+++ src/xfns.c	2012-08-10 04:52:39 +0000
@@ -4595,7 +4595,7 @@
   Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
   old_buffer = current_buffer;
   set_buffer_internal_1 (XBUFFER (buffer));
-  BVAR (current_buffer, truncate_lines) = Qnil;
+  BSET (current_buffer, truncate_lines, Qnil);
   specbind (Qinhibit_read_only, Qt);
   specbind (Qinhibit_modification_hooks, Qt);
   Ferase_buffer ();
@@ -5092,7 +5092,7 @@
   /* Display the tooltip text in a temporary buffer.  */
   old_buffer = current_buffer;
   set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
-  BVAR (current_buffer, truncate_lines) = Qnil;
+  BSET (current_buffer, truncate_lines, Qnil);
   clear_glyph_matrix (w->desired_matrix);
   clear_glyph_matrix (w->current_matrix);
   SET_TEXT_POS (pos, BEGV, BEGV_BYTE);


[-- Attachment #3: kset.patch --]
[-- Type: text/plain, Size: 20684 bytes --]

=== modified file 'src/callint.c'
--- src/callint.c	2012-08-05 15:47:28 +0000
+++ src/callint.c	2012-08-10 05:04:01 +0000
@@ -372,7 +372,7 @@
       Vthis_command = save_this_command;
       Vthis_original_command = save_this_original_command;
       Vreal_this_command = save_real_this_command;
-      KVAR (current_kboard, Vlast_command) = save_last_command;
+      KSET (current_kboard, Vlast_command, save_last_command);
 
       temporarily_switch_to_single_kboard (NULL);
       return unbind_to (speccount, apply1 (function, specs));
@@ -843,7 +843,7 @@
   Vthis_command = save_this_command;
   Vthis_original_command = save_this_original_command;
   Vreal_this_command = save_real_this_command;
-  KVAR (current_kboard, Vlast_command) = save_last_command;
+  KSET (current_kboard, Vlast_command, save_last_command);
 
   {
     Lisp_Object val;

=== modified file 'src/category.c'
--- src/category.c	2012-08-02 07:31:34 +0000
+++ src/category.c	2012-08-10 05:04:01 +0000
@@ -285,7 +285,7 @@
 {
   int idx;
   table = check_category_table (table);
-  BVAR (current_buffer, category_table) = table;
+  BSET (current_buffer, category_table, table);
   /* Indicate that this buffer now has a specified category table.  */
   idx = PER_BUFFER_VAR_IDX (category_table);
   SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);

=== modified file 'src/frame.c'
--- src/frame.c	2012-08-10 04:52:39 +0000
+++ src/frame.c	2012-08-10 05:04:01 +0000
@@ -393,8 +393,8 @@
           XSETFRAME (frame_dummy, f);
           GCPRO1 (frame_dummy);
 	  /* If there's no minibuffer frame to use, create one.  */
-	  KVAR (kb, Vdefault_minibuffer_frame) =
-	    call1 (intern ("make-initial-minibuffer-frame"), display);
+	  KSET (kb, Vdefault_minibuffer_frame,
+		call1 (intern ("make-initial-minibuffer-frame"), display));
           UNGCPRO;
 	}
 
@@ -843,7 +843,7 @@
   (Lisp_Object event)
 {
   /* Preserve prefix arg that the command loop just cleared.  */
-  KVAR (current_kboard, Vprefix_arg) = Vcurrent_prefix_arg;
+  KSET (current_kboard, Vprefix_arg, Vcurrent_prefix_arg);
   Frun_hooks (1, &Qmouse_leave_buffer_hook);
   return do_switch_frame (event, 0, 0, Qnil);
 }
@@ -1435,11 +1435,11 @@
 	  if (NILP (frame_with_minibuf))
 	    abort ();
 
-	  KVAR (kb, Vdefault_minibuffer_frame) = frame_with_minibuf;
+	  KSET (kb, Vdefault_minibuffer_frame, frame_with_minibuf);
 	}
       else
 	/* No frames left on this kboard--say no minibuffer either.  */
-	KVAR (kb, Vdefault_minibuffer_frame) = Qnil;
+	KSET (kb, Vdefault_minibuffer_frame, Qnil);
     }
 
   /* Cause frame titles to update--necessary if we now have just one frame.  */

=== modified file 'src/keyboard.c'
--- src/keyboard.c	2012-08-08 15:53:52 +0000
+++ src/keyboard.c	2012-08-10 05:04:01 +0000
@@ -551,8 +551,8 @@
       else if (STRINGP (echo_string))
 	echo_string = concat2 (echo_string, build_string (" "));
 
-      KVAR (current_kboard, echo_string)
-	= concat2 (echo_string, make_string (buffer, ptr - buffer));
+      KSET (current_kboard, echo_string,
+	    concat2 (echo_string, make_string (buffer, ptr - buffer)));
 
       echo_now ();
     }
@@ -597,8 +597,8 @@
 
   /* Put a dash at the end of the buffer temporarily,
      but make it go away when the next character is added.  */
-  KVAR (current_kboard, echo_string) = concat2 (KVAR (current_kboard, echo_string),
-					 build_string ("-"));
+  KSET (current_kboard, echo_string,
+	concat2 (KVAR (current_kboard, echo_string), build_string ("-")));
   echo_now ();
 }
 
@@ -660,7 +660,7 @@
 {
   current_kboard->immediate_echo = 0;
   current_kboard->echo_after_prompt = -1;
-  KVAR (current_kboard, echo_string) = Qnil;
+  KSET (current_kboard, echo_string, Qnil);
   ok_to_echo_at_next_pause = NULL;
   echo_kboard = NULL;
   echo_message_buffer = Qnil;
@@ -684,9 +684,9 @@
 echo_truncate (ptrdiff_t nchars)
 {
   if (STRINGP (KVAR (current_kboard, echo_string)))
-    KVAR (current_kboard, echo_string)
-      = Fsubstring (KVAR (current_kboard, echo_string),
-		    make_number (0), make_number (nchars));
+    KSET (current_kboard, echo_string,
+	  Fsubstring (KVAR (current_kboard, echo_string),
+		      make_number (0), make_number (nchars)));
   truncate_echo_area (nchars);
 }
 
@@ -1016,8 +1016,8 @@
   Vstandard_input = Qt;
   Vexecuting_kbd_macro = Qnil;
   executing_kbd_macro = Qnil;
-  KVAR (current_kboard, Vprefix_arg) = Qnil;
-  KVAR (current_kboard, Vlast_prefix_arg) = Qnil;
+  KSET (current_kboard, Vprefix_arg, Qnil);
+  KSET (current_kboard, Vlast_prefix_arg, Qnil);
   cancel_echoing ();
 
   /* Avoid unquittable loop if data contains a circular list.  */
@@ -1338,8 +1338,8 @@
 #endif
   int already_adjusted = 0;
 
-  KVAR (current_kboard, Vprefix_arg) = Qnil;
-  KVAR (current_kboard, Vlast_prefix_arg) = Qnil;
+  KSET (current_kboard, Vprefix_arg, Qnil);
+  KSET (current_kboard, Vlast_prefix_arg, Qnil);
   Vdeactivate_mark = Qnil;
   waiting_for_input = 0;
   cancel_echoing ();
@@ -1371,10 +1371,10 @@
     }
 
   /* Do this after running Vpost_command_hook, for consistency.  */
-  KVAR (current_kboard, Vlast_command) = Vthis_command;
-  KVAR (current_kboard, Vreal_last_command) = Vreal_this_command;
+  KSET (current_kboard, Vlast_command, Vthis_command);
+  KSET (current_kboard, Vreal_last_command, Vreal_this_command);
   if (!CONSP (last_command_event))
-    KVAR (current_kboard, Vlast_repeatable_command) = Vreal_this_command;
+    KSET (current_kboard, Vlast_repeatable_command, Vreal_this_command);
 
   while (1)
     {
@@ -1537,7 +1537,7 @@
 	  keys = Fkey_description (keys, Qnil);
 	  bitch_at_user ();
 	  message_with_string ("%s is undefined", keys, 0);
-	  KVAR (current_kboard, defining_kbd_macro) = Qnil;
+	  KSET (current_kboard, defining_kbd_macro, Qnil);
 	  update_mode_lines = 1;
 	  /* If this is a down-mouse event, don't reset prefix-arg;
 	     pass it to the command run by the up event.  */
@@ -1547,10 +1547,10 @@
 		= parse_modifiers (EVENT_HEAD (last_command_event));
 	      int modifiers = XINT (XCAR (XCDR (breakdown)));
 	      if (!(modifiers & down_modifier))
-		KVAR (current_kboard, Vprefix_arg) = Qnil;
+		KSET (current_kboard, Vprefix_arg, Qnil);
 	    }
 	  else
-	    KVAR (current_kboard, Vprefix_arg) = Qnil;
+	    KSET (current_kboard, Vprefix_arg, Qnil);
 	}
       else
 	{
@@ -1587,7 +1587,7 @@
             unbind_to (scount, Qnil);
 #endif
           }
-      KVAR (current_kboard, Vlast_prefix_arg) = Vcurrent_prefix_arg;
+      KSET (current_kboard, Vlast_prefix_arg, Vcurrent_prefix_arg);
 
       safe_run_hooks (Qpost_command_hook);
 
@@ -1618,11 +1618,10 @@
       if (NILP (KVAR (current_kboard, Vprefix_arg))
 	  || CONSP (last_command_event))
 	{
-	  KVAR (current_kboard, Vlast_command) = Vthis_command;
-	  KVAR (current_kboard, Vreal_last_command) = Vreal_this_command;
+	  KSET (current_kboard, Vlast_command, Vthis_command);
+	  KSET (current_kboard, Vreal_last_command, Vreal_this_command);
 	  if (!CONSP (last_command_event))
-	    KVAR (current_kboard, Vlast_repeatable_command)
-	      = Vreal_this_command;
+	    KSET (current_kboard, Vlast_repeatable_command, Vreal_this_command);
 	  cancel_echoing ();
 	  this_command_key_count = 0;
 	  this_command_key_count_reset = 0;
@@ -2565,7 +2564,7 @@
 		  abort ();
 	      }
 	    if (!CONSP (last))
-	      KVAR (kb, kbd_queue) = Fcons (c, Qnil);
+	      KSET (kb, kbd_queue, Fcons (c, Qnil));
 	    else
 	      XSETCDR (last, Fcons (c, Qnil));
 	    kb->kbd_queue_has_data = 1;
@@ -2737,8 +2736,8 @@
 	  if (!CONSP (KVAR (current_kboard, kbd_queue)))
 	    abort ();
 	  c = XCAR (KVAR (current_kboard, kbd_queue));
-	  KVAR (current_kboard, kbd_queue)
-	    = XCDR (KVAR (current_kboard, kbd_queue));
+	  KSET (current_kboard, kbd_queue,
+		XCDR (KVAR (current_kboard, kbd_queue)));
 	  if (NILP (KVAR (current_kboard, kbd_queue)))
 	    current_kboard->kbd_queue_has_data = 0;
 	  input_pending = readable_events (0);
@@ -2805,7 +2804,7 @@
 		abort ();
 	    }
 	  if (!CONSP (last))
-	    KVAR (kb, kbd_queue) = Fcons (c, Qnil);
+	    KSET (kb, kbd_queue, Fcons (c, Qnil));
 	  else
 	    XSETCDR (last, Fcons (c, Qnil));
 	  kb->kbd_queue_has_data = 1;
@@ -3063,7 +3062,7 @@
 
       cancel_echoing ();
       ok_to_echo_at_next_pause = saved_ok_to_echo;
-      KVAR (current_kboard, echo_string) = saved_echo_string;
+      KSET (current_kboard, echo_string, saved_echo_string);
       current_kboard->echo_after_prompt = saved_echo_after_prompt;
       if (saved_immediate_echo)
 	echo_now ();
@@ -3534,9 +3533,9 @@
 
 	  if (single_kboard && kb != current_kboard)
 	    {
-	      KVAR (kb, kbd_queue)
-		= Fcons (make_lispy_switch_frame (event->frame_or_window),
-			 Fcons (make_number (c), Qnil));
+	      KSET (kb, kbd_queue,
+		    Fcons (make_lispy_switch_frame (event->frame_or_window),
+			   Fcons (make_number (c), Qnil)));
 	      kb->kbd_queue_has_data = 1;
 	      for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++)
 		{
@@ -5408,7 +5407,7 @@
 	  /* We need to use an alist rather than a vector as the cache
 	     since we can't make a vector long enough.  */
 	  if (NILP (KVAR (current_kboard, system_key_syms)))
-	    KVAR (current_kboard, system_key_syms) = Fcons (Qnil, Qnil);
+	    KSET (current_kboard, system_key_syms, Fcons (Qnil, Qnil));
 	  return modify_event_symbol (event->code,
 				      event->modifiers,
 				      Qfunction_key,
@@ -8729,11 +8728,11 @@
 	 is not used on replay.
 	 */
       orig_defn_macro = KVAR (current_kboard, defining_kbd_macro);
-      KVAR (current_kboard, defining_kbd_macro) = Qnil;
+      KSET (current_kboard, defining_kbd_macro, Qnil);
       do
 	obj = read_char (commandflag, 0, 0, Qt, 0, NULL);
       while (BUFFERP (obj));
-      KVAR (current_kboard, defining_kbd_macro) = orig_defn_macro;
+      KSET (current_kboard, defining_kbd_macro, orig_defn_macro);
 
       if (!INTEGERP (obj))
 	return obj;
@@ -9089,7 +9088,7 @@
 	  /* Install the string STR as the beginning of the string of
 	     echoing, so that it serves as a prompt for the next
 	     character.  */
-	  KVAR (current_kboard, echo_string) = prompt;
+	  KSET (current_kboard, echo_string, prompt);
 	  current_kboard->echo_after_prompt = SCHARS (prompt);
 	  echo_now ();
 	}
@@ -9335,15 +9334,15 @@
 
 		if (!NILP (delayed_switch_frame))
 		  {
-		    KVAR (interrupted_kboard, kbd_queue)
-		      = Fcons (delayed_switch_frame,
-			       KVAR (interrupted_kboard, kbd_queue));
+		    KSET (interrupted_kboard, kbd_queue,
+			  Fcons (delayed_switch_frame,
+				 KVAR (interrupted_kboard, kbd_queue)));
 		    delayed_switch_frame = Qnil;
 		  }
 
 		while (t > 0)
-		  KVAR (interrupted_kboard, kbd_queue)
-		    = Fcons (keybuf[--t], KVAR (interrupted_kboard, kbd_queue));
+		  KSET (interrupted_kboard, kbd_queue,
+			Fcons (keybuf[--t], KVAR (interrupted_kboard, kbd_queue)));
 
 		/* If the side queue is non-empty, ensure it begins with a
 		   switch-frame, so we'll replay it in the right context.  */
@@ -9355,9 +9354,9 @@
 		  {
 		    Lisp_Object frame;
 		    XSETFRAME (frame, interrupted_frame);
-		    KVAR (interrupted_kboard, kbd_queue)
-		      = Fcons (make_lispy_switch_frame (frame),
-			       KVAR (interrupted_kboard, kbd_queue));
+		    KSET (interrupted_kboard, kbd_queue,
+			  Fcons (make_lispy_switch_frame (frame),
+				 KVAR (interrupted_kboard, kbd_queue)));
 		  }
 		mock_input = 0;
 		orig_local_map = get_local_map (PT, current_buffer, Qlocal_map);
@@ -10251,7 +10250,7 @@
     {
       prefixarg = KVAR (current_kboard, Vprefix_arg);
       Vcurrent_prefix_arg = prefixarg;
-      KVAR (current_kboard, Vprefix_arg) = Qnil;
+      KSET (current_kboard, Vprefix_arg, Qnil);
     }
   else
     prefixarg = Qnil;
@@ -11249,30 +11248,30 @@
 void
 init_kboard (KBOARD *kb)
 {
-  KVAR (kb, Voverriding_terminal_local_map) = Qnil;
-  KVAR (kb, Vlast_command) = Qnil;
-  KVAR (kb, Vreal_last_command) = Qnil;
-  KVAR (kb, Vkeyboard_translate_table) = Qnil;
-  KVAR (kb, Vlast_repeatable_command) = Qnil;
-  KVAR (kb, Vprefix_arg) = Qnil;
-  KVAR (kb, Vlast_prefix_arg) = Qnil;
-  KVAR (kb, kbd_queue) = Qnil;
+  KSET (kb, Voverriding_terminal_local_map, Qnil);
+  KSET (kb, Vlast_command, Qnil);
+  KSET (kb, Vreal_last_command, Qnil);
+  KSET (kb, Vkeyboard_translate_table, Qnil);
+  KSET (kb, Vlast_repeatable_command, Qnil);
+  KSET (kb, Vprefix_arg, Qnil);
+  KSET (kb, Vlast_prefix_arg, Qnil);
+  KSET (kb, kbd_queue, Qnil);
   kb->kbd_queue_has_data = 0;
   kb->immediate_echo = 0;
-  KVAR (kb, echo_string) = Qnil;
+  KSET (kb, echo_string, Qnil);
   kb->echo_after_prompt = -1;
   kb->kbd_macro_buffer = 0;
   kb->kbd_macro_bufsize = 0;
-  KVAR (kb, defining_kbd_macro) = Qnil;
-  KVAR (kb, Vlast_kbd_macro) = Qnil;
+  KSET (kb, defining_kbd_macro, Qnil);
+  KSET (kb, Vlast_kbd_macro, Qnil);
   kb->reference_count = 0;
-  KVAR (kb, Vsystem_key_alist) = Qnil;
-  KVAR (kb, system_key_syms) = Qnil;
-  KVAR (kb, Vwindow_system) = Qt;	/* Unset.  */
-  KVAR (kb, Vinput_decode_map) = Fmake_sparse_keymap (Qnil);
-  KVAR (kb, Vlocal_function_key_map) = Fmake_sparse_keymap (Qnil);
+  KSET (kb, Vsystem_key_alist, Qnil);
+  KSET (kb, system_key_syms, Qnil);
+  KSET (kb, Vwindow_system, Qt);	/* Unset.  */
+  KSET (kb, Vinput_decode_map, Fmake_sparse_keymap (Qnil));
+  KSET (kb, Vlocal_function_key_map, Fmake_sparse_keymap (Qnil));
   Fset_keymap_parent (KVAR (kb, Vlocal_function_key_map), Vfunction_key_map);
-  KVAR (kb, Vdefault_minibuffer_frame) = Qnil;
+  KSET (kb, Vdefault_minibuffer_frame, Qnil);
 }
 
 /*
@@ -11348,7 +11347,7 @@
   init_kboard (current_kboard);
   /* A value of nil for Vwindow_system normally means a tty, but we also use
      it for the initial terminal since there is no window system there.  */
-  KVAR (current_kboard, Vwindow_system) = Qnil;
+  KSET (current_kboard, Vwindow_system, Qnil);
 
   if (!noninteractive)
     {

=== modified file 'src/keyboard.h'
--- src/keyboard.h	2012-07-31 12:36:19 +0000
+++ src/keyboard.h	2012-08-10 05:04:01 +0000
@@ -22,6 +22,7 @@
 /* Most code should use this macro to access Lisp fields in struct kboard.  */
 
 #define KVAR(kboard, field) ((kboard)->INTERNAL_FIELD (field))
+#define KSET(kboard, field, value) ((kboard)->INTERNAL_FIELD (field) = (value))
 
 /* Each KBOARD represents one logical input stream from which Emacs
    gets input.  If we are using ordinary terminals, it has one KBOARD

=== modified file 'src/macros.c'
--- src/macros.c	2012-08-05 15:47:28 +0000
+++ src/macros.c	2012-08-10 05:04:01 +0000
@@ -127,7 +127,7 @@
 
       message ("Appending to kbd macro...");
     }
-  KVAR (current_kboard, defining_kbd_macro) = Qt;
+  KSET (current_kboard, defining_kbd_macro, Qt);
 
   return Qnil;
 }
@@ -137,12 +137,12 @@
 void
 end_kbd_macro (void)
 {
-  KVAR (current_kboard, defining_kbd_macro) = Qnil;
+  KSET (current_kboard, defining_kbd_macro, Qnil);
   update_mode_lines++;
-  KVAR (current_kboard, Vlast_kbd_macro)
-    = make_event_array ((current_kboard->kbd_macro_end
-			 - current_kboard->kbd_macro_buffer),
-			current_kboard->kbd_macro_buffer);
+  KSET (current_kboard, Vlast_kbd_macro,
+	make_event_array ((current_kboard->kbd_macro_end 
+			   - current_kboard->kbd_macro_buffer),
+			  current_kboard->kbd_macro_buffer));
 }
 
 DEFUN ("end-kbd-macro", Fend_kbd_macro, Send_kbd_macro, 0, 2, "p",
@@ -330,7 +330,7 @@
       executing_kbd_macro = final;
       executing_kbd_macro_index = 0;
 
-      KVAR (current_kboard, Vprefix_arg) = Qnil;
+      KSET (current_kboard, Vprefix_arg, Qnil);
 
       if (!NILP (loopfunc))
 	{

=== modified file 'src/msdos.c'
--- src/msdos.c	2012-08-07 07:33:18 +0000
+++ src/msdos.c	2012-08-10 05:04:01 +0000
@@ -1801,7 +1801,7 @@
     }
 
   tty = FRAME_TTY (sf);
-  KVAR (current_kboard, Vwindow_system) = Qpc;
+  KSET (current_kboard, Vwindow_system, Qpc);
   sf->output_method = output_msdos_raw;
   if (init_needed)
     {

=== modified file 'src/nsfns.m'
--- src/nsfns.m	2012-08-07 07:33:18 +0000
+++ src/nsfns.m	2012-08-10 05:04:01 +0000
@@ -1392,7 +1392,7 @@
   if (FRAME_HAS_MINIBUF_P (f)
       && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
           || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
-    KVAR (kb, Vdefault_minibuffer_frame) = frame;
+    KSET (kb, Vdefault_minibuffer_frame, frame);
 
   /* All remaining specified parameters, which have not been "used"
      by x_get_arg and friends, now go in the misc. alist of the frame.  */

=== modified file 'src/nsterm.m'
--- src/nsterm.m	2012-08-07 07:33:18 +0000
+++ src/nsterm.m	2012-08-10 05:04:01 +0000
@@ -4051,7 +4051,7 @@
 
   terminal->kboard = xmalloc (sizeof *terminal->kboard);
   init_kboard (terminal->kboard);
-  KVAR (terminal->kboard, Vwindow_system) = Qns;
+  KSET (terminal->kboard, Vwindow_system, Qns);
   terminal->kboard->next_kboard = all_kboards;
   all_kboards = terminal->kboard;
   /* Don't let the initial kboard remain current longer than necessary.

=== modified file 'src/term.c'
--- src/term.c	2012-08-07 05:29:25 +0000
+++ src/term.c	2012-08-10 05:04:01 +0000
@@ -1333,7 +1333,7 @@
 
   /* This can happen if CANNOT_DUMP or with strange options.  */
   if (!KEYMAPP (KVAR (kboard, Vinput_decode_map)))
-    KVAR (kboard, Vinput_decode_map) = Fmake_sparse_keymap (Qnil);
+    KSET (kboard, Vinput_decode_map, Fmake_sparse_keymap (Qnil));
 
   for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
     {
@@ -3281,7 +3281,7 @@
 
   terminal->kboard = xmalloc (sizeof *terminal->kboard);
   init_kboard (terminal->kboard);
-  KVAR (terminal->kboard, Vwindow_system) = Qnil;
+  KSET (terminal->kboard, Vwindow_system, Qnil);
   terminal->kboard->next_kboard = all_kboards;
   all_kboards = terminal->kboard;
   terminal->kboard->reference_count++;

=== modified file 'src/w32fns.c'
--- src/w32fns.c	2012-08-10 04:52:39 +0000
+++ src/w32fns.c	2012-08-10 05:04:01 +0000
@@ -4353,7 +4353,7 @@
   if (FRAME_HAS_MINIBUF_P (f)
       && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
           || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
-    KVAR (kb, Vdefault_minibuffer_frame) = frame;
+    KSET (kb, Vdefault_minibuffer_frame, frame);
 
   /* All remaining specified parameters, which have not been "used"
      by x_get_arg and friends, now go in the misc. alist of the frame.  */

=== modified file 'src/w32term.c'
--- src/w32term.c	2012-08-08 19:53:44 +0000
+++ src/w32term.c	2012-08-10 05:04:01 +0000
@@ -6232,7 +6232,7 @@
      terminal like X does.  */
   terminal->kboard = xmalloc (sizeof (KBOARD));
   init_kboard (terminal->kboard);
-  KVAR (terminal->kboard, Vwindow_system) = intern ("w32");
+  KSET (terminal->kboard, Vwindow_system, intern ("w32"));
   terminal->kboard->next_kboard = all_kboards;
   all_kboards = terminal->kboard;
   /* Don't let the initial kboard remain current longer than necessary.

=== modified file 'src/xfns.c'
--- src/xfns.c	2012-08-10 04:52:39 +0000
+++ src/xfns.c	2012-08-10 05:04:01 +0000
@@ -3462,7 +3462,7 @@
   if (FRAME_HAS_MINIBUF_P (f)
       && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
           || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
-    KVAR (kb, Vdefault_minibuffer_frame) = frame;
+    KSET (kb, Vdefault_minibuffer_frame, frame);
 
   /* All remaining specified parameters, which have not been "used"
      by x_get_arg and friends, now go in the misc. alist of the frame.  */

=== modified file 'src/xterm.c'
--- src/xterm.c	2012-08-07 13:37:21 +0000
+++ src/xterm.c	2012-08-10 05:04:01 +0000
@@ -7835,7 +7835,7 @@
       {
 	/* Set this to t so that delete_frame won't get confused
 	   trying to find a replacement.  */
-	KVAR (FRAME_KBOARD (XFRAME (frame)), Vdefault_minibuffer_frame) = Qt;
+	KSET (FRAME_KBOARD (XFRAME (frame)), Vdefault_minibuffer_frame, Qt);
 	delete_frame (frame, Qnoelisp);
       }
 
@@ -10115,7 +10115,7 @@
       {
 	terminal->kboard = xmalloc (sizeof *terminal->kboard);
 	init_kboard (terminal->kboard);
-	KVAR (terminal->kboard, Vwindow_system) = Qx;
+	KSET (terminal->kboard, Vwindow_system, Qx);
 
 	/* Add the keyboard to the list before running Lisp code (via
            Qvendor_specific_keysyms below), since these are not traced
@@ -10137,9 +10137,9 @@
 	    /* Temporarily hide the partially initialized terminal.  */
 	    terminal_list = terminal->next_terminal;
 	    UNBLOCK_INPUT;
-	    KVAR (terminal->kboard, Vsystem_key_alist)
-	      = call1 (Qvendor_specific_keysyms,
-		       vendor ? build_string (vendor) : empty_unibyte_string);
+	    KSET (terminal->kboard, Vsystem_key_alist,
+		  call1 (Qvendor_specific_keysyms,
+			 vendor ? build_string (vendor) : empty_unibyte_string));
 	    BLOCK_INPUT;
 	    terminal->next_terminal = terminal_list;
  	    terminal_list = terminal;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: The rest of xVARs
  2012-08-10  5:19           ` Dmitry Antipov
@ 2012-08-10 15:18             ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2012-08-10 15:18 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Emacs development discussions

>>>>> I can't continue without solving (B|K)VARs issue, and X = B->field/
>>>>> BSET(B, field, X) is enough for my purposes;
>>>> You can split the BVAR into a BGET and BSET for now.
>>> OK, the patch is > 200K uncompressed.
>> Here's a simpler solution: split BVAR into BVAR and BSET.  I'm sure the
>> patch will substantially smaller and hence cause much fewer conflicts.
> OK

Looks good, feel free to install.

>> Stefan "tired of resolving cosmetic conflicts with your patches"
> Coccinelle tends to eat spaces and tabs (especially between function
> name and '(' opens an argument list),so I do quite a lot of manual
> adjustments to fit our coding style; but sometimes I can miss the
> poorly formatted entry :-(.

You've done a great job of adjusting it seems, since all the conflicts
I got were always due to real (tho usually cosmetic, such as
introducing/removing FVAR) changes.


        Stefan "hovering between 1MB and 2MB of local changes, many of
                them cosmetic"



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-10 15:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <50214432.5040906@yandex.ru>
     [not found] ` <jwvlihqih7o.fsf-monnier+emacs@gnu.org>
2012-08-09  6:14   ` The rest of xVARs Dmitry Antipov
2012-08-09 12:52     ` Stefan Monnier
     [not found]       ` <5023F621.1020107@yandex.ru>
     [not found]         ` <jwvipcr7tgm.fsf-monnier+emacs@gnu.org>
2012-08-10  5:19           ` Dmitry Antipov
2012-08-10 15:18             ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).