From f55f47dde0a4338ba68c9f5730e5696085f4adc0 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 28 Sep 2009 05:08:56 +0200 Subject: [PATCH] Make buffer-objfwd variables work per-thread. See hack-buffer-objfwd.el to see how this was done. --- src/.gdbinit | 12 +- src/alloc.c | 16 +- src/buffer.c | 732 +++++++++++++++++++------------------- src/buffer.h | 212 +++++++---- src/bytecode.c | 2 +- src/callint.c | 16 +- src/callproc.c | 12 +- src/casefiddle.c | 12 +- src/casetab.c | 10 +- src/category.c | 8 +- src/category.h | 2 +- src/character.c | 4 +- src/character.h | 12 +- src/charset.c | 2 +- src/cmds.c | 32 +- src/coding.c | 36 +- src/composite.c | 2 +- src/data.c | 26 +- src/dispextern.h | 6 +- src/dispnew.c | 18 +- src/editfns.c | 72 ++-- src/fileio.c | 164 ++++----- src/filelock.c | 14 +- src/fns.c | 12 +- src/font.c | 2 +- src/frame.c | 2 +- src/fringe.c | 18 +- src/hack-buffer-objfwd.el | 206 +++++++++++ src/indent.c | 62 ++-- src/insdel.c | 50 +-- src/intervals.c | 4 +- src/intervals.h | 4 +- src/keyboard.c | 12 +- src/keymap.c | 12 +- src/lisp.h | 4 +- src/lread.c | 16 +- src/marker.c | 10 +- src/minibuf.c | 22 +- src/print.c | 40 +-- src/process.c | 60 ++-- src/search.c | 48 +-- src/syntax.c | 18 +- src/syntax.h | 4 +- src/undo.c | 62 ++-- src/window.c | 60 ++-- src/xdisp.c | 155 ++++---- src/xfaces.c | 2 +- src/xfns.c | 4 +- 48 files changed, 1297 insertions(+), 1014 deletions(-) create mode 100644 src/hack-buffer-objfwd.el diff --git a/src/.gdbinit b/src/.gdbinit index 2204fab7a5b..99b780bc203 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -1203,14 +1203,14 @@ Works only when an inferior emacs is executing. end -define hook-run - xreload -end +# define hook-run +# xreload +# end # Call xreload if a new Emacs executable is loaded. -define hookpost-run - xreload -end +# define hookpost-run +# xreload +# end set print pretty on set print sevenbit-strings diff --git a/src/alloc.c b/src/alloc.c index 742c17a1b07..47fe05385c7 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4029,7 +4029,7 @@ live_buffer_p (m, p) must not have been killed. */ return (m->type == MEM_TYPE_BUFFER && p == m->start - && !NILP (((struct buffer *) p)->name)); + && !NILP (BUF_NAME (((struct buffer *) p)))); } #endif /* GC_MARK_STACK || defined GC_MALLOC_CHECK */ @@ -5011,11 +5011,11 @@ returns nil, because real GC can't be done. */) turned off in that buffer. Calling truncate_undo_list on Qt tends to return NULL, which effectively turns undo back on. So don't call truncate_undo_list if undo_list is Qt. */ - if (! NILP (nextb->name) && ! EQ (nextb->undo_list, Qt)) + if (! NILP (BUF_NAME (nextb)) && ! EQ (BUF_UNDO_LIST (nextb), Qt)) truncate_undo_list (nextb); /* Shrink buffer gaps, but skip indirect and dead buffers. */ - if (nextb->base_buffer == 0 && !NILP (nextb->name) + if (nextb->base_buffer == 0 && !NILP (BUF_NAME (nextb)) && ! nextb->text->inhibit_shrinking) { /* If a buffer's gap size is more than 10% of the buffer @@ -5120,10 +5120,10 @@ returns nil, because real GC can't be done. */) turned off in that buffer. Calling truncate_undo_list on Qt tends to return NULL, which effectively turns undo back on. So don't call truncate_undo_list if undo_list is Qt. */ - if (! EQ (nextb->undo_list, Qt)) + if (! EQ (BUF_UNDO_LIST (nextb), Qt)) { Lisp_Object tail, prev; - tail = nextb->undo_list; + tail = BUF_UNDO_LIST (nextb); prev = Qnil; while (CONSP (tail)) { @@ -5132,7 +5132,7 @@ returns nil, because real GC can't be done. */) && !XMARKER (XCAR (XCAR (tail)))->gcmarkbit) { if (NILP (prev)) - nextb->undo_list = tail = XCDR (tail); + BUF_UNDO_LIST (nextb) = tail = XCDR (tail); else { tail = XCDR (tail); @@ -5148,7 +5148,7 @@ returns nil, because real GC can't be done. */) } /* Now that we have stripped the elements that need not be in the undo_list any more, we can finally mark the list. */ - mark_object (nextb->undo_list); + mark_object (BUF_UNDO_LIST (nextb)); nextb = nextb->next; } @@ -5722,7 +5722,7 @@ mark_buffer (buf) /* buffer-local Lisp variables start at `undo_list', tho only the ones from `name' on are GC'd normally. */ - for (ptr = &buffer->name; + for (ptr = &BUF_NAME (buffer); (char *)ptr < (char *)buffer + sizeof (struct buffer); ptr++) mark_object (*ptr); diff --git a/src/buffer.c b/src/buffer.c index 05d498e19c7..bf1dd119d97 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -196,7 +196,7 @@ Value is nil if OBJECT is not a buffer or if it has been killed. */) (object) Lisp_Object object; { - return ((BUFFERP (object) && ! NILP (XBUFFER (object)->name)) + return ((BUFFERP (object) && ! NILP (BUF_NAME (XBUFFER (object)))) ? Qt : Qnil); } @@ -305,8 +305,8 @@ See also `find-buffer-visiting'. */) { buf = Fcdr (XCAR (tail)); if (!BUFFERP (buf)) continue; - if (!STRINGP (XBUFFER (buf)->filename)) continue; - tem = Fstring_equal (XBUFFER (buf)->filename, filename); + if (!STRINGP (BUF_FILENAME (XBUFFER (buf)))) continue; + tem = Fstring_equal (BUF_FILENAME (XBUFFER (buf)), filename); if (!NILP (tem)) return buf; } @@ -323,8 +323,8 @@ get_truename_buffer (filename) { buf = Fcdr (XCAR (tail)); if (!BUFFERP (buf)) continue; - if (!STRINGP (XBUFFER (buf)->file_truename)) continue; - tem = Fstring_equal (XBUFFER (buf)->file_truename, filename); + if (!STRINGP (BUF_FILE_TRUENAME (XBUFFER (buf)))) continue; + tem = Fstring_equal (BUF_FILE_TRUENAME (XBUFFER (buf)), filename); if (!NILP (tem)) return buf; } @@ -391,7 +391,7 @@ even if it is dead. The return value is never nil. */) b->newline_cache = 0; b->width_run_cache = 0; - b->width_table = Qnil; + BUF_WIDTH_TABLE (b) = Qnil; b->prevent_redisplay_optimizations_p = 1; /* Put this on the chain of all buffers including killed ones. */ @@ -400,22 +400,22 @@ even if it is dead. The return value is never nil. */) /* An ordinary buffer normally doesn't need markers to handle BEGV and ZV. */ - b->pt_marker = Qnil; - b->begv_marker = Qnil; - b->zv_marker = Qnil; + BUF_PT_MARKER (b) = Qnil; + BUF_BEGV_MARKER (b) = Qnil; + BUF_ZV_MARKER (b) = Qnil; name = Fcopy_sequence (buffer_or_name); STRING_SET_INTERVALS (name, NULL_INTERVAL); - b->name = name; + BUF_NAME (b) = name; - b->undo_list = (SREF (name, 0) != ' ') ? Qnil : Qt; + BUF_UNDO_LIST (b) = (SREF (name, 0) != ' ') ? Qnil : Qt; reset_buffer (b); reset_buffer_local_variables (b, 1); - b->mark = Fmake_marker (); + BUF_MARK (b) = Fmake_marker (); BUF_MARKERS (b) = NULL; - b->name = name; + BUF_NAME (b) = name; b->owner = Qnil; b->prev_owner = Qnil; @@ -529,7 +529,7 @@ clone_per_buffer_values (from, to) /* Get (a copy of) the alist of Lisp-level local variables of FROM and install that in TO. */ - to->local_var_alist = buffer_lisp_local_variables (from); + BUF_LOCAL_VAR_ALIST (to) = buffer_lisp_local_variables (from); } DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, @@ -556,7 +556,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) base_buffer = Fget_buffer (base_buffer); if (NILP (base_buffer)) error ("No such buffer: `%s'", SDATA (tem)); - if (NILP (XBUFFER (base_buffer)->name)) + if (NILP (BUF_NAME (XBUFFER (base_buffer)))) error ("Base buffer has been killed"); if (SCHARS (name) == 0) @@ -580,7 +580,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) b->newline_cache = 0; b->width_run_cache = 0; - b->width_table = Qnil; + BUF_WIDTH_TABLE (b) = Qnil; /* Put this on the chain of all buffers including killed ones. */ b->next = all_buffers; @@ -588,7 +588,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) name = Fcopy_sequence (name); STRING_SET_INTERVALS (name, NULL_INTERVAL); - b->name = name; + BUF_NAME (b) = name; reset_buffer (b); reset_buffer_local_variables (b, 1); @@ -597,58 +597,58 @@ CLONE nil means the indirect buffer's state is reset to default values. */) XSETBUFFER (buf, b); Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); - b->mark = Fmake_marker (); - b->name = name; + BUF_MARK (b) = Fmake_marker (); + BUF_NAME (b) = name; b->owner = Qnil; /* The multibyte status belongs to the base buffer. */ - b->enable_multibyte_characters = b->base_buffer->enable_multibyte_characters; + BUF_ENABLE_MULTIBYTE_CHARACTERS (b) = BUF_ENABLE_MULTIBYTE_CHARACTERS (b->base_buffer); /* Make sure the base buffer has markers for its narrowing. */ - if (NILP (b->base_buffer->pt_marker)) + if (NILP (BUF_PT_MARKER (b->base_buffer))) { - b->base_buffer->pt_marker = Fmake_marker (); - set_marker_both (b->base_buffer->pt_marker, base_buffer, + BUF_PT_MARKER (b->base_buffer) = Fmake_marker (); + set_marker_both (BUF_PT_MARKER (b->base_buffer), base_buffer, BUF_PT (b->base_buffer), BUF_PT_BYTE (b->base_buffer)); } - if (NILP (b->base_buffer->begv_marker)) + if (NILP (BUF_BEGV_MARKER (b->base_buffer))) { - b->base_buffer->begv_marker = Fmake_marker (); - set_marker_both (b->base_buffer->begv_marker, base_buffer, + BUF_BEGV_MARKER (b->base_buffer) = Fmake_marker (); + set_marker_both (BUF_BEGV_MARKER (b->base_buffer), base_buffer, BUF_BEGV (b->base_buffer), BUF_BEGV_BYTE (b->base_buffer)); } - if (NILP (b->base_buffer->zv_marker)) + if (NILP (BUF_ZV_MARKER (b->base_buffer))) { - b->base_buffer->zv_marker = Fmake_marker (); - set_marker_both (b->base_buffer->zv_marker, base_buffer, + BUF_ZV_MARKER (b->base_buffer) = Fmake_marker (); + set_marker_both (BUF_ZV_MARKER (b->base_buffer), base_buffer, BUF_ZV (b->base_buffer), BUF_ZV_BYTE (b->base_buffer)); - XMARKER (b->base_buffer->zv_marker)->insertion_type = 1; + XMARKER (BUF_ZV_MARKER (b->base_buffer))->insertion_type = 1; } if (NILP (clone)) { /* Give the indirect buffer markers for its narrowing. */ - b->pt_marker = Fmake_marker (); - set_marker_both (b->pt_marker, buf, BUF_PT (b), BUF_PT_BYTE (b)); - b->begv_marker = Fmake_marker (); - set_marker_both (b->begv_marker, buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); - b->zv_marker = Fmake_marker (); - set_marker_both (b->zv_marker, buf, BUF_ZV (b), BUF_ZV_BYTE (b)); - XMARKER (b->zv_marker)->insertion_type = 1; + BUF_PT_MARKER (b) = Fmake_marker (); + set_marker_both (BUF_PT_MARKER (b), buf, BUF_PT (b), BUF_PT_BYTE (b)); + BUF_BEGV_MARKER (b) = Fmake_marker (); + set_marker_both (BUF_BEGV_MARKER (b), buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); + BUF_ZV_MARKER (b) = Fmake_marker (); + set_marker_both (BUF_ZV_MARKER (b), buf, BUF_ZV (b), BUF_ZV_BYTE (b)); + XMARKER (BUF_ZV_MARKER (b))->insertion_type = 1; } else { struct buffer *old_b = current_buffer; clone_per_buffer_values (b->base_buffer, b); - b->filename = Qnil; - b->file_truename = Qnil; - b->display_count = make_number (0); - b->backed_up = Qnil; - b->auto_save_file_name = Qnil; + BUF_FILENAME (b) = Qnil; + BUF_FILE_TRUENAME (b) = Qnil; + BUF_DISPLAY_COUNT (b) = make_number (0); + BUF_BACKED_UP (b) = Qnil; + BUF_AUTO_SAVE_FILE_NAME (b) = Qnil; set_buffer_internal_1 (b); Fset (intern ("buffer-save-without-query"), Qnil); Fset (intern ("buffer-file-number"), Qnil); @@ -694,11 +694,11 @@ void reset_buffer (b) register struct buffer *b; { - b->filename = Qnil; - b->file_truename = Qnil; - b->directory = (current_buffer) ? current_buffer->directory : Qnil; + b->filename_ = Qnil; + b->file_truename_ = Qnil; + b->directory_ = (current_buffer) ? current_buffer->directory_ : Qnil; b->modtime = 0; - XSETFASTINT (b->save_length, 0); + XSETFASTINT (b->save_length_, 0); b->last_window_start = 1; /* It is more conservative to start out "changed" than "unchanged". */ b->clip_changed = 0; @@ -706,21 +706,21 @@ reset_buffer (b) b->backed_up = Qnil; BUF_AUTOSAVE_MODIFF (b) = 0; b->auto_save_failure_time = -1; - b->auto_save_file_name = Qnil; - b->read_only = Qnil; + b->auto_save_file_name_ = Qnil; + b->read_only_ = Qnil; b->overlays_before = NULL; b->overlays_after = NULL; b->overlay_center = BEG; - b->mark_active = Qnil; - b->point_before_scroll = Qnil; - b->file_format = Qnil; - b->auto_save_file_format = Qt; - b->last_selected_window = Qnil; - XSETINT (b->display_count, 0); - b->display_time = Qnil; - b->enable_multibyte_characters = buffer_defaults.enable_multibyte_characters; - b->cursor_type = buffer_defaults.cursor_type; - b->extra_line_spacing = buffer_defaults.extra_line_spacing; + b->mark_active_ = Qnil; + b->point_before_scroll_ = Qnil; + b->file_format_ = Qnil; + b->auto_save_file_format_ = Qt; + b->last_selected_window_ = Qnil; + XSETINT (b->display_count_, 0); + b->display_time_ = Qnil; + b->enable_multibyte_characters_ = buffer_defaults.enable_multibyte_characters_; + b->cursor_type_ = buffer_defaults.cursor_type_; + b->extra_line_spacing_ = buffer_defaults.extra_line_spacing_; b->display_error_modiff = 0; } @@ -746,10 +746,10 @@ reset_buffer_local_variables (b, permanent_too) things that depend on the major mode. default-major-mode is handled at a higher level. We ignore it here. */ - b->major_mode = Qfundamental_mode; - b->keymap = Qnil; - b->mode_name = QSFundamental; - b->minor_modes = Qnil; + b->major_mode_ = Qfundamental_mode; + b->keymap_ = Qnil; + b->mode_name_ = QSFundamental; + b->minor_modes_ = Qnil; /* If the standard case table has been altered and invalidated, fix up its insides first. */ @@ -758,22 +758,22 @@ reset_buffer_local_variables (b, permanent_too) && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2]))) Fset_standard_case_table (Vascii_downcase_table); - b->downcase_table = Vascii_downcase_table; - b->upcase_table = XCHAR_TABLE (Vascii_downcase_table)->extras[0]; - b->case_canon_table = XCHAR_TABLE (Vascii_downcase_table)->extras[1]; - b->case_eqv_table = XCHAR_TABLE (Vascii_downcase_table)->extras[2]; - b->invisibility_spec = Qt; + b->downcase_table_ = Vascii_downcase_table; + b->upcase_table_ = XCHAR_TABLE (Vascii_downcase_table)->extras[0]; + b->case_canon_table_ = XCHAR_TABLE (Vascii_downcase_table)->extras[1]; + b->case_eqv_table_ = XCHAR_TABLE (Vascii_downcase_table)->extras[2]; + b->invisibility_spec_ = Qt; #ifndef DOS_NT - b->buffer_file_type = Qnil; + b->buffer_file_type_ = Qnil; #endif /* Reset all (or most) per-buffer variables to their defaults. */ if (permanent_too) - b->local_var_alist = Qnil; + b->local_var_alist_ = Qnil; else { Lisp_Object tmp, prop, last = Qnil; - for (tmp = b->local_var_alist; CONSP (tmp); tmp = XCDR (tmp)) + for (tmp = b->local_var_alist_; CONSP (tmp); tmp = XCDR (tmp)) if (CONSP (XCAR (tmp)) && SYMBOLP (XCAR (XCAR (tmp))) && !NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local))) @@ -805,7 +805,7 @@ reset_buffer_local_variables (b, permanent_too) } /* Delete this local variable. */ else if (NILP (last)) - b->local_var_alist = XCDR (tmp); + b->local_var_alist_ = XCDR (tmp); else XSETCDR (last, XCDR (tmp)); } @@ -884,9 +884,9 @@ Return nil if BUFFER has been killed. */) register Lisp_Object buffer; { if (NILP (buffer)) - return current_buffer->name; + return BUF_NAME (current_buffer); CHECK_BUFFER (buffer); - return XBUFFER (buffer)->name; + return BUF_NAME (XBUFFER (buffer)); } DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, @@ -896,9 +896,9 @@ No argument or nil as argument means use the current buffer. */) register Lisp_Object buffer; { if (NILP (buffer)) - return current_buffer->filename; + return BUF_FILENAME (current_buffer); CHECK_BUFFER (buffer); - return XBUFFER (buffer)->filename; + return BUF_FILENAME (XBUFFER (buffer)); } DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer, @@ -947,7 +947,7 @@ is the default binding of the variable. */) XSETSYMBOL (variable, sym); /* Look in local_var_list */ - result = Fassoc (variable, buf->local_var_alist); + result = Fassoc (variable, BUF_LOCAL_VAR_ALIST (buf)); if (NILP (result)) { int offset, idx; @@ -1013,7 +1013,7 @@ buffer_lisp_local_variables (buf) { Lisp_Object result = Qnil; register Lisp_Object tail; - for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) + for (tail = BUF_LOCAL_VAR_ALIST (buf); CONSP (tail); tail = XCDR (tail)) { Lisp_Object val, elt; @@ -1120,9 +1120,9 @@ A non-nil FLAG means mark the buffer modified. */) /* If buffer becoming modified, lock the file. If buffer becoming unmodified, unlock the file. */ - fn = current_buffer->file_truename; + fn = BUF_FILE_TRUENAME (current_buffer); /* Test buffer-file-name so that binding it to nil is effective. */ - if (!NILP (fn) && ! NILP (current_buffer->filename)) + if (!NILP (fn) && ! NILP (BUF_FILENAME (current_buffer))) { already = SAVE_MODIFF < MODIFF; if (!already && !NILP (flag)) @@ -1188,9 +1188,9 @@ state of the current buffer. Use with care. */) /* If buffer becoming modified, lock the file. If buffer becoming unmodified, unlock the file. */ - fn = current_buffer->file_truename; + fn = BUF_FILE_TRUENAME (current_buffer); /* Test buffer-file-name so that binding it to nil is effective. */ - if (!NILP (fn) && ! NILP (current_buffer->filename)) + if (!NILP (fn) && ! NILP (BUF_FILENAME (current_buffer))) { int already = SAVE_MODIFF < MODIFF; if (!already && !NILP (flag)) @@ -1280,14 +1280,14 @@ This does not change the name of the visited file (if any). */) with the original name. It makes UNIQUE equivalent to (rename-buffer (generate-new-buffer-name NEWNAME)). */ if (NILP (unique) && XBUFFER (tem) == current_buffer) - return current_buffer->name; + return BUF_NAME (current_buffer); if (!NILP (unique)) - newname = Fgenerate_new_buffer_name (newname, current_buffer->name); + newname = Fgenerate_new_buffer_name (newname, BUF_NAME (current_buffer)); else error ("Buffer name `%s' is in use", SDATA (newname)); } - current_buffer->name = newname; + BUF_NAME (current_buffer) = newname; /* Catch redisplay's attention. Unless we do this, the mode lines for any windows displaying current_buffer will stay unchanged. */ @@ -1295,11 +1295,11 @@ This does not change the name of the visited file (if any). */) XSETBUFFER (buf, current_buffer); Fsetcar (Frassq (buf, Vbuffer_alist), newname); - if (NILP (current_buffer->filename) - && !NILP (current_buffer->auto_save_file_name)) + if (NILP (BUF_FILENAME (current_buffer)) + && !NILP (BUF_AUTO_SAVE_FILE_NAME (current_buffer))) call0 (intern ("rename-auto-save-file")); /* Refetch since that last call may have done GC. */ - return current_buffer->name; + return BUF_NAME (current_buffer); } DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, @@ -1343,9 +1343,9 @@ If BUFFER is omitted or nil, some interesting buffer is returned. */) continue; if (NILP (buf)) continue; - if (NILP (XBUFFER (buf)->name)) + if (NILP (BUF_NAME (XBUFFER (buf)))) continue; - if (SREF (XBUFFER (buf)->name, 0) == ' ') + if (SREF (BUF_NAME (XBUFFER (buf)), 0) == ' ') continue; /* If the selected frame has a buffer_predicate, disregard buffers that don't fit the predicate. */ @@ -1394,8 +1394,8 @@ No argument or nil as argument means do this for the current buffer. */) nsberror (buffer); } - if (EQ (XBUFFER (real_buffer)->undo_list, Qt)) - XBUFFER (real_buffer)->undo_list = Qnil; + if (EQ (BUF_UNDO_LIST (XBUFFER (real_buffer)), Qt)) + BUF_UNDO_LIST (XBUFFER (real_buffer)) = Qnil; return Qnil; } @@ -1441,7 +1441,7 @@ with SIGHUP. */) b = XBUFFER (buffer); /* Avoid trouble for buffer already dead. */ - if (NILP (b->name)) + if (NILP (BUF_NAME (b))) return Qnil; tem = get_current_thread (); @@ -1449,12 +1449,12 @@ with SIGHUP. */) error ("Buffer locked by another thread"); /* Query if the buffer is still modified. */ - if (INTERACTIVE && !NILP (b->filename) + if (INTERACTIVE && !NILP (BUF_FILENAME (b)) && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) { GCPRO1 (buffer); tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ", - b->name, make_number (0))); + BUF_NAME (b), make_number (0))); UNGCPRO; if (NILP (tem)) return Qnil; @@ -1488,7 +1488,7 @@ with SIGHUP. */) if (EQ (buffer, XWINDOW (minibuf_window)->buffer)) return Qnil; - if (NILP (b->name)) + if (NILP (BUF_NAME (b))) return Qnil; /* When we kill a base buffer, kill all its indirect buffers. @@ -1503,7 +1503,7 @@ with SIGHUP. */) for (other = all_buffers; other; other = other->next) /* all_buffers contains dead buffers too; don't re-kill them. */ - if (other->base_buffer == b && !NILP (other->name)) + if (other->base_buffer == b && !NILP (BUF_NAME (other))) { Lisp_Object buffer; XSETBUFFER (buffer, other); @@ -1548,7 +1548,7 @@ with SIGHUP. */) /* Killing buffer processes may run sentinels which may have called kill-buffer. */ - if (NILP (b->name)) + if (NILP (BUF_NAME (b))) return Qnil; clear_charpos_cache (b); @@ -1571,7 +1571,7 @@ with SIGHUP. */) Lisp_Object tem; tem = Fsymbol_value (intern ("delete-auto-save-files")); if (! NILP (tem)) - internal_delete_file (b->auto_save_file_name); + internal_delete_file (BUF_AUTO_SAVE_FILE_NAME (b)); } if (b->base_buffer) @@ -1611,7 +1611,7 @@ with SIGHUP. */) swap_out_buffer_local_variables (b); reset_buffer_local_variables (b, 1); - b->name = Qnil; + BUF_NAME (b) = Qnil; BLOCK_INPUT; if (! b->base_buffer) @@ -1627,9 +1627,9 @@ with SIGHUP. */) free_region_cache (b->width_run_cache); b->width_run_cache = 0; } - b->width_table = Qnil; + BUF_WIDTH_TABLE (b) = Qnil; UNBLOCK_INPUT; - b->undo_list = Qnil; + BUF_UNDO_LIST (b) = Qnil; return Qt; } @@ -1725,15 +1725,15 @@ the current buffer's major mode. */) CHECK_BUFFER (buffer); - if (STRINGP (XBUFFER (buffer)->name) - && strcmp (SDATA (XBUFFER (buffer)->name), "*scratch*") == 0) + if (STRINGP (BUF_NAME (XBUFFER (buffer))) + && strcmp (SDATA (BUF_NAME (XBUFFER (buffer))), "*scratch*") == 0) function = find_symbol_value (intern ("initial-major-mode")); else { - function = buffer_defaults.major_mode; + function = BUF_MAJOR_MODE (&buffer_defaults); if (NILP (function) - && NILP (Fget (current_buffer->major_mode, Qmode_class))) - function = current_buffer->major_mode; + && NILP (Fget (BUF_MAJOR_MODE (current_buffer), Qmode_class))) + function = BUF_MAJOR_MODE (current_buffer); } if (NILP (function) || EQ (function, Qfundamental_mode)) @@ -1891,29 +1891,29 @@ set_buffer_internal_1 (b) /* 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) - old_buf->base_buffer->undo_list = old_buf->undo_list; + BUF_UNDO_LIST (old_buf->base_buffer) = BUF_UNDO_LIST (old_buf); /* If the old current buffer has markers to record PT, BEGV and ZV when it is not current, update them now. */ - if (! NILP (old_buf->pt_marker)) + if (! NILP (BUF_PT_MARKER (old_buf))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->pt_marker, obuf, + set_marker_both (BUF_PT_MARKER (old_buf), obuf, BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); } - if (! NILP (old_buf->begv_marker)) + if (! NILP (BUF_BEGV_MARKER (old_buf))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->begv_marker, obuf, + set_marker_both (BUF_BEGV_MARKER (old_buf), obuf, BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); } - if (! NILP (old_buf->zv_marker)) + if (! NILP (BUF_ZV_MARKER (old_buf))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->zv_marker, obuf, + set_marker_both (BUF_ZV_MARKER (old_buf), obuf, BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); } } @@ -1921,30 +1921,30 @@ set_buffer_internal_1 (b) /* 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) - b->undo_list = b->base_buffer->undo_list; + BUF_UNDO_LIST (b) = BUF_UNDO_LIST (b->base_buffer); /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (b->pt_marker)) + if (! NILP (BUF_PT_MARKER (b))) { - BUF_PT (b) = marker_position (b->pt_marker); - BUF_PT_BYTE (b) = marker_byte_position (b->pt_marker); + BUF_PT (b) = marker_position (BUF_PT_MARKER (b)); + BUF_PT_BYTE (b) = marker_byte_position (BUF_PT_MARKER (b)); } - if (! NILP (b->begv_marker)) + if (! NILP (BUF_BEGV_MARKER (b))) { - BUF_BEGV (b) = marker_position (b->begv_marker); - BUF_BEGV_BYTE (b) = marker_byte_position (b->begv_marker); + BUF_BEGV (b) = marker_position (BUF_BEGV_MARKER (b)); + BUF_BEGV_BYTE (b) = marker_byte_position (BUF_BEGV_MARKER (b)); } - if (! NILP (b->zv_marker)) + if (! NILP (BUF_ZV_MARKER (b))) { - BUF_ZV (b) = marker_position (b->zv_marker); - BUF_ZV_BYTE (b) = marker_byte_position (b->zv_marker); + BUF_ZV (b) = marker_position (BUF_ZV_MARKER (b)); + BUF_ZV_BYTE (b) = marker_byte_position (BUF_ZV_MARKER (b)); } /* Look down buffer's list of local Lisp variables to find and update any that forward into C variables. */ - for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail)) + for (tail = BUF_LOCAL_VAR_ALIST (b); CONSP (tail); tail = XCDR (tail)) { if (CONSP (XCAR (tail)) && SYMBOLP (XCAR (XCAR (tail))) @@ -1960,7 +1960,7 @@ set_buffer_internal_1 (b) /* Do the same with any others that were local to the previous buffer */ if (old_buf) - for (tail = old_buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) + for (tail = BUF_LOCAL_VAR_ALIST (old_buf); CONSP (tail); tail = XCDR (tail)) { if (CONSP (tail) && SYMBOLP (XCAR (XCAR (tail))) @@ -1993,45 +1993,45 @@ set_buffer_temp (b) { /* If the old current buffer has markers to record PT, BEGV and ZV when it is not current, update them now. */ - if (! NILP (old_buf->pt_marker)) + if (! NILP (BUF_PT_MARKER (old_buf))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->pt_marker, obuf, + set_marker_both (BUF_PT_MARKER (old_buf), obuf, BUF_PT (old_buf), BUF_PT_BYTE (old_buf)); } - if (! NILP (old_buf->begv_marker)) + if (! NILP (BUF_BEGV_MARKER (old_buf))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->begv_marker, obuf, + set_marker_both (BUF_BEGV_MARKER (old_buf), obuf, BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf)); } - if (! NILP (old_buf->zv_marker)) + if (! NILP (BUF_ZV_MARKER (old_buf))) { Lisp_Object obuf; XSETBUFFER (obuf, old_buf); - set_marker_both (old_buf->zv_marker, obuf, + set_marker_both (BUF_ZV_MARKER (old_buf), obuf, BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf)); } } /* If the new current buffer has markers to record PT, BEGV and ZV when it is not current, fetch them now. */ - if (! NILP (b->pt_marker)) + if (! NILP (BUF_PT_MARKER (b))) { - BUF_PT (b) = marker_position (b->pt_marker); - BUF_PT_BYTE (b) = marker_byte_position (b->pt_marker); + BUF_PT (b) = marker_position (BUF_PT_MARKER (b)); + BUF_PT_BYTE (b) = marker_byte_position (BUF_PT_MARKER (b)); } - if (! NILP (b->begv_marker)) + if (! NILP (BUF_BEGV_MARKER (b))) { - BUF_BEGV (b) = marker_position (b->begv_marker); - BUF_BEGV_BYTE (b) = marker_byte_position (b->begv_marker); + BUF_BEGV (b) = marker_position (BUF_BEGV_MARKER (b)); + BUF_BEGV_BYTE (b) = marker_byte_position (BUF_BEGV_MARKER (b)); } - if (! NILP (b->zv_marker)) + if (! NILP (BUF_ZV_MARKER (b))) { - BUF_ZV (b) = marker_position (b->zv_marker); - BUF_ZV_BYTE (b) = marker_byte_position (b->zv_marker); + BUF_ZV (b) = marker_position (BUF_ZV_MARKER (b)); + BUF_ZV_BYTE (b) = marker_byte_position (BUF_ZV_MARKER (b)); } } @@ -2049,7 +2049,7 @@ ends when the current command terminates. Use `switch-to-buffer' or buffer = Fget_buffer (buffer_or_name); if (NILP (buffer)) nsberror (buffer_or_name); - if (NILP (XBUFFER (buffer)->name)) + if (NILP (BUF_NAME (XBUFFER (buffer)))) error ("Selecting deleted buffer"); set_buffer_internal (XBUFFER (buffer)); return buffer; @@ -2061,7 +2061,7 @@ Lisp_Object set_buffer_if_live (buffer) Lisp_Object buffer; { - if (! NILP (XBUFFER (buffer)->name)) + if (! NILP (BUF_NAME (XBUFFER (buffer)))) Fset_buffer (buffer); return Qnil; } @@ -2071,7 +2071,7 @@ DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */) () { - if (!NILP (current_buffer->read_only) + if (!NILP (BUF_READ_ONLY (current_buffer)) && NILP (Vinhibit_read_only)) xsignal1 (Qbuffer_read_only, Fcurrent_buffer ()); return Qnil; @@ -2121,7 +2121,7 @@ its frame, iconify that frame. */) /* Move buffer to the end of the buffer list. Do nothing if the buffer is killed. */ - if (!NILP (XBUFFER (buffer)->name)) + if (!NILP (BUF_NAME (XBUFFER (buffer)))) { Lisp_Object aelt, link; @@ -2154,7 +2154,7 @@ so the buffer is truly empty after this. */) /* Prevent warnings, or suspension of auto saving, that would happen if future size is less than past size. Use of erase-buffer implies that the future text is not really related to the past text. */ - XSETFASTINT (current_buffer->save_length, 0); + XSETFASTINT (BUF_SAVE_LENGTH (current_buffer), 0); return Qnil; } @@ -2227,7 +2227,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, CHECK_BUFFER (buffer); other_buffer = XBUFFER (buffer); - if (NILP (other_buffer->name)) + if (NILP (BUF_NAME (other_buffer))) error ("Cannot swap a dead buffer's text"); /* Actually, it probably works just fine. @@ -2254,6 +2254,12 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, other_buffer->field = current_buffer->field; \ current_buffer->field = tmp##field; \ } while (0) +#define swapfield_(field, type) \ + do { \ + type tmp##field = other_buffer->field ## _; \ + other_buffer->field ## _ = current_buffer->field ## _; \ + current_buffer->field ## _ = tmp##field; \ + } while (0) swapfield (own_text, struct buffer_text); eassert (current_buffer->text == ¤t_buffer->own_text); @@ -2281,16 +2287,16 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, swapfield (overlays_before, struct Lisp_Overlay *); swapfield (overlays_after, struct Lisp_Overlay *); swapfield (overlay_center, EMACS_INT); - swapfield (undo_list, Lisp_Object); - swapfield (mark, Lisp_Object); - swapfield (enable_multibyte_characters, Lisp_Object); + swapfield_ (undo_list, Lisp_Object); + swapfield_ (mark, Lisp_Object); + swapfield_ (enable_multibyte_characters, Lisp_Object); /* FIXME: Not sure what we should do with these *_marker fields. Hopefully they're just nil anyway. */ - swapfield (pt_marker, Lisp_Object); - swapfield (begv_marker, Lisp_Object); - swapfield (zv_marker, Lisp_Object); - current_buffer->point_before_scroll = Qnil; - other_buffer->point_before_scroll = Qnil; + swapfield_ (pt_marker, Lisp_Object); + swapfield_ (begv_marker, Lisp_Object); + swapfield_ (zv_marker, Lisp_Object); + BUF_POINT_BEFORE_SCROLL (current_buffer) = Qnil; + BUF_POINT_BEFORE_SCROLL (other_buffer) = Qnil; current_buffer->text->modiff++; other_buffer->text->modiff++; current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++; @@ -2365,21 +2371,21 @@ current buffer is cleared. */) int begv, zv; int narrowed = (BEG != BEGV || Z != ZV); int modified_p = !NILP (Fbuffer_modified_p (Qnil)); - Lisp_Object old_undo = current_buffer->undo_list; + Lisp_Object old_undo = BUF_UNDO_LIST (current_buffer); struct gcpro gcpro1; if (current_buffer->base_buffer) error ("Cannot do `set-buffer-multibyte' on an indirect buffer"); /* Do nothing if nothing actually changes. */ - if (NILP (flag) == NILP (current_buffer->enable_multibyte_characters)) + if (NILP (flag) == NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) return flag; GCPRO1 (old_undo); /* Don't record these buffer changes. We will put a special undo entry instead. */ - current_buffer->undo_list = Qt; + BUF_UNDO_LIST (current_buffer) = Qt; /* If the cached position is for this buffer, clear it out. */ clear_charpos_cache (current_buffer); @@ -2401,7 +2407,7 @@ current buffer is cleared. */) to calculate the old correspondences. */ set_intervals_multibyte (0); - current_buffer->enable_multibyte_characters = Qnil; + BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer) = Qnil; Z = Z_BYTE; BEGV = BEGV_BYTE; @@ -2539,7 +2545,7 @@ current buffer is cleared. */) /* Do this first, so that chars_in_text asks the right question. set_intervals_multibyte needs it too. */ - current_buffer->enable_multibyte_characters = Qt; + BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer) = Qt; GPT_BYTE = advance_to_char_boundary (GPT_BYTE); GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG; @@ -2598,7 +2604,7 @@ current buffer is cleared. */) { /* Represent all the above changes by a special undo entry. */ extern Lisp_Object Qapply; - current_buffer->undo_list = Fcons (list3 (Qapply, + BUF_UNDO_LIST (current_buffer) = Fcons (list3 (Qapply, intern ("set-buffer-multibyte"), NILP (flag) ? Qt : Qnil), old_undo); @@ -2614,10 +2620,10 @@ current buffer is cleared. */) /* Copy this buffer's new multibyte status into all of its indirect buffers. */ for (other = all_buffers; other; other = other->next) - if (other->base_buffer == current_buffer && !NILP (other->name)) + if (other->base_buffer == current_buffer && !NILP (BUF_NAME (other))) { - other->enable_multibyte_characters - = current_buffer->enable_multibyte_characters; + BUF_ENABLE_MULTIBYTE_CHARACTERS (other) + = BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer); other->prevent_redisplay_optimizations_p = 1; } @@ -2687,7 +2693,7 @@ swap_out_buffer_local_variables (b) Lisp_Object oalist, alist, sym, buffer; XSETBUFFER (buffer, b); - oalist = b->local_var_alist; + oalist = BUF_LOCAL_VAR_ALIST (b); for (alist = oalist; CONSP (alist); alist = XCDR (alist)) { @@ -3212,7 +3218,7 @@ record_overlay_string (ssl, str, str2, pri, size) ssl->buf[ssl->used].priority = (INTEGERP (pri) ? XINT (pri) : 0); ssl->used++; - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) nbytes = SCHARS (str); else if (! STRING_MULTIBYTE (str)) nbytes = count_size_as_multibyte (SDATA (str), @@ -3224,7 +3230,7 @@ record_overlay_string (ssl, str, str2, pri, size) if (STRINGP (str2)) { - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) nbytes = SCHARS (str2); else if (! STRING_MULTIBYTE (str2)) nbytes = count_size_as_multibyte (SDATA (str2), @@ -3257,7 +3263,7 @@ overlay_strings (pos, w, pstr) Lisp_Object overlay, window, str; struct Lisp_Overlay *ov; int startpos, endpos; - int multibyte = ! NILP (current_buffer->enable_multibyte_characters); + int multibyte = ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); overlay_heads.used = overlay_heads.bytes = 0; overlay_tails.used = overlay_tails.bytes = 0; @@ -5187,61 +5193,61 @@ init_buffer_once () /* Must do these before making the first buffer! */ /* real setup is done in bindings.el */ - buffer_defaults.mode_line_format = make_pure_c_string ("%-"); - buffer_defaults.header_line_format = Qnil; - buffer_defaults.abbrev_mode = Qnil; - buffer_defaults.overwrite_mode = Qnil; - buffer_defaults.case_fold_search = Qt; - buffer_defaults.auto_fill_function = Qnil; - buffer_defaults.selective_display = Qnil; + BUF_MODE_LINE_FORMAT (&buffer_defaults) = build_string ("%-"); + BUF_HEADER_LINE_FORMAT (&buffer_defaults) = Qnil; + BUF_ABBREV_MODE (&buffer_defaults) = Qnil; + BUF_OVERWRITE_MODE (&buffer_defaults) = Qnil; + BUF_CASE_FOLD_SEARCH (&buffer_defaults) = Qt; + BUF_AUTO_FILL_FUNCTION (&buffer_defaults) = Qnil; + BUF_SELECTIVE_DISPLAY (&buffer_defaults) = Qnil; #ifndef old - buffer_defaults.selective_display_ellipses = Qt; + BUF_SELECTIVE_DISPLAY_ELLIPSES (&buffer_defaults) = Qt; #endif - buffer_defaults.abbrev_table = Qnil; - buffer_defaults.display_table = Qnil; - buffer_defaults.undo_list = Qnil; - buffer_defaults.mark_active = Qnil; - buffer_defaults.file_format = Qnil; - buffer_defaults.auto_save_file_format = Qt; + BUF_ABBREV_TABLE (&buffer_defaults) = Qnil; + BUF_DISPLAY_TABLE (&buffer_defaults) = Qnil; + BUF_UNDO_LIST (&buffer_defaults) = Qnil; + BUF_MARK_ACTIVE (&buffer_defaults) = Qnil; + BUF_FILE_FORMAT (&buffer_defaults) = Qnil; + BUF_AUTO_SAVE_FILE_FORMAT (&buffer_defaults) = Qt; buffer_defaults.overlays_before = NULL; buffer_defaults.overlays_after = NULL; buffer_defaults.overlay_center = BEG; - XSETFASTINT (buffer_defaults.tab_width, 8); - buffer_defaults.truncate_lines = Qnil; - buffer_defaults.word_wrap = Qnil; - buffer_defaults.ctl_arrow = Qt; - buffer_defaults.direction_reversed = Qnil; - buffer_defaults.cursor_type = Qt; - buffer_defaults.extra_line_spacing = Qnil; - buffer_defaults.cursor_in_non_selected_windows = Qt; + XSETFASTINT (BUF_TAB_WIDTH (&buffer_defaults), 8); + BUF_TRUNCATE_LINES (&buffer_defaults) = Qnil; + BUF_WORD_WRAP (&buffer_defaults) = Qnil; + BUF_CTL_ARROW (&buffer_defaults) = Qt; + BUF_DIRECTION_REVERSED (&buffer_defaults) = Qnil; + BUF_CURSOR_TYPE (&buffer_defaults) = Qt; + BUF_EXTRA_LINE_SPACING (&buffer_defaults) = Qnil; + BUF_CURSOR_IN_NON_SELECTED_WINDOWS (&buffer_defaults) = Qt; buffer_defaults.owner = Qnil; buffer_defaults.prev_owner = Qnil; #ifdef DOS_NT buffer_defaults.buffer_file_type = Qnil; /* TEXT */ #endif - buffer_defaults.enable_multibyte_characters = Qt; - buffer_defaults.buffer_file_coding_system = Qnil; - XSETFASTINT (buffer_defaults.fill_column, 70); - XSETFASTINT (buffer_defaults.left_margin, 0); - buffer_defaults.cache_long_line_scans = Qnil; - buffer_defaults.file_truename = Qnil; - XSETFASTINT (buffer_defaults.display_count, 0); - XSETFASTINT (buffer_defaults.left_margin_cols, 0); - XSETFASTINT (buffer_defaults.right_margin_cols, 0); - buffer_defaults.left_fringe_width = Qnil; - buffer_defaults.right_fringe_width = Qnil; - buffer_defaults.fringes_outside_margins = Qnil; - buffer_defaults.scroll_bar_width = Qnil; - buffer_defaults.vertical_scroll_bar_type = Qt; - buffer_defaults.indicate_empty_lines = Qnil; - buffer_defaults.indicate_buffer_boundaries = Qnil; - buffer_defaults.fringe_indicator_alist = Qnil; - buffer_defaults.fringe_cursor_alist = Qnil; - buffer_defaults.scroll_up_aggressively = Qnil; - buffer_defaults.scroll_down_aggressively = Qnil; - buffer_defaults.display_time = Qnil; + BUF_ENABLE_MULTIBYTE_CHARACTERS (&buffer_defaults) = Qt; + BUF_BUFFER_FILE_CODING_SYSTEM (&buffer_defaults) = Qnil; + XSETFASTINT (BUF_FILL_COLUMN (&buffer_defaults), 70); + XSETFASTINT (BUF_LEFT_MARGIN (&buffer_defaults), 0); + BUF_CACHE_LONG_LINE_SCANS (&buffer_defaults) = Qnil; + BUF_FILE_TRUENAME (&buffer_defaults) = Qnil; + XSETFASTINT (BUF_DISPLAY_COUNT (&buffer_defaults), 0); + XSETFASTINT (BUF_LEFT_MARGIN_COLS (&buffer_defaults), 0); + XSETFASTINT (BUF_RIGHT_MARGIN_COLS (&buffer_defaults), 0); + BUF_LEFT_FRINGE_WIDTH (&buffer_defaults) = Qnil; + BUF_RIGHT_FRINGE_WIDTH (&buffer_defaults) = Qnil; + BUF_FRINGES_OUTSIDE_MARGINS (&buffer_defaults) = Qnil; + BUF_SCROLL_BAR_WIDTH (&buffer_defaults) = Qnil; + BUF_VERTICAL_SCROLL_BAR_TYPE (&buffer_defaults) = Qt; + BUF_INDICATE_EMPTY_LINES (&buffer_defaults) = Qnil; + BUF_INDICATE_BUFFER_BOUNDARIES (&buffer_defaults) = Qnil; + BUF_FRINGE_INDICATOR_ALIST (&buffer_defaults) = Qnil; + BUF_FRINGE_CURSOR_ALIST (&buffer_defaults) = Qnil; + BUF_SCROLL_UP_AGGRESSIVELY (&buffer_defaults) = Qnil; + BUF_SCROLL_DOWN_AGGRESSIVELY (&buffer_defaults) = Qnil; + BUF_DISPLAY_TIME (&buffer_defaults) = Qnil; /* Assign the local-flags to the slots that have default values. The local flag is a bit that is used in the buffer @@ -5253,72 +5259,72 @@ init_buffer_once () /* 0 means not a lisp var, -1 means always local, else mask */ bzero (&buffer_local_flags, sizeof buffer_local_flags); - XSETINT (buffer_local_flags.filename, -1); - XSETINT (buffer_local_flags.directory, -1); - XSETINT (buffer_local_flags.backed_up, -1); - XSETINT (buffer_local_flags.save_length, -1); - XSETINT (buffer_local_flags.auto_save_file_name, -1); - XSETINT (buffer_local_flags.read_only, -1); - XSETINT (buffer_local_flags.major_mode, -1); - XSETINT (buffer_local_flags.mode_name, -1); - XSETINT (buffer_local_flags.undo_list, -1); - XSETINT (buffer_local_flags.mark_active, -1); - XSETINT (buffer_local_flags.point_before_scroll, -1); - XSETINT (buffer_local_flags.file_truename, -1); - XSETINT (buffer_local_flags.invisibility_spec, -1); - XSETINT (buffer_local_flags.file_format, -1); - XSETINT (buffer_local_flags.auto_save_file_format, -1); - XSETINT (buffer_local_flags.display_count, -1); - XSETINT (buffer_local_flags.display_time, -1); - XSETINT (buffer_local_flags.enable_multibyte_characters, -1); + XSETINT (BUF_FILENAME (&buffer_local_flags), -1); + XSETINT (BUF_DIRECTORY (&buffer_local_flags), -1); + XSETINT (BUF_BACKED_UP (&buffer_local_flags), -1); + XSETINT (BUF_SAVE_LENGTH (&buffer_local_flags), -1); + XSETINT (BUF_AUTO_SAVE_FILE_NAME (&buffer_local_flags), -1); + XSETINT (BUF_READ_ONLY (&buffer_local_flags), -1); + XSETINT (BUF_MAJOR_MODE (&buffer_local_flags), -1); + XSETINT (BUF_MODE_NAME (&buffer_local_flags), -1); + XSETINT (BUF_UNDO_LIST (&buffer_local_flags), -1); + XSETINT (BUF_MARK_ACTIVE (&buffer_local_flags), -1); + XSETINT (BUF_POINT_BEFORE_SCROLL (&buffer_local_flags), -1); + XSETINT (BUF_FILE_TRUENAME (&buffer_local_flags), -1); + XSETINT (BUF_INVISIBILITY_SPEC (&buffer_local_flags), -1); + XSETINT (BUF_FILE_FORMAT (&buffer_local_flags), -1); + XSETINT (BUF_AUTO_SAVE_FILE_FORMAT (&buffer_local_flags), -1); + XSETINT (BUF_DISPLAY_COUNT (&buffer_local_flags), -1); + XSETINT (BUF_DISPLAY_TIME (&buffer_local_flags), -1); + XSETINT (BUF_ENABLE_MULTIBYTE_CHARACTERS (&buffer_local_flags), -1); idx = 1; - XSETFASTINT (buffer_local_flags.mode_line_format, idx); ++idx; - XSETFASTINT (buffer_local_flags.abbrev_mode, idx); ++idx; - XSETFASTINT (buffer_local_flags.overwrite_mode, idx); ++idx; - XSETFASTINT (buffer_local_flags.case_fold_search, idx); ++idx; - XSETFASTINT (buffer_local_flags.auto_fill_function, idx); ++idx; - XSETFASTINT (buffer_local_flags.selective_display, idx); ++idx; + XSETFASTINT (BUF_MODE_LINE_FORMAT (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_ABBREV_MODE (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_OVERWRITE_MODE (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_CASE_FOLD_SEARCH (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_AUTO_FILL_FUNCTION (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_SELECTIVE_DISPLAY (&buffer_local_flags), idx); ++idx; #ifndef old - XSETFASTINT (buffer_local_flags.selective_display_ellipses, idx); ++idx; + XSETFASTINT (BUF_SELECTIVE_DISPLAY_ELLIPSES (&buffer_local_flags), idx); ++idx; #endif - XSETFASTINT (buffer_local_flags.tab_width, idx); ++idx; - XSETFASTINT (buffer_local_flags.truncate_lines, idx); ++idx; - XSETFASTINT (buffer_local_flags.word_wrap, idx); ++idx; - XSETFASTINT (buffer_local_flags.ctl_arrow, idx); ++idx; - XSETFASTINT (buffer_local_flags.fill_column, idx); ++idx; - XSETFASTINT (buffer_local_flags.left_margin, idx); ++idx; - XSETFASTINT (buffer_local_flags.abbrev_table, idx); ++idx; - XSETFASTINT (buffer_local_flags.display_table, idx); ++idx; + XSETFASTINT (BUF_TAB_WIDTH (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_TRUNCATE_LINES (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_WORD_WRAP (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_CTL_ARROW (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_FILL_COLUMN (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_LEFT_MARGIN (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_ABBREV_TABLE (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_DISPLAY_TABLE (&buffer_local_flags), idx); ++idx; #ifdef DOS_NT XSETFASTINT (buffer_local_flags.buffer_file_type, idx); /* Make this one a permanent local. */ buffer_permanent_local_flags[idx++] = 1; #endif - XSETFASTINT (buffer_local_flags.syntax_table, idx); ++idx; - XSETFASTINT (buffer_local_flags.cache_long_line_scans, idx); ++idx; - XSETFASTINT (buffer_local_flags.category_table, idx); ++idx; - XSETFASTINT (buffer_local_flags.direction_reversed, idx); ++idx; - XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx); + XSETFASTINT (BUF_SYNTAX_TABLE (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_CACHE_LONG_LINE_SCANS (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_CATEGORY_TABLE (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_DIRECTION_REVERSED (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_BUFFER_FILE_CODING_SYSTEM (&buffer_local_flags), idx); /* Make this one a permanent local. */ buffer_permanent_local_flags[idx++] = 1; - XSETFASTINT (buffer_local_flags.left_margin_cols, idx); ++idx; - XSETFASTINT (buffer_local_flags.right_margin_cols, idx); ++idx; - XSETFASTINT (buffer_local_flags.left_fringe_width, idx); ++idx; - XSETFASTINT (buffer_local_flags.right_fringe_width, idx); ++idx; - XSETFASTINT (buffer_local_flags.fringes_outside_margins, idx); ++idx; - XSETFASTINT (buffer_local_flags.scroll_bar_width, idx); ++idx; - XSETFASTINT (buffer_local_flags.vertical_scroll_bar_type, idx); ++idx; - XSETFASTINT (buffer_local_flags.indicate_empty_lines, idx); ++idx; - XSETFASTINT (buffer_local_flags.indicate_buffer_boundaries, idx); ++idx; - XSETFASTINT (buffer_local_flags.fringe_indicator_alist, idx); ++idx; - XSETFASTINT (buffer_local_flags.fringe_cursor_alist, idx); ++idx; - XSETFASTINT (buffer_local_flags.scroll_up_aggressively, idx); ++idx; - XSETFASTINT (buffer_local_flags.scroll_down_aggressively, idx); ++idx; - XSETFASTINT (buffer_local_flags.header_line_format, idx); ++idx; - XSETFASTINT (buffer_local_flags.cursor_type, idx); ++idx; - XSETFASTINT (buffer_local_flags.extra_line_spacing, idx); ++idx; - XSETFASTINT (buffer_local_flags.cursor_in_non_selected_windows, idx); ++idx; + XSETFASTINT (BUF_LEFT_MARGIN_COLS (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_RIGHT_MARGIN_COLS (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_LEFT_FRINGE_WIDTH (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_RIGHT_FRINGE_WIDTH (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_FRINGES_OUTSIDE_MARGINS (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_SCROLL_BAR_WIDTH (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_VERTICAL_SCROLL_BAR_TYPE (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_INDICATE_EMPTY_LINES (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_INDICATE_BUFFER_BOUNDARIES (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_FRINGE_INDICATOR_ALIST (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_FRINGE_CURSOR_ALIST (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_SCROLL_UP_AGGRESSIVELY (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_SCROLL_DOWN_AGGRESSIVELY (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_HEADER_LINE_FORMAT (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_CURSOR_TYPE (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_EXTRA_LINE_SPACING (&buffer_local_flags), idx); ++idx; + XSETFASTINT (BUF_CURSOR_IN_NON_SELECTED_WINDOWS (&buffer_local_flags), idx); ++idx; /* Need more room? */ if (idx >= MAX_PER_BUFFER_VARS) @@ -5331,8 +5337,8 @@ init_buffer_once () QSFundamental = make_pure_c_string ("Fundamental"); - Qfundamental_mode = intern_c_string ("fundamental-mode"); - buffer_defaults.major_mode = Qfundamental_mode; + Qfundamental_mode = intern ("fundamental-mode"); + BUF_MAJOR_MODE (&buffer_defaults) = Qfundamental_mode; Qmode_class = intern_c_string ("mode-class"); @@ -5375,7 +5381,7 @@ init_buffer () #endif /* USE_MMAP_FOR_BUFFERS */ Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); - if (NILP (buffer_defaults.enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (&buffer_defaults))) Fset_buffer_multibyte (Qnil); pwd = get_current_dir_name (); @@ -5396,28 +5402,28 @@ init_buffer () pwd[len + 1] = '\0'; } - current_buffer->directory = make_unibyte_string (pwd, strlen (pwd)); - if (! NILP (buffer_defaults.enable_multibyte_characters)) + BUF_DIRECTORY (current_buffer) = make_unibyte_string (pwd, strlen (pwd)); + if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (&buffer_defaults))) /* 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. */ - current_buffer->directory - = string_to_multibyte (current_buffer->directory); + BUF_DIRECTORY (current_buffer) + = string_to_multibyte (BUF_DIRECTORY (current_buffer)); /* Add /: to the front of the name if it would otherwise be treated as magic. */ - temp = Ffind_file_name_handler (current_buffer->directory, Qt); + temp = Ffind_file_name_handler (BUF_DIRECTORY (current_buffer), Qt); if (! NILP (temp) /* If the default dir is just /, TEMP is non-nil because of the ange-ftp completion handler. However, it is not necessary to turn / into /:/. So avoid doing that. */ - && strcmp ("/", SDATA (current_buffer->directory))) - current_buffer->directory - = concat2 (build_string ("/:"), current_buffer->directory); + && strcmp ("/", SDATA (BUF_DIRECTORY (current_buffer)))) + BUF_DIRECTORY (current_buffer) + = concat2 (build_string ("/:"), BUF_DIRECTORY (current_buffer)); temp = get_minibuffer (0); - XBUFFER (temp)->directory = current_buffer->directory; + BUF_DIRECTORY (XBUFFER (temp)) = BUF_DIRECTORY (current_buffer); free (pwd); } @@ -5522,76 +5528,76 @@ syms_of_buffer () buffer_defaults will all be marked via Vbuffer_defaults. */ DEFVAR_LISP_NOPRO ("default-mode-line-format", - &buffer_defaults.mode_line_format, + &BUF_MODE_LINE_FORMAT (&buffer_defaults), doc: /* Default value of `mode-line-format' for buffers that don't override it. This is the same as (default-value 'mode-line-format). */); DEFVAR_LISP_NOPRO ("default-header-line-format", - &buffer_defaults.header_line_format, + &BUF_HEADER_LINE_FORMAT (&buffer_defaults), doc: /* Default value of `header-line-format' for buffers that don't override it. This is the same as (default-value 'header-line-format). */); - DEFVAR_LISP_NOPRO ("default-cursor-type", &buffer_defaults.cursor_type, + DEFVAR_LISP_NOPRO ("default-cursor-type", &BUF_CURSOR_TYPE (&buffer_defaults), doc: /* Default value of `cursor-type' for buffers that don't override it. This is the same as (default-value 'cursor-type). */); DEFVAR_LISP_NOPRO ("default-line-spacing", - &buffer_defaults.extra_line_spacing, + &BUF_EXTRA_LINE_SPACING (&buffer_defaults), doc: /* Default value of `line-spacing' for buffers that don't override it. This is the same as (default-value 'line-spacing). */); DEFVAR_LISP_NOPRO ("default-cursor-in-non-selected-windows", - &buffer_defaults.cursor_in_non_selected_windows, + &BUF_CURSOR_IN_NON_SELECTED_WINDOWS (&buffer_defaults), doc: /* Default value of `cursor-in-non-selected-windows'. This is the same as (default-value 'cursor-in-non-selected-windows). */); DEFVAR_LISP_NOPRO ("default-abbrev-mode", - &buffer_defaults.abbrev_mode, + &BUF_ABBREV_MODE (&buffer_defaults), doc: /* Default value of `abbrev-mode' for buffers that do not override it. This is the same as (default-value 'abbrev-mode). */); DEFVAR_LISP_NOPRO ("default-ctl-arrow", - &buffer_defaults.ctl_arrow, + &BUF_CTL_ARROW (&buffer_defaults), doc: /* Default value of `ctl-arrow' for buffers that do not override it. This is the same as (default-value 'ctl-arrow). */); DEFVAR_LISP_NOPRO ("default-direction-reversed", - &buffer_defaults.direction_reversed, + &BUF_DIRECTION_REVERSED (&buffer_defaults), doc: /* Default value of `direction-reversed' for buffers that do not override it. This is the same as (default-value 'direction-reversed). */); DEFVAR_LISP_NOPRO ("default-enable-multibyte-characters", - &buffer_defaults.enable_multibyte_characters, + &BUF_ENABLE_MULTIBYTE_CHARACTERS (&buffer_defaults), doc: /* *Default value of `enable-multibyte-characters' for buffers not overriding it. This is the same as (default-value 'enable-multibyte-characters). */); DEFVAR_LISP_NOPRO ("default-buffer-file-coding-system", - &buffer_defaults.buffer_file_coding_system, + &BUF_BUFFER_FILE_CODING_SYSTEM (&buffer_defaults), doc: /* Default value of `buffer-file-coding-system' for buffers not overriding it. This is the same as (default-value 'buffer-file-coding-system). */); DEFVAR_LISP_NOPRO ("default-truncate-lines", - &buffer_defaults.truncate_lines, + &BUF_TRUNCATE_LINES (&buffer_defaults), doc: /* Default value of `truncate-lines' for buffers that do not override it. This is the same as (default-value 'truncate-lines). */); DEFVAR_LISP_NOPRO ("default-fill-column", - &buffer_defaults.fill_column, + &BUF_FILL_COLUMN (&buffer_defaults), doc: /* Default value of `fill-column' for buffers that do not override it. This is the same as (default-value 'fill-column). */); DEFVAR_LISP_NOPRO ("default-left-margin", - &buffer_defaults.left_margin, + &BUF_LEFT_MARGIN (&buffer_defaults), doc: /* Default value of `left-margin' for buffers that do not override it. This is the same as (default-value 'left-margin). */); DEFVAR_LISP_NOPRO ("default-tab-width", - &buffer_defaults.tab_width, + &BUF_TAB_WIDTH (&buffer_defaults), doc: /* Default value of `tab-width' for buffers that do not override it. This is the same as (default-value 'tab-width). */); DEFVAR_LISP_NOPRO ("default-case-fold-search", - &buffer_defaults.case_fold_search, + &BUF_CASE_FOLD_SEARCH (&buffer_defaults), doc: /* Default value of `case-fold-search' for buffers that don't override it. This is the same as (default-value 'case-fold-search). */); @@ -5604,80 +5610,80 @@ The file type is nil for text, t for binary. */); #endif DEFVAR_LISP_NOPRO ("default-left-margin-width", - &buffer_defaults.left_margin_cols, + &BUF_LEFT_MARGIN_COLS (&buffer_defaults), doc: /* Default value of `left-margin-width' for buffers that don't override it. This is the same as (default-value 'left-margin-width). */); DEFVAR_LISP_NOPRO ("default-right-margin-width", - &buffer_defaults.right_margin_cols, + &BUF_RIGHT_MARGIN_COLS (&buffer_defaults), doc: /* Default value of `right-margin-width' for buffers that don't override it. This is the same as (default-value 'right-margin-width). */); DEFVAR_LISP_NOPRO ("default-left-fringe-width", - &buffer_defaults.left_fringe_width, + &BUF_LEFT_FRINGE_WIDTH (&buffer_defaults), doc: /* Default value of `left-fringe-width' for buffers that don't override it. This is the same as (default-value 'left-fringe-width). */); DEFVAR_LISP_NOPRO ("default-right-fringe-width", - &buffer_defaults.right_fringe_width, + &BUF_RIGHT_FRINGE_WIDTH (&buffer_defaults), doc: /* Default value of `right-fringe-width' for buffers that don't override it. This is the same as (default-value 'right-fringe-width). */); DEFVAR_LISP_NOPRO ("default-fringes-outside-margins", - &buffer_defaults.fringes_outside_margins, + &BUF_FRINGES_OUTSIDE_MARGINS (&buffer_defaults), doc: /* Default value of `fringes-outside-margins' for buffers that don't override it. This is the same as (default-value 'fringes-outside-margins). */); DEFVAR_LISP_NOPRO ("default-scroll-bar-width", - &buffer_defaults.scroll_bar_width, + &BUF_SCROLL_BAR_WIDTH (&buffer_defaults), doc: /* Default value of `scroll-bar-width' for buffers that don't override it. This is the same as (default-value 'scroll-bar-width). */); DEFVAR_LISP_NOPRO ("default-vertical-scroll-bar", - &buffer_defaults.vertical_scroll_bar_type, + &BUF_VERTICAL_SCROLL_BAR_TYPE (&buffer_defaults), doc: /* Default value of `vertical-scroll-bar' for buffers that don't override it. This is the same as (default-value 'vertical-scroll-bar). */); DEFVAR_LISP_NOPRO ("default-indicate-empty-lines", - &buffer_defaults.indicate_empty_lines, + &BUF_INDICATE_EMPTY_LINES (&buffer_defaults), doc: /* Default value of `indicate-empty-lines' for buffers that don't override it. This is the same as (default-value 'indicate-empty-lines). */); DEFVAR_LISP_NOPRO ("default-indicate-buffer-boundaries", - &buffer_defaults.indicate_buffer_boundaries, + &BUF_INDICATE_BUFFER_BOUNDARIES (&buffer_defaults), doc: /* Default value of `indicate-buffer-boundaries' for buffers that don't override it. This is the same as (default-value 'indicate-buffer-boundaries). */); DEFVAR_LISP_NOPRO ("default-fringe-indicator-alist", - &buffer_defaults.fringe_indicator_alist, + &BUF_FRINGE_INDICATOR_ALIST (&buffer_defaults), doc: /* Default value of `fringe-indicator-alist' for buffers that don't override it. This is the same as (default-value 'fringe-indicator-alist'). */); DEFVAR_LISP_NOPRO ("default-fringe-cursor-alist", - &buffer_defaults.fringe_cursor_alist, + &BUF_FRINGE_CURSOR_ALIST (&buffer_defaults), doc: /* Default value of `fringe-cursor-alist' for buffers that don't override it. This is the same as (default-value 'fringe-cursor-alist'). */); DEFVAR_LISP_NOPRO ("default-scroll-up-aggressively", - &buffer_defaults.scroll_up_aggressively, + &BUF_SCROLL_UP_AGGRESSIVELY (&buffer_defaults), doc: /* Default value of `scroll-up-aggressively'. This value applies in buffers that don't have their own local values. This is the same as (default-value 'scroll-up-aggressively). */); DEFVAR_LISP_NOPRO ("default-scroll-down-aggressively", - &buffer_defaults.scroll_down_aggressively, + &BUF_SCROLL_DOWN_AGGRESSIVELY (&buffer_defaults), doc: /* Default value of `scroll-down-aggressively'. This value applies in buffers that don't have their own local values. This is the same as (default-value 'scroll-down-aggressively). */); DEFVAR_PER_BUFFER ("header-line-format", - ¤t_buffer->header_line_format, + &BUF_HEADER_LINE_FORMAT (current_buffer), Qnil, doc: /* Analogous to `mode-line-format', but controls the header line. The header line appears, optionally, at the top of a window; the mode line appears at the bottom. */); - DEFVAR_PER_BUFFER ("mode-line-format", ¤t_buffer->mode_line_format, + DEFVAR_PER_BUFFER ("mode-line-format", &BUF_MODE_LINE_FORMAT (current_buffer), Qnil, doc: /* Template for displaying mode line for current buffer. Each buffer has its own value of this variable. @@ -5731,10 +5737,10 @@ A string is printed verbatim in the mode line except for %-constructs: %% -- print %. %- -- print infinitely many dashes. Decimal digits after the % specify field width to which to pad. */); - DEFVAR_LISP_NOPRO ("default-major-mode", &buffer_defaults.major_mode, + DEFVAR_LISP_NOPRO ("default-major-mode", &BUF_MAJOR_MODE (&buffer_defaults), doc: /* *Value of `major-mode' for new buffers. */); - DEFVAR_PER_BUFFER ("major-mode", ¤t_buffer->major_mode, + DEFVAR_PER_BUFFER ("major-mode", &BUF_MAJOR_MODE (current_buffer), make_number (Lisp_Symbol), doc: /* Symbol for current buffer's major mode. The default value (normally `fundamental-mode') affects new buffers. @@ -5747,45 +5753,45 @@ the buffer. Thus, the mode and its hooks should not expect certain variables such as `buffer-read-only' and `buffer-file-coding-system' to be set up. */); - DEFVAR_PER_BUFFER ("mode-name", ¤t_buffer->mode_name, + DEFVAR_PER_BUFFER ("mode-name", &BUF_MODE_NAME (current_buffer), Qnil, doc: /* Pretty name of current buffer's major mode. Usually a string, but can use any of the constructs for `mode-line-format', which see. Format with `format-mode-line' to produce a string value. */); - DEFVAR_PER_BUFFER ("local-abbrev-table", ¤t_buffer->abbrev_table, Qnil, + DEFVAR_PER_BUFFER ("local-abbrev-table", &BUF_ABBREV_TABLE (current_buffer), Qnil, doc: /* Local (mode-specific) abbrev table of current buffer. */); - DEFVAR_PER_BUFFER ("abbrev-mode", ¤t_buffer->abbrev_mode, Qnil, + DEFVAR_PER_BUFFER ("abbrev-mode", &BUF_ABBREV_MODE (current_buffer), Qnil, doc: /* Non-nil turns on automatic expansion of abbrevs as they are inserted. */); - DEFVAR_PER_BUFFER ("case-fold-search", ¤t_buffer->case_fold_search, + DEFVAR_PER_BUFFER ("case-fold-search", &BUF_CASE_FOLD_SEARCH (current_buffer), Qnil, doc: /* *Non-nil if searches and matches should ignore case. */); - DEFVAR_PER_BUFFER ("fill-column", ¤t_buffer->fill_column, - make_number (LISP_INT_TAG), + DEFVAR_PER_BUFFER ("fill-column", &BUF_FILL_COLUMN (current_buffer), + make_number (Lisp_Int), doc: /* *Column beyond which automatic line-wrapping should happen. Interactively, you can set the buffer local value using \\[set-fill-column]. */); - DEFVAR_PER_BUFFER ("left-margin", ¤t_buffer->left_margin, - make_number (LISP_INT_TAG), + DEFVAR_PER_BUFFER ("left-margin", &BUF_LEFT_MARGIN (current_buffer), + make_number (Lisp_Int), doc: /* *Column for the default `indent-line-function' to indent to. Linefeed indents to this column in Fundamental mode. */); - DEFVAR_PER_BUFFER ("tab-width", ¤t_buffer->tab_width, - make_number (LISP_INT_TAG), + DEFVAR_PER_BUFFER ("tab-width", &BUF_TAB_WIDTH (current_buffer), + make_number (Lisp_Int), doc: /* *Distance between tab stops (for display of tab characters), in columns. */); - DEFVAR_PER_BUFFER ("ctl-arrow", ¤t_buffer->ctl_arrow, Qnil, + DEFVAR_PER_BUFFER ("ctl-arrow", &BUF_CTL_ARROW (current_buffer), Qnil, doc: /* *Non-nil means display control chars with uparrow. A value of nil means use backslash and octal digits. This variable does not apply to characters whose display is specified in the current display table (if there is one). */); DEFVAR_PER_BUFFER ("enable-multibyte-characters", - ¤t_buffer->enable_multibyte_characters, + &BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer), Qnil, doc: /* Non-nil means the buffer contents are regarded as multi-byte characters. Otherwise they are regarded as unibyte. This affects the display, @@ -5799,7 +5805,7 @@ See also variable `default-enable-multibyte-characters' and Info node XSYMBOL (intern_c_string ("enable-multibyte-characters"))->constant = 1; DEFVAR_PER_BUFFER ("buffer-file-coding-system", - ¤t_buffer->buffer_file_coding_system, Qnil, + &BUF_BUFFER_FILE_CODING_SYSTEM (current_buffer), Qnil, doc: /* Coding system to be used for encoding the buffer contents on saving. This variable applies to saving the buffer, and also to `write-region' and other functions that use `write-region'. @@ -5816,11 +5822,11 @@ The variable `coding-system-for-write', if non-nil, overrides this variable. This variable is never applied to a way of decoding a file while reading it. */); - DEFVAR_PER_BUFFER ("direction-reversed", ¤t_buffer->direction_reversed, + DEFVAR_PER_BUFFER ("direction-reversed", &BUF_DIRECTION_REVERSED (current_buffer), Qnil, doc: /* *Non-nil means lines in the buffer are displayed right to left. */); - DEFVAR_PER_BUFFER ("truncate-lines", ¤t_buffer->truncate_lines, Qnil, + DEFVAR_PER_BUFFER ("truncate-lines", &BUF_TRUNCATE_LINES (current_buffer), Qnil, doc: /* *Non-nil means do not display continuation lines. Instead, give each line of text just one screen line. @@ -5828,7 +5834,7 @@ Note that this is overridden by the variable `truncate-partial-width-windows' if that variable is non-nil and this buffer is not full-frame width. */); - DEFVAR_PER_BUFFER ("word-wrap", ¤t_buffer->word_wrap, Qnil, + DEFVAR_PER_BUFFER ("word-wrap", &BUF_WORD_WRAP (current_buffer), Qnil, doc: /* *Non-nil means to use word-wrapping for continuation lines. When word-wrapping is on, continuation lines are wrapped at the space or tab character nearest to the right window edge. @@ -5849,12 +5855,12 @@ On those systems, it is automatically local in every buffer. On other systems, this variable is normally always nil. */); #endif - DEFVAR_PER_BUFFER ("default-directory", ¤t_buffer->directory, + DEFVAR_PER_BUFFER ("default-directory", &BUF_DIRECTORY (current_buffer), make_number (Lisp_String), doc: /* Name of default directory of current buffer. Should end with slash. To interactively change the default directory, use command `cd'. */); - DEFVAR_PER_BUFFER ("auto-fill-function", ¤t_buffer->auto_fill_function, + DEFVAR_PER_BUFFER ("auto-fill-function", &BUF_AUTO_FILL_FUNCTION (current_buffer), Qnil, doc: /* Function called (if non-nil) to perform auto-fill. It is called after self-inserting any character specified in @@ -5862,31 +5868,31 @@ the `auto-fill-chars' table. NOTE: This variable is not a hook; its value may not be a list of functions. */); - DEFVAR_PER_BUFFER ("buffer-file-name", ¤t_buffer->filename, + DEFVAR_PER_BUFFER ("buffer-file-name", &BUF_FILENAME (current_buffer), make_number (Lisp_String), doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); - DEFVAR_PER_BUFFER ("buffer-file-truename", ¤t_buffer->file_truename, + DEFVAR_PER_BUFFER ("buffer-file-truename", &BUF_FILE_TRUENAME (current_buffer), make_number (Lisp_String), doc: /* Abbreviated truename of file visited in current buffer, or nil if none. The truename of a file is calculated by `file-truename' and then abbreviated with `abbreviate-file-name'. */); DEFVAR_PER_BUFFER ("buffer-auto-save-file-name", - ¤t_buffer->auto_save_file_name, + &BUF_AUTO_SAVE_FILE_NAME (current_buffer), make_number (Lisp_String), doc: /* Name of file for auto-saving current buffer. If it is nil, that means don't auto-save this buffer. */); - DEFVAR_PER_BUFFER ("buffer-read-only", ¤t_buffer->read_only, Qnil, + DEFVAR_PER_BUFFER ("buffer-read-only", &BUF_READ_ONLY (current_buffer), Qnil, doc: /* Non-nil if this buffer is read-only. */); - DEFVAR_PER_BUFFER ("buffer-backed-up", ¤t_buffer->backed_up, Qnil, + DEFVAR_PER_BUFFER ("buffer-backed-up", &BUF_BACKED_UP (current_buffer), Qnil, doc: /* Non-nil if this buffer's file has been backed up. Backing up is done before the first time the file is saved. */); - DEFVAR_PER_BUFFER ("buffer-saved-size", ¤t_buffer->save_length, - make_number (LISP_INT_TAG), + DEFVAR_PER_BUFFER ("buffer-saved-size", &BUF_SAVE_LENGTH (current_buffer), + make_number (Lisp_Int), doc: /* Length of current buffer when last read in, saved or auto-saved. 0 initially. -1 means auto-saving turned off until next real save. @@ -5895,7 +5901,7 @@ If you set this to -2, that means don't turn off auto-saving in this buffer if its text size shrinks. If you use `buffer-swap-text' on a buffer, you probably should set this to -2 in that buffer. */); - DEFVAR_PER_BUFFER ("selective-display", ¤t_buffer->selective_display, + DEFVAR_PER_BUFFER ("selective-display", &BUF_SELECTIVE_DISPLAY (current_buffer), Qnil, doc: /* Non-nil enables selective display. An integer N as value means display only lines @@ -5906,12 +5912,12 @@ in a file, save the ^M as a newline. */); #ifndef old DEFVAR_PER_BUFFER ("selective-display-ellipses", - ¤t_buffer->selective_display_ellipses, + &BUF_SELECTIVE_DISPLAY_ELLIPSES (current_buffer), Qnil, doc: /* Non-nil means display ... on previous line when a line is invisible. */); #endif - DEFVAR_PER_BUFFER ("overwrite-mode", ¤t_buffer->overwrite_mode, Qnil, + DEFVAR_PER_BUFFER ("overwrite-mode", &BUF_OVERWRITE_MODE (current_buffer), Qnil, doc: /* Non-nil if self-insertion should replace existing text. The value should be one of `overwrite-mode-textual', `overwrite-mode-binary', or nil. @@ -5920,7 +5926,7 @@ inserts at the end of a line, and inserts when point is before a tab, until the tab is filled in. If `overwrite-mode-binary', self-insertion replaces newlines and tabs too. */); - DEFVAR_PER_BUFFER ("buffer-display-table", ¤t_buffer->display_table, + DEFVAR_PER_BUFFER ("buffer-display-table", &BUF_DISPLAY_TABLE (current_buffer), Qnil, doc: /* Display table that controls display of the contents of current buffer. @@ -5957,39 +5963,39 @@ In addition, a char-table has six extra slots to control the display of: See also the functions `display-table-slot' and `set-display-table-slot'. */); - DEFVAR_PER_BUFFER ("left-margin-width", ¤t_buffer->left_margin_cols, + DEFVAR_PER_BUFFER ("left-margin-width", &BUF_LEFT_MARGIN_COLS (current_buffer), Qnil, doc: /* *Width of left marginal area for display of a buffer. A value of nil means no marginal area. */); - DEFVAR_PER_BUFFER ("right-margin-width", ¤t_buffer->right_margin_cols, + DEFVAR_PER_BUFFER ("right-margin-width", &BUF_RIGHT_MARGIN_COLS (current_buffer), Qnil, doc: /* *Width of right marginal area for display of a buffer. A value of nil means no marginal area. */); - DEFVAR_PER_BUFFER ("left-fringe-width", ¤t_buffer->left_fringe_width, + DEFVAR_PER_BUFFER ("left-fringe-width", &BUF_LEFT_FRINGE_WIDTH (current_buffer), Qnil, doc: /* *Width of this buffer's left fringe (in pixels). A value of 0 means no left fringe is shown in this buffer's window. A value of nil means to use the left fringe width from the window's frame. */); - DEFVAR_PER_BUFFER ("right-fringe-width", ¤t_buffer->right_fringe_width, + DEFVAR_PER_BUFFER ("right-fringe-width", &BUF_RIGHT_FRINGE_WIDTH (current_buffer), Qnil, doc: /* *Width of this buffer's right fringe (in pixels). A value of 0 means no right fringe is shown in this buffer's window. A value of nil means to use the right fringe width from the window's frame. */); - DEFVAR_PER_BUFFER ("fringes-outside-margins", ¤t_buffer->fringes_outside_margins, + DEFVAR_PER_BUFFER ("fringes-outside-margins", &BUF_FRINGES_OUTSIDE_MARGINS (current_buffer), Qnil, doc: /* *Non-nil means to display fringes outside display margins. A value of nil means to display fringes between margins and buffer text. */); - DEFVAR_PER_BUFFER ("scroll-bar-width", ¤t_buffer->scroll_bar_width, + DEFVAR_PER_BUFFER ("scroll-bar-width", &BUF_SCROLL_BAR_WIDTH (current_buffer), Qnil, doc: /* *Width of this buffer's scroll bars in pixels. A value of nil means to use the scroll bar width from the window's frame. */); - DEFVAR_PER_BUFFER ("vertical-scroll-bar", ¤t_buffer->vertical_scroll_bar_type, + DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BUF_VERTICAL_SCROLL_BAR_TYPE (current_buffer), Qnil, doc: /* *Position of this buffer's vertical scroll bar. The value takes effect whenever you tell a window to display this buffer; @@ -6000,13 +6006,13 @@ of the window; a value of nil means don't show any vertical scroll bars. A value of t (the default) means do whatever the window's frame specifies. */); DEFVAR_PER_BUFFER ("indicate-empty-lines", - ¤t_buffer->indicate_empty_lines, Qnil, + &BUF_INDICATE_EMPTY_LINES (current_buffer), Qnil, doc: /* *Visually indicate empty lines after the buffer end. If non-nil, a bitmap is displayed in the left fringe of a window on window-systems. */); DEFVAR_PER_BUFFER ("indicate-buffer-boundaries", - ¤t_buffer->indicate_buffer_boundaries, Qnil, + &BUF_INDICATE_BUFFER_BOUNDARIES (current_buffer), Qnil, doc: /* *Visually indicate buffer boundaries and scrolling. If non-nil, the first and last line of the buffer are marked in the fringe of a window on window-systems with angle bitmaps, or if the window can be @@ -6031,7 +6037,7 @@ bitmaps in right fringe. To show just the angle bitmaps in the left fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */); DEFVAR_PER_BUFFER ("fringe-indicator-alist", - ¤t_buffer->fringe_indicator_alist, Qnil, + &BUF_FRINGE_INDICATOR_ALIST (current_buffer), Qnil, doc: /* *Mapping from logical to physical fringe indicator bitmaps. The value is an alist where each element (INDICATOR . BITMAPS) specifies the fringe bitmaps used to display a specific logical @@ -6050,7 +6056,7 @@ are used only for the `bottom' and `one-line' indicators when the last symbol which is used in both left and right fringes. */); DEFVAR_PER_BUFFER ("fringe-cursor-alist", - ¤t_buffer->fringe_cursor_alist, Qnil, + &BUF_FRINGE_CURSOR_ALIST (current_buffer), Qnil, doc: /* *Mapping from logical to physical fringe cursor bitmaps. The value is an alist where each element (CURSOR . BITMAP) specifies the fringe bitmaps used to display a specific logical @@ -6065,7 +6071,7 @@ BITMAP is the corresponding fringe bitmap shown for the logical cursor type. */); DEFVAR_PER_BUFFER ("scroll-up-aggressively", - ¤t_buffer->scroll_up_aggressively, Qnil, + &BUF_SCROLL_UP_AGGRESSIVELY (current_buffer), Qnil, doc: /* How far to scroll windows upward. If you move point off the bottom, the window scrolls automatically. This variable controls how far it scrolls. The value nil, the default, @@ -6078,7 +6084,7 @@ window scrolls by a full window height. Meaningful values are between 0.0 and 1.0, inclusive. */); DEFVAR_PER_BUFFER ("scroll-down-aggressively", - ¤t_buffer->scroll_down_aggressively, Qnil, + &BUF_SCROLL_DOWN_AGGRESSIVELY (current_buffer), Qnil, doc: /* How far to scroll windows downward. If you move point off the top, the window scrolls automatically. This variable controls how far it scrolls. The value nil, the default, @@ -6139,7 +6145,7 @@ from happening repeatedly and making Emacs nonfunctional. */); The functions are run using the `run-hooks' function. */); Vfirst_change_hook = Qnil; - DEFVAR_PER_BUFFER ("buffer-undo-list", ¤t_buffer->undo_list, Qnil, + DEFVAR_PER_BUFFER ("buffer-undo-list", &BUF_UNDO_LIST (current_buffer), Qnil, doc: /* List of undo entries in current buffer. Recent changes come first; older changes follow newer. @@ -6180,10 +6186,10 @@ the changes between two undo boundaries as a single step to be undone. If the value of the variable is t, undo information is not recorded. */); - DEFVAR_PER_BUFFER ("mark-active", ¤t_buffer->mark_active, Qnil, + DEFVAR_PER_BUFFER ("mark-active", &BUF_MARK_ACTIVE (current_buffer), Qnil, doc: /* Non-nil means the mark and region are currently active in this buffer. */); - DEFVAR_PER_BUFFER ("cache-long-line-scans", ¤t_buffer->cache_long_line_scans, Qnil, + DEFVAR_PER_BUFFER ("cache-long-line-scans", &BUF_CACHE_LONG_LINE_SCANS (current_buffer), Qnil, doc: /* Non-nil means that Emacs should use caches to handle long lines more quickly. Normally, the line-motion functions work by scanning the buffer for @@ -6211,23 +6217,23 @@ maintained internally by the Emacs primitives. Enabling or disabling the cache should not affect the behavior of any of the motion functions; it should only affect their performance. */); - DEFVAR_PER_BUFFER ("point-before-scroll", ¤t_buffer->point_before_scroll, Qnil, + DEFVAR_PER_BUFFER ("point-before-scroll", &BUF_POINT_BEFORE_SCROLL (current_buffer), Qnil, doc: /* Value of point before the last series of scroll operations, or nil. */); - DEFVAR_PER_BUFFER ("buffer-file-format", ¤t_buffer->file_format, Qnil, + DEFVAR_PER_BUFFER ("buffer-file-format", &BUF_FILE_FORMAT (current_buffer), Qnil, doc: /* List of formats to use when saving this buffer. Formats are defined by `format-alist'. This variable is set when a file is visited. */); DEFVAR_PER_BUFFER ("buffer-auto-save-file-format", - ¤t_buffer->auto_save_file_format, Qnil, + &BUF_AUTO_SAVE_FILE_FORMAT (current_buffer), Qnil, doc: /* *Format in which to write auto-save files. Should be a list of symbols naming formats that are defined in `format-alist'. If it is t, which is the default, auto-save files are written in the same format as a regular save would use. */); DEFVAR_PER_BUFFER ("buffer-invisibility-spec", - ¤t_buffer->invisibility_spec, Qnil, + &BUF_INVISIBILITY_SPEC (current_buffer), Qnil, doc: /* Invisibility spec of this buffer. The default is t, which means that text is invisible if it has a non-nil `invisible' property. @@ -6238,12 +6244,12 @@ then characters with property value PROP are invisible, and they have an ellipsis as well if ELLIPSIS is non-nil. */); DEFVAR_PER_BUFFER ("buffer-display-count", - ¤t_buffer->display_count, Qnil, + &BUF_DISPLAY_COUNT (current_buffer), Qnil, doc: /* A number incremented each time this buffer is displayed in a window. The function `set-window-buffer' increments it. */); DEFVAR_PER_BUFFER ("buffer-display-time", - ¤t_buffer->display_time, Qnil, + &BUF_DISPLAY_TIME (current_buffer), Qnil, doc: /* Time stamp updated each time this buffer is displayed in a window. The function `set-window-buffer' updates this variable to the value obtained by calling `current-time'. @@ -6264,7 +6270,7 @@ and disregard a `read-only' text property if the property value is a member of the list. */); Vinhibit_read_only = Qnil; - DEFVAR_PER_BUFFER ("cursor-type", ¤t_buffer->cursor_type, Qnil, + DEFVAR_PER_BUFFER ("cursor-type", &BUF_CURSOR_TYPE (current_buffer), Qnil, doc: /* Cursor to use when this buffer is in the selected window. Values are interpreted as follows: @@ -6283,7 +6289,7 @@ cursor's appearance is instead controlled by the variable `cursor-in-non-selected-windows'. */); DEFVAR_PER_BUFFER ("line-spacing", - ¤t_buffer->extra_line_spacing, Qnil, + &BUF_EXTRA_LINE_SPACING (current_buffer), Qnil, doc: /* Additional space to put between lines when displaying a buffer. The space is measured in pixels, and put below lines on graphic displays, see `display-graphic-p'. @@ -6291,7 +6297,7 @@ If value is a floating point number, it specifies the spacing relative to the default frame line height. A value of nil means add no extra space. */); DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", - ¤t_buffer->cursor_in_non_selected_windows, Qnil, + &BUF_CURSOR_IN_NON_SELECTED_WINDOWS (current_buffer), Qnil, doc: /* *Cursor type to display in non-selected windows. The value t means to use hollow box cursor. See `cursor-type' for other values. */); diff --git a/src/buffer.h b/src/buffer.h index cd9361a864f..fb37497d945 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -316,7 +316,7 @@ while (0) /* Return character at position POS. */ #define FETCH_CHAR(pos) \ - (!NILP (current_buffer->enable_multibyte_characters) \ + (!NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) \ ? FETCH_MULTIBYTE_CHAR ((pos)) \ : FETCH_BYTE ((pos))) @@ -341,7 +341,7 @@ extern unsigned char *_fetch_multibyte_char_p; multibyte. */ #define FETCH_CHAR_AS_MULTIBYTE(pos) \ - (!NILP (current_buffer->enable_multibyte_characters) \ + (!NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) \ ? FETCH_MULTIBYTE_CHAR ((pos)) \ : UNIBYTE_TO_CHAR (FETCH_BYTE ((pos)))) @@ -573,133 +573,133 @@ struct buffer because local variables have to be right in the struct buffer. So we copy it around in set_buffer_internal. This comes before `name' because it is marked in a special way. */ - Lisp_Object undo_list; + Lisp_Object undo_list_; /* The name of this buffer. */ - Lisp_Object name; + Lisp_Object name_; /* The name of the file visited in this buffer, or nil. */ - Lisp_Object filename; + Lisp_Object filename_; /* Dir for expanding relative file names. */ - Lisp_Object directory; + Lisp_Object directory_; /* True if this buffer has been backed up (if you write to the visited file and it hasn't been backed up, then a backup will be made). */ /* This isn't really used by the C code, so could be deleted. */ - Lisp_Object backed_up; + Lisp_Object backed_up_; /* Length of file when last read or saved. -1 means auto saving turned off because buffer shrank a lot. -2 means don't turn off auto saving if buffer shrinks. (That value is used with buffer-swap-text.) This is not in the struct buffer_text because it's not used in indirect buffers at all. */ - Lisp_Object save_length; + Lisp_Object save_length_; /* File name used for auto-saving this buffer. This is not in the struct buffer_text because it's not used in indirect buffers at all. */ - Lisp_Object auto_save_file_name; + Lisp_Object auto_save_file_name_; /* Non-nil if buffer read-only. */ - Lisp_Object read_only; + Lisp_Object read_only_; /* "The mark". This is a marker which may point into this buffer or may point nowhere. */ - Lisp_Object mark; + Lisp_Object mark_; /* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER) for all per-buffer variables of this buffer. For locally unbound symbols, just the symbol appears as the element. */ - Lisp_Object local_var_alist; + Lisp_Object local_var_alist_; /* Symbol naming major mode (eg, lisp-mode). */ - Lisp_Object major_mode; + Lisp_Object major_mode_; /* Pretty name of major mode (eg, "Lisp"). */ - Lisp_Object mode_name; + Lisp_Object mode_name_; /* Mode line element that controls format of mode line. */ - Lisp_Object mode_line_format; + Lisp_Object mode_line_format_; /* Analogous to mode_line_format for the line displayed at the top of windows. Nil means don't display that line. */ - Lisp_Object header_line_format; + Lisp_Object header_line_format_; /* Keys that are bound local to this buffer. */ - Lisp_Object keymap; + Lisp_Object keymap_; /* This buffer's local abbrev table. */ - Lisp_Object abbrev_table; + Lisp_Object abbrev_table_; /* This buffer's syntax table. */ - Lisp_Object syntax_table; + Lisp_Object syntax_table_; /* This buffer's category table. */ - Lisp_Object category_table; + Lisp_Object category_table_; /* Values of several buffer-local variables. */ /* tab-width is buffer-local so that redisplay can find it in buffers that are not current. */ - Lisp_Object case_fold_search; - Lisp_Object tab_width; - Lisp_Object fill_column; - Lisp_Object left_margin; + Lisp_Object case_fold_search_; + Lisp_Object tab_width_; + Lisp_Object fill_column_; + Lisp_Object left_margin_; /* Function to call when insert space past fill column. */ - Lisp_Object auto_fill_function; + Lisp_Object auto_fill_function_; /* nil: text, t: binary. This value is meaningful only on certain operating systems. */ /* Actually, we don't need this flag any more because end-of-line is handled correctly according to the buffer-file-coding-system of the buffer. Just keeping it for backward compatibility. */ - Lisp_Object buffer_file_type; + Lisp_Object buffer_file_type_; /* Case table for case-conversion in this buffer. This char-table maps each char into its lower-case version. */ - Lisp_Object downcase_table; + Lisp_Object downcase_table_; /* Char-table mapping each char to its upper-case version. */ - Lisp_Object upcase_table; + Lisp_Object upcase_table_; /* Char-table for conversion for case-folding search. */ - Lisp_Object case_canon_table; + Lisp_Object case_canon_table_; /* Char-table of equivalences for case-folding search. */ - Lisp_Object case_eqv_table; + Lisp_Object case_eqv_table_; /* Non-nil means do not display continuation lines. */ - Lisp_Object truncate_lines; + Lisp_Object truncate_lines_; /* Non-nil means to use word wrapping when displaying continuation lines. */ - Lisp_Object word_wrap; + Lisp_Object word_wrap_; /* Non-nil means display ctl chars with uparrow. */ - Lisp_Object ctl_arrow; + Lisp_Object ctl_arrow_; /* Non-nil means display text from right to left. */ - Lisp_Object direction_reversed; + Lisp_Object direction_reversed_; /* Non-nil means do selective display; see doc string in syms_of_buffer (buffer.c) for details. */ - Lisp_Object selective_display; + Lisp_Object selective_display_; #ifndef old /* Non-nil means show ... at end of line followed by invisible lines. */ - Lisp_Object selective_display_ellipses; + Lisp_Object selective_display_ellipses_; #endif /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */ - Lisp_Object minor_modes; + Lisp_Object minor_modes_; /* t if "self-insertion" should overwrite; `binary' if it should also overwrite newlines and tabs - for editing executables and the like. */ - Lisp_Object overwrite_mode; + Lisp_Object overwrite_mode_; /* non-nil means abbrev mode is on. Expand abbrevs automatically. */ - Lisp_Object abbrev_mode; + Lisp_Object abbrev_mode_; /* Display table to use for text in this buffer. */ - Lisp_Object display_table; + Lisp_Object display_table_; /* t means the mark and region are currently active. */ - Lisp_Object mark_active; + Lisp_Object mark_active_; /* Non-nil means the buffer contents are regarded as multi-byte form of characters, not a binary code. */ - Lisp_Object enable_multibyte_characters; + Lisp_Object enable_multibyte_characters_; /* Coding system to be used for encoding the buffer contents on saving. */ - Lisp_Object buffer_file_coding_system; + Lisp_Object buffer_file_coding_system_; /* List of symbols naming the file format used for visited file. */ - Lisp_Object file_format; + Lisp_Object file_format_; /* List of symbols naming the file format used for auto-save file. */ - Lisp_Object auto_save_file_format; + Lisp_Object auto_save_file_format_; /* True if the newline position cache and width run cache are enabled. See search.c and indent.c. */ - Lisp_Object cache_long_line_scans; + Lisp_Object cache_long_line_scans_; /* If the width run cache is enabled, this table contains the character widths width_run_cache (see above) assumes. When we @@ -707,99 +707,99 @@ struct buffer current display table to see whether the display table has affected the widths of any characters. If it has, we invalidate the width run cache, and re-initialize width_table. */ - Lisp_Object width_table; + Lisp_Object width_table_; /* In an indirect buffer, or a buffer that is the base of an indirect buffer, this holds a marker that records PT for this buffer when the buffer is not current. */ - Lisp_Object pt_marker; + Lisp_Object pt_marker_; /* In an indirect buffer, or a buffer that is the base of an indirect buffer, this holds a marker that records BEGV for this buffer when the buffer is not current. */ - Lisp_Object begv_marker; + Lisp_Object begv_marker_; /* In an indirect buffer, or a buffer that is the base of an indirect buffer, this holds a marker that records ZV for this buffer when the buffer is not current. */ - Lisp_Object zv_marker; + Lisp_Object zv_marker_; /* This holds the point value before the last scroll operation. Explicitly setting point sets this to nil. */ - Lisp_Object point_before_scroll; + Lisp_Object point_before_scroll_; /* Truename of the visited file, or nil. */ - Lisp_Object file_truename; + Lisp_Object file_truename_; /* Invisibility spec of this buffer. t => any non-nil `invisible' property means invisible. A list => `invisible' property means invisible if it is memq in that list. */ - Lisp_Object invisibility_spec; + Lisp_Object invisibility_spec_; /* This is the last window that was selected with this buffer in it, or nil if that window no longer displays this buffer. */ - Lisp_Object last_selected_window; + Lisp_Object last_selected_window_; /* Incremented each time the buffer is displayed in a window. */ - Lisp_Object display_count; + Lisp_Object display_count_; /* Widths of left and right marginal areas for windows displaying this buffer. */ - Lisp_Object left_margin_cols, right_margin_cols; + Lisp_Object left_margin_cols_, right_margin_cols_; /* Widths of left and right fringe areas for windows displaying this buffer. */ - Lisp_Object left_fringe_width, right_fringe_width; + Lisp_Object left_fringe_width_, right_fringe_width_; /* Non-nil means fringes are drawn outside display margins; othersize draw them between margin areas and text. */ - Lisp_Object fringes_outside_margins; + Lisp_Object fringes_outside_margins_; /* Width and type of scroll bar areas for windows displaying this buffer. */ - Lisp_Object scroll_bar_width, vertical_scroll_bar_type; + Lisp_Object scroll_bar_width_, vertical_scroll_bar_type_; /* Non-nil means indicate lines not displaying text (in a style like vi). */ - Lisp_Object indicate_empty_lines; + Lisp_Object indicate_empty_lines_; /* Non-nil means indicate buffer boundaries and scrolling. */ - Lisp_Object indicate_buffer_boundaries; + Lisp_Object indicate_buffer_boundaries_; /* Logical to physical fringe bitmap mappings. */ - Lisp_Object fringe_indicator_alist; + Lisp_Object fringe_indicator_alist_; /* Logical to physical cursor bitmap mappings. */ - Lisp_Object fringe_cursor_alist; + Lisp_Object fringe_cursor_alist_; /* Time stamp updated each time this buffer is displayed in a window. */ - Lisp_Object display_time; + Lisp_Object display_time_; /* If scrolling the display because point is below the bottom of a window showing this buffer, try to choose a window start so that point ends up this number of lines from the top of the window. Nil means that scrolling method isn't used. */ - Lisp_Object scroll_up_aggressively; + Lisp_Object scroll_up_aggressively_; /* If scrolling the display because point is above the top of a window showing this buffer, try to choose a window start so that point ends up this number of lines from the bottom of the window. Nil means that scrolling method isn't used. */ - Lisp_Object scroll_down_aggressively; + Lisp_Object scroll_down_aggressively_; /* Desired cursor type in this buffer. See the doc string of per-buffer variable `cursor-type'. */ - Lisp_Object cursor_type; + Lisp_Object cursor_type_; /* An integer > 0 means put that number of pixels below text lines in the display of this buffer. */ - Lisp_Object extra_line_spacing; + Lisp_Object extra_line_spacing_; /* *Cursor type to display in non-selected windows. t means to use hollow box cursor. See `cursor-type' for other values. */ - Lisp_Object cursor_in_non_selected_windows; + Lisp_Object cursor_in_non_selected_windows_; /* If non-nil, the thread holding a lock on this buffer. */ Lisp_Object owner; @@ -808,6 +808,78 @@ struct buffer Lisp_Object prev_owner; }; +#define BUF_CURSOR_IN_NON_SELECTED_WINDOWS(BUF) *find_variable_location (&((BUF)->cursor_in_non_selected_windows_)) +#define BUF_EXTRA_LINE_SPACING(BUF) *find_variable_location (&((BUF)->extra_line_spacing_)) +#define BUF_CURSOR_TYPE(BUF) *find_variable_location (&((BUF)->cursor_type_)) +#define BUF_SCROLL_DOWN_AGGRESSIVELY(BUF) *find_variable_location (&((BUF)->scroll_down_aggressively_)) +#define BUF_SCROLL_UP_AGGRESSIVELY(BUF) *find_variable_location (&((BUF)->scroll_up_aggressively_)) +#define BUF_DISPLAY_TIME(BUF) *find_variable_location (&((BUF)->display_time_)) +#define BUF_FRINGE_CURSOR_ALIST(BUF) *find_variable_location (&((BUF)->fringe_cursor_alist_)) +#define BUF_FRINGE_INDICATOR_ALIST(BUF) *find_variable_location (&((BUF)->fringe_indicator_alist_)) +#define BUF_INDICATE_BUFFER_BOUNDARIES(BUF) *find_variable_location (&((BUF)->indicate_buffer_boundaries_)) +#define BUF_INDICATE_EMPTY_LINES(BUF) *find_variable_location (&((BUF)->indicate_empty_lines_)) +#define BUF_VERTICAL_SCROLL_BAR_TYPE(BUF) *find_variable_location (&((BUF)->vertical_scroll_bar_type_)) +#define BUF_SCROLL_BAR_WIDTH(BUF) *find_variable_location (&((BUF)->scroll_bar_width_)) +#define BUF_FRINGES_OUTSIDE_MARGINS(BUF) *find_variable_location (&((BUF)->fringes_outside_margins_)) +#define BUF_RIGHT_FRINGE_WIDTH(BUF) *find_variable_location (&((BUF)->right_fringe_width_)) +#define BUF_LEFT_FRINGE_WIDTH(BUF) *find_variable_location (&((BUF)->left_fringe_width_)) +#define BUF_RIGHT_MARGIN_COLS(BUF) *find_variable_location (&((BUF)->right_margin_cols_)) +#define BUF_LEFT_MARGIN_COLS(BUF) *find_variable_location (&((BUF)->left_margin_cols_)) +#define BUF_DISPLAY_COUNT(BUF) *find_variable_location (&((BUF)->display_count_)) +#define BUF_LAST_SELECTED_WINDOW(BUF) *find_variable_location (&((BUF)->last_selected_window_)) +#define BUF_INVISIBILITY_SPEC(BUF) *find_variable_location (&((BUF)->invisibility_spec_)) +#define BUF_FILE_TRUENAME(BUF) *find_variable_location (&((BUF)->file_truename_)) +#define BUF_POINT_BEFORE_SCROLL(BUF) *find_variable_location (&((BUF)->point_before_scroll_)) +#define BUF_ZV_MARKER(BUF) *find_variable_location (&((BUF)->zv_marker_)) +#define BUF_BEGV_MARKER(BUF) *find_variable_location (&((BUF)->begv_marker_)) +#define BUF_PT_MARKER(BUF) *find_variable_location (&((BUF)->pt_marker_)) +#define BUF_WIDTH_TABLE(BUF) *find_variable_location (&((BUF)->width_table_)) +#define BUF_CACHE_LONG_LINE_SCANS(BUF) *find_variable_location (&((BUF)->cache_long_line_scans_)) +#define BUF_AUTO_SAVE_FILE_FORMAT(BUF) *find_variable_location (&((BUF)->auto_save_file_format_)) +#define BUF_FILE_FORMAT(BUF) *find_variable_location (&((BUF)->file_format_)) +#define BUF_BUFFER_FILE_CODING_SYSTEM(BUF) *find_variable_location (&((BUF)->buffer_file_coding_system_)) +#define BUF_ENABLE_MULTIBYTE_CHARACTERS(BUF) *find_variable_location (&((BUF)->enable_multibyte_characters_)) +#define BUF_MARK_ACTIVE(BUF) *find_variable_location (&((BUF)->mark_active_)) +#define BUF_DISPLAY_TABLE(BUF) *find_variable_location (&((BUF)->display_table_)) +#define BUF_ABBREV_MODE(BUF) *find_variable_location (&((BUF)->abbrev_mode_)) +#define BUF_OVERWRITE_MODE(BUF) *find_variable_location (&((BUF)->overwrite_mode_)) +#define BUF_MINOR_MODES(BUF) *find_variable_location (&((BUF)->minor_modes_)) +#define BUF_SELECTIVE_DISPLAY_ELLIPSES(BUF) *find_variable_location (&((BUF)->selective_display_ellipses_)) +#define BUF_SELECTIVE_DISPLAY(BUF) *find_variable_location (&((BUF)->selective_display_)) +#define BUF_DIRECTION_REVERSED(BUF) *find_variable_location (&((BUF)->direction_reversed_)) +#define BUF_CTL_ARROW(BUF) *find_variable_location (&((BUF)->ctl_arrow_)) +#define BUF_WORD_WRAP(BUF) *find_variable_location (&((BUF)->word_wrap_)) +#define BUF_TRUNCATE_LINES(BUF) *find_variable_location (&((BUF)->truncate_lines_)) +#define BUF_CASE_EQV_TABLE(BUF) *find_variable_location (&((BUF)->case_eqv_table_)) +#define BUF_CASE_CANON_TABLE(BUF) *find_variable_location (&((BUF)->case_canon_table_)) +#define BUF_UPCASE_TABLE(BUF) *find_variable_location (&((BUF)->upcase_table_)) +#define BUF_DOWNCASE_TABLE(BUF) *find_variable_location (&((BUF)->downcase_table_)) +#define BUF_BUFFER_FILE_TYPE(BUF) *find_variable_location (&((BUF)->buffer_file_type_)) +#define BUF_AUTO_FILL_FUNCTION(BUF) *find_variable_location (&((BUF)->auto_fill_function_)) +#define BUF_LEFT_MARGIN(BUF) *find_variable_location (&((BUF)->left_margin_)) +#define BUF_FILL_COLUMN(BUF) *find_variable_location (&((BUF)->fill_column_)) +#define BUF_TAB_WIDTH(BUF) *find_variable_location (&((BUF)->tab_width_)) +#define BUF_CASE_FOLD_SEARCH(BUF) *find_variable_location (&((BUF)->case_fold_search_)) +#define BUF_CATEGORY_TABLE(BUF) *find_variable_location (&((BUF)->category_table_)) +#define BUF_SYNTAX_TABLE(BUF) *find_variable_location (&((BUF)->syntax_table_)) +#define BUF_ABBREV_TABLE(BUF) *find_variable_location (&((BUF)->abbrev_table_)) +#define BUF_KEYMAP(BUF) *find_variable_location (&((BUF)->keymap_)) +#define BUF_HEADER_LINE_FORMAT(BUF) *find_variable_location (&((BUF)->header_line_format_)) +#define BUF_MODE_LINE_FORMAT(BUF) *find_variable_location (&((BUF)->mode_line_format_)) +#define BUF_MODE_NAME(BUF) *find_variable_location (&((BUF)->mode_name_)) +#define BUF_MAJOR_MODE(BUF) *find_variable_location (&((BUF)->major_mode_)) +#define BUF_LOCAL_VAR_ALIST(BUF) *find_variable_location (&((BUF)->local_var_alist_)) +#define BUF_MARK(BUF) *find_variable_location (&((BUF)->mark_)) +#define BUF_READ_ONLY(BUF) *find_variable_location (&((BUF)->read_only_)) +#define BUF_AUTO_SAVE_FILE_NAME(BUF) *find_variable_location (&((BUF)->auto_save_file_name_)) +#define BUF_SAVE_LENGTH(BUF) *find_variable_location (&((BUF)->save_length_)) +#define BUF_BACKED_UP(BUF) *find_variable_location (&((BUF)->backed_up_)) +#define BUF_DIRECTORY(BUF) *find_variable_location (&((BUF)->directory_)) +#define BUF_FILENAME(BUF) *find_variable_location (&((BUF)->filename_)) +#define BUF_NAME(BUF) *find_variable_location (&((BUF)->name_)) +#define BUF_UNDO_LIST(BUF) *find_variable_location (&((BUF)->undo_list_)) + + /* This structure holds the default values of the buffer-local variables @@ -937,7 +1009,7 @@ extern int last_per_buffer_idx; from the start of a buffer structure. */ #define PER_BUFFER_VAR_OFFSET(VAR) \ - ((char *) &buffer_local_flags.VAR - (char *) &buffer_local_flags) + ((char *) &buffer_local_flags.VAR ## _ - (char *) &buffer_local_flags) /* Return the index of buffer-local variable VAR. Each per-buffer variable has an index > 0 associated with it, except when it always diff --git a/src/bytecode.c b/src/bytecode.c index 07cf98c5daf..4f0d326dd9d 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -1391,7 +1391,7 @@ If the third argument is incorrect, Emacs may crash. */) CHECK_CHARACTER (TOP); AFTER_POTENTIAL_GC (); c = XFASTINT (TOP); - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) MAKE_CHAR_MULTIBYTE (c); XSETFASTINT (TOP, syntax_code_spec[(int) SYNTAX (c)]); } diff --git a/src/callint.c b/src/callint.c index 6faeff09097..3208d80ad9e 100644 --- a/src/callint.c +++ b/src/callint.c @@ -173,12 +173,12 @@ check_mark (for_region) int for_region; { Lisp_Object tem; - tem = Fmarker_buffer (current_buffer->mark); + tem = Fmarker_buffer (BUF_MARK (current_buffer)); if (NILP (tem) || (XBUFFER (tem) != current_buffer)) error (for_region ? "The mark is not set now, so there is no region" : "The mark is not set now"); if (!NILP (Vtransient_mark_mode) && NILP (Vmark_even_if_inactive) - && NILP (current_buffer->mark_active)) + && NILP (BUF_MARK_ACTIVE (current_buffer))) xsignal0 (Qmark_inactive); } @@ -412,7 +412,7 @@ invoke it. If KEYS is omitted or nil, the return value of else if (*string == '*') { string++; - if (!NILP (current_buffer->read_only)) + if (!NILP (BUF_READ_ONLY (current_buffer))) { if (!NILP (record_flag)) { @@ -570,7 +570,7 @@ invoke it. If KEYS is omitted or nil, the return value of case 'D': /* Directory name. */ args[i] = Fread_file_name (callint_message, Qnil, - current_buffer->directory, Qlambda, Qnil, + BUF_DIRECTORY (current_buffer), Qlambda, Qnil, Qfile_directory_p); break; @@ -688,7 +688,7 @@ invoke it. If KEYS is omitted or nil, the return value of case 'm': /* Value of mark. Does not do I/O. */ check_mark (0); /* visargs[i] = Qnil; */ - args[i] = current_buffer->mark; + args[i] = BUF_MARK (current_buffer); varies[i] = 2; break; @@ -744,11 +744,11 @@ invoke it. If KEYS is omitted or nil, the return value of check_mark (1); set_marker_both (point_marker, Qnil, PT, PT_BYTE); /* visargs[i+1] = Qnil; */ - foo = marker_position (current_buffer->mark); + foo = marker_position (BUF_MARK (current_buffer)); /* visargs[i] = Qnil; */ - args[i] = PT < foo ? point_marker : current_buffer->mark; + args[i] = PT < foo ? point_marker : BUF_MARK (current_buffer); varies[i] = 3; - args[++i] = PT > foo ? point_marker : current_buffer->mark; + args[++i] = PT > foo ? point_marker : BUF_MARK (current_buffer); varies[i] = 4; break; diff --git a/src/callproc.c b/src/callproc.c index 8d4ee287427..a2cafee658e 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -315,7 +315,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) if (nargs >= 2 && ! NILP (args[1])) { - infile = Fexpand_file_name (args[1], current_buffer->directory); + infile = Fexpand_file_name (args[1], BUF_DIRECTORY (current_buffer)); CHECK_STRING (infile); } else @@ -372,7 +372,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) { struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; - current_dir = current_buffer->directory; + current_dir = BUF_DIRECTORY (current_buffer); GCPRO4 (infile, buffer, current_dir, error_file); @@ -386,7 +386,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) if (NILP (Ffile_accessible_directory_p (current_dir))) report_file_error ("Setting current directory", - Fcons (current_buffer->directory, Qnil)); + Fcons (BUF_DIRECTORY (current_buffer), Qnil)); if (STRING_MULTIBYTE (infile)) infile = ENCODE_FILE (infile); @@ -687,7 +687,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) /* In unibyte mode, character code conversion should not take place but EOL conversion should. So, setup raw-text or one of the subsidiary according to the information just setup. */ - if (NILP (current_buffer->enable_multibyte_characters) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) && !NILP (val)) val = raw_text_coding_system (val); setup_coding_system (val, &process_coding); @@ -737,7 +737,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) if (!NILP (buffer)) { - if (NILP (current_buffer->enable_multibyte_characters) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) && ! CODING_MAY_REQUIRE_DECODING (&process_coding)) insert_1_both (buf, nread, nread, 0, 1, 0); else @@ -953,7 +953,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r /* Decide coding-system of the contents of the temporary file. */ if (!NILP (Vcoding_system_for_write)) val = Vcoding_system_for_write; - else if (NILP (current_buffer->enable_multibyte_characters)) + else if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) val = Qnil; else { diff --git a/src/casefiddle.c b/src/casefiddle.c index 30bb457b17d..c9272385d36 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c @@ -41,15 +41,15 @@ casify_object (flag, obj) register int inword = flag == CASE_DOWN; /* If the case table is flagged as modified, rescan it. */ - if (NILP (XCHAR_TABLE (current_buffer->downcase_table)->extras[1])) - Fset_case_table (current_buffer->downcase_table); + if (NILP (XCHAR_TABLE (BUF_DOWNCASE_TABLE (current_buffer))->extras[1])) + Fset_case_table (BUF_DOWNCASE_TABLE (current_buffer)); if (INTEGERP (obj)) { int flagbits = (CHAR_ALT | CHAR_SUPER | CHAR_HYPER | CHAR_SHIFT | CHAR_CTL | CHAR_META); int flags = XINT (obj) & flagbits; - int multibyte = ! NILP (current_buffer->enable_multibyte_characters); + int multibyte = ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); /* If the character has higher bits set above the flags, return it unchanged. @@ -206,7 +206,7 @@ casify_region (flag, b, e) { register int c; register int inword = flag == CASE_DOWN; - register int multibyte = !NILP (current_buffer->enable_multibyte_characters); + register int multibyte = !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); EMACS_INT start, end; EMACS_INT start_byte, end_byte; EMACS_INT first = -1, last; /* Position of first and last changes. */ @@ -218,8 +218,8 @@ casify_region (flag, b, e) return; /* If the case table is flagged as modified, rescan it. */ - if (NILP (XCHAR_TABLE (current_buffer->downcase_table)->extras[1])) - Fset_case_table (current_buffer->downcase_table); + if (NILP (XCHAR_TABLE (BUF_DOWNCASE_TABLE (current_buffer))->extras[1])) + Fset_case_table (BUF_DOWNCASE_TABLE (current_buffer)); validate_region (&b, &e); start = XFASTINT (b); diff --git a/src/casetab.c b/src/casetab.c index e0a9ec49157..0f650a82667 100644 --- a/src/casetab.c +++ b/src/casetab.c @@ -74,7 +74,7 @@ DEFUN ("current-case-table", Fcurrent_case_table, Scurrent_case_table, 0, 0, 0, doc: /* Return the case table of the current buffer. */) () { - return current_buffer->downcase_table; + return BUF_DOWNCASE_TABLE (current_buffer); } DEFUN ("standard-case-table", Fstandard_case_table, Sstandard_case_table, 0, 0, 0, @@ -167,10 +167,10 @@ set_case_table (table, standard) } else { - current_buffer->downcase_table = table; - current_buffer->upcase_table = up; - current_buffer->case_canon_table = canon; - current_buffer->case_eqv_table = eqv; + BUF_DOWNCASE_TABLE (current_buffer) = table; + BUF_UPCASE_TABLE (current_buffer) = up; + BUF_CASE_CANON_TABLE (current_buffer) = canon; + BUF_CASE_EQV_TABLE (current_buffer) = eqv; } return table; diff --git a/src/category.c b/src/category.c index 61b623a4395..84db626590f 100644 --- a/src/category.c +++ b/src/category.c @@ -200,7 +200,7 @@ check_category_table (table) Lisp_Object table; { if (NILP (table)) - return current_buffer->category_table; + return BUF_CATEGORY_TABLE (current_buffer); CHECK_TYPE (!NILP (Fcategory_table_p (table)), Qcategory_table_p, table); return table; } @@ -210,7 +210,7 @@ DEFUN ("category-table", Fcategory_table, Scategory_table, 0, 0, 0, This is the one specified by the current buffer. */) () { - return current_buffer->category_table; + return BUF_CATEGORY_TABLE (current_buffer); } DEFUN ("standard-category-table", Fstandard_category_table, @@ -295,7 +295,7 @@ Return TABLE. */) { int idx; table = check_category_table (table); - current_buffer->category_table = table; + BUF_CATEGORY_TABLE (current_buffer) = 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); @@ -307,7 +307,7 @@ Lisp_Object char_category_set (c) int c; { - return CHAR_TABLE_REF (current_buffer->category_table, c); + return CHAR_TABLE_REF (BUF_CATEGORY_TABLE (current_buffer), c); } DEFUN ("char-category-set", Fchar_category_set, Schar_category_set, 1, 1, 0, diff --git a/src/category.h b/src/category.h index b0fca6c7155..d95c6e7dc3e 100644 --- a/src/category.h +++ b/src/category.h @@ -91,7 +91,7 @@ extern Lisp_Object _temp_category_set; /* The standard category table is stored where it will automatically be used in all new buffers. */ -#define Vstandard_category_table buffer_defaults.category_table +#define Vstandard_category_table BUF_CATEGORY_TABLE (&buffer_defaults) /* Return the category set of character C in the current category table. */ #define CATEGORY_SET(c) char_category_set (c) diff --git a/src/character.c b/src/character.c index 32b9a3c3104..e077edf1a78 100644 --- a/src/character.c +++ b/src/character.c @@ -580,7 +580,7 @@ chars_in_text (ptr, nbytes) { /* current_buffer is null at early stages of Emacs initialization. */ if (current_buffer == 0 - || NILP (current_buffer->enable_multibyte_characters)) + || NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) return nbytes; return multibyte_chars_in_text (ptr, nbytes); @@ -1048,7 +1048,7 @@ character is not ASCII nor 8-bit character, an error is signalled. */) pos = XFASTINT (position); p = CHAR_POS_ADDR (pos); } - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) return make_number (*p); } else diff --git a/src/character.h b/src/character.h index af498a2b195..6688a2cf7fc 100644 --- a/src/character.h +++ b/src/character.h @@ -438,7 +438,7 @@ along with GNU Emacs. If not, see . */ do \ { \ CHARIDX++; \ - if (!NILP (current_buffer->enable_multibyte_characters)) \ + if (!NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) \ { \ unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ int len; \ @@ -505,7 +505,7 @@ along with GNU Emacs. If not, see . */ do \ { \ (charpos)++; \ - if (NILP (current_buffer->enable_multibyte_characters)) \ + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) \ (bytepos)++; \ else \ INC_POS ((bytepos)); \ @@ -519,7 +519,7 @@ along with GNU Emacs. If not, see . */ do \ { \ (charpos)--; \ - if (NILP (current_buffer->enable_multibyte_characters)) \ + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) \ (bytepos)--; \ else \ DEC_POS ((bytepos)); \ @@ -582,11 +582,11 @@ along with GNU Emacs. If not, see . */ #define ASCII_CHAR_WIDTH(c) \ (c < 0x20 \ ? (c == '\t' \ - ? XFASTINT (current_buffer->tab_width) \ - : (c == '\n' ? 0 : (NILP (current_buffer->ctl_arrow) ? 4 : 2))) \ + ? XFASTINT (BUF_TAB_WIDTH (current_buffer)) \ + : (c == '\n' ? 0 : (NILP (BUF_CTL_ARROW (current_buffer)) ? 4 : 2))) \ : (c < 0x7f \ ? 1 \ - : ((NILP (current_buffer->ctl_arrow) ? 4 : 2)))) + : ((NILP (BUF_CTL_ARROW (current_buffer)) ? 4 : 2)))) /* Return the width of character C. The width is measured by how many columns C will occupy on the screen when displayed in the current diff --git a/src/charset.c b/src/charset.c index 0289cf2fa27..52a068a353f 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1619,7 +1619,7 @@ only `ascii', `eight-bit-control', and `eight-bit-graphic'. */) EMACS_INT from, from_byte, to, stop, stop_byte; int i; Lisp_Object val; - int multibyte = ! NILP (current_buffer->enable_multibyte_characters); + int multibyte = ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); validate_region (&beg, &end); from = XFASTINT (beg); diff --git a/src/cmds.c b/src/cmds.c index 7131d7deaf9..010010d8ded 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -299,7 +299,7 @@ N was explicitly specified. */) /* In overwrite mode, back over columns while clearing them out, unless at end of line. */ if (XINT (n) > 0 - && ! NILP (current_buffer->overwrite_mode) + && ! NILP (BUF_OVERWRITE_MODE (current_buffer)) && ! deleted_special && ! (PT == ZV || FETCH_BYTE (PT_BYTE) == '\n')) { @@ -349,10 +349,10 @@ After insertion, the value of `auto-fill-function' is called if the } if (remove_boundary - && CONSP (current_buffer->undo_list) - && NILP (XCAR (current_buffer->undo_list))) + && CONSP (BUF_UNDO_LIST (current_buffer)) + && NILP (XCAR (BUF_UNDO_LIST (current_buffer)))) /* Remove the undo_boundary that was just pushed. */ - current_buffer->undo_list = XCDR (current_buffer->undo_list); + BUF_UNDO_LIST (current_buffer) = XCDR (BUF_UNDO_LIST (current_buffer)); /* Barf if the key that invoked this was not a character. */ if (!CHARACTERP (last_command_event)) @@ -360,7 +360,7 @@ After insertion, the value of `auto-fill-function' is called if the { int character = translate_char (Vtranslation_table_for_input, XINT (last_command_event)); - if (XINT (n) >= 2 && NILP (current_buffer->overwrite_mode)) + if (XINT (n) >= 2 && NILP (BUF_OVERWRITE_MODE (current_buffer))) { XSETFASTINT (n, XFASTINT (n) - 2); /* The first one might want to expand an abbrev. */ @@ -413,12 +413,12 @@ internal_self_insert (c, noautofill) int chars_to_delete = 0; int spaces_to_insert = 0; - overwrite = current_buffer->overwrite_mode; + overwrite = BUF_OVERWRITE_MODE (current_buffer); if (!NILP (Vbefore_change_functions) || !NILP (Vafter_change_functions)) hairy = 1; /* At first, get multi-byte form of C in STR. */ - if (!NILP (current_buffer->enable_multibyte_characters)) + if (!NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) { len = CHAR_STRING (c, str); if (len == 1) @@ -461,11 +461,11 @@ internal_self_insert (c, noautofill) || (c != '\n' && c2 != '\n' && ! (c2 == '\t' - && XINT (current_buffer->tab_width) > 0 - && XFASTINT (current_buffer->tab_width) < 20 + && XINT (BUF_TAB_WIDTH (current_buffer)) > 0 + && XFASTINT (BUF_TAB_WIDTH (current_buffer)) < 20 && (target_clm = ((int) current_column () /* iftc */ + XINT (Fchar_width (make_number (c)))), - target_clm % XFASTINT (current_buffer->tab_width))))) + target_clm % XFASTINT (BUF_TAB_WIDTH (current_buffer)))))) { int pos = PT; int pos_byte = PT_BYTE; @@ -497,13 +497,15 @@ internal_self_insert (c, noautofill) hairy = 2; } + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) + MAKE_CHAR_MULTIBYTE (c); synt = SYNTAX (c); - if (!NILP (current_buffer->abbrev_mode) + if (!NILP (BUF_ABBREV_MODE (current_buffer)) && synt != Sword - && NILP (current_buffer->read_only) + && NILP (BUF_READ_ONLY (current_buffer)) && PT > BEGV - && (!NILP (current_buffer->enable_multibyte_characters) + && (!NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) ? SYNTAX (XFASTINT (Fprevious_char ())) == Sword : (SYNTAX (UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ()))) == Sword))) @@ -549,7 +551,7 @@ internal_self_insert (c, noautofill) ? !NILP (CHAR_TABLE_REF (Vauto_fill_chars, c)) : (c == ' ' || c == '\n')) && !noautofill - && !NILP (current_buffer->auto_fill_function)) + && !NILP (BUF_AUTO_FILL_FUNCTION (current_buffer))) { Lisp_Object tem; @@ -558,7 +560,7 @@ internal_self_insert (c, noautofill) that. Must have the newline in place already so filling and justification, if any, know where the end is going to be. */ SET_PT_BOTH (PT - 1, PT_BYTE - 1); - tem = call0 (current_buffer->auto_fill_function); + tem = call0 (BUF_AUTO_FILL_FUNCTION (current_buffer)); /* Test PT < ZV in case the auto-fill-function is strange. */ if (c == '\n' && PT < ZV) SET_PT_BOTH (PT + 1, PT_BYTE + 1); diff --git a/src/coding.c b/src/coding.c index c507e5b1985..6756095fba3 100644 --- a/src/coding.c +++ b/src/coding.c @@ -7146,8 +7146,8 @@ decode_coding (coding) set_buffer_internal (XBUFFER (coding->dst_object)); if (GPT != PT) move_gap_both (PT, PT_BYTE); - undo_list = current_buffer->undo_list; - current_buffer->undo_list = Qt; + undo_list = BUF_UNDO_LIST (current_buffer); + BUF_UNDO_LIST (current_buffer) = Qt; } coding->consumed = coding->consumed_char = 0; @@ -7244,7 +7244,7 @@ decode_coding (coding) decode_eol (coding); if (BUFFERP (coding->dst_object)) { - current_buffer->undo_list = undo_list; + BUF_UNDO_LIST (current_buffer) = undo_list; record_insert (coding->dst_pos, coding->produced_char); } return coding->result; @@ -7548,7 +7548,7 @@ encode_coding (coding) { set_buffer_internal (XBUFFER (coding->dst_object)); coding->dst_multibyte - = ! NILP (current_buffer->enable_multibyte_characters); + = ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); } coding->consumed = coding->consumed_char = 0; @@ -7620,8 +7620,8 @@ make_conversion_work_buffer (multibyte) doesn't compile new regexps. */ Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt); Ferase_buffer (); - current_buffer->undo_list = Qt; - current_buffer->enable_multibyte_characters = multibyte ? Qt : Qnil; + BUF_UNDO_LIST (current_buffer) = Qt; + BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer) = multibyte ? Qt : Qnil; set_buffer_internal (current); return workbuf; } @@ -7681,7 +7681,7 @@ decode_coding_gap (coding, chars, bytes) coding->dst_object = coding->src_object; coding->dst_pos = PT; coding->dst_pos_byte = PT_BYTE; - coding->dst_multibyte = ! NILP (current_buffer->enable_multibyte_characters); + coding->dst_multibyte = ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); if (CODING_REQUIRE_DETECTION (coding)) detect_coding (coding); @@ -7849,7 +7849,7 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte, coding->dst_pos = BUF_PT (XBUFFER (dst_object)); coding->dst_pos_byte = BUF_PT_BYTE (XBUFFER (dst_object)); coding->dst_multibyte - = ! NILP (XBUFFER (dst_object)->enable_multibyte_characters); + = ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (XBUFFER (dst_object))); } else { @@ -7919,7 +7919,7 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte, TEMP_SET_PT_BOTH (saved_pt, saved_pt_byte); else if (saved_pt < from + chars) TEMP_SET_PT_BOTH (from, from_byte); - else if (! NILP (current_buffer->enable_multibyte_characters)) + else if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) TEMP_SET_PT_BOTH (saved_pt + (coding->produced_char - chars), saved_pt_byte + (coding->produced - bytes)); else @@ -7943,7 +7943,7 @@ decode_coding_object (coding, src_object, from, from_byte, to, to_byte, { tail->bytepos = from_byte + coding->produced; tail->charpos - = (NILP (current_buffer->enable_multibyte_characters) + = (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) ? tail->bytepos : from + coding->produced_char); } } @@ -8082,7 +8082,7 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte, set_buffer_temp (current); } coding->dst_multibyte - = ! NILP (XBUFFER (dst_object)->enable_multibyte_characters); + = ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (XBUFFER (dst_object))); } else if (EQ (dst_object, Qt)) { @@ -8125,7 +8125,7 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte, TEMP_SET_PT_BOTH (saved_pt, saved_pt_byte); else if (saved_pt < from + chars) TEMP_SET_PT_BOTH (from, from_byte); - else if (! NILP (current_buffer->enable_multibyte_characters)) + else if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) TEMP_SET_PT_BOTH (saved_pt + (coding->produced_char - chars), saved_pt_byte + (coding->produced - bytes)); else @@ -8149,7 +8149,7 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte, { tail->bytepos = from_byte + coding->produced; tail->charpos - = (NILP (current_buffer->enable_multibyte_characters) + = (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) ? tail->bytepos : from + coding->produced_char); } } @@ -8611,8 +8611,8 @@ highest priority. */) return detect_coding_system (BYTE_POS_ADDR (from_byte), to - from, to_byte - from_byte, !NILP (highest), - !NILP (current_buffer - ->enable_multibyte_characters), + !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer + )), Qnil); } @@ -8698,7 +8698,7 @@ DEFUN ("find-coding-systems-region-internal", CHECK_NUMBER_COERCE_MARKER (end); if (XINT (start) < BEG || XINT (end) > Z || XINT (start) > XINT (end)) args_out_of_range (start, end); - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) return Qt; start_byte = CHAR_TO_BYTE (XINT (start)); end_byte = CHAR_TO_BYTE (XINT (end)); @@ -8833,7 +8833,7 @@ to the string. */) validate_region (&start, &end); from = XINT (start); to = XINT (end); - if (NILP (current_buffer->enable_multibyte_characters) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) || (ascii_compatible && (to - from) == (CHAR_TO_BYTE (to) - (CHAR_TO_BYTE (from))))) return Qnil; @@ -8950,7 +8950,7 @@ is nil. */) CHECK_NUMBER_COERCE_MARKER (end); if (XINT (start) < BEG || XINT (end) > Z || XINT (start) > XINT (end)) args_out_of_range (start, end); - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) return Qnil; start_byte = CHAR_TO_BYTE (XINT (start)); end_byte = CHAR_TO_BYTE (XINT (end)); diff --git a/src/composite.c b/src/composite.c index 6de60bdaeba..efc0bcb9615 100644 --- a/src/composite.c +++ b/src/composite.c @@ -819,7 +819,7 @@ fill_gstring_header (header, start, end, font_object, string) if (NILP (string)) { - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) error ("Attempt to shape unibyte text"); validate_region (&start, &end); from = XFASTINT (start); diff --git a/src/data.c b/src/data.c index 913cd0a98f4..9eabf68ca6b 100644 --- a/src/data.c +++ b/src/data.c @@ -1138,7 +1138,7 @@ swap_in_symval_forwarding (symbol, valcontents) Fsetcdr (tem1, do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue)); /* Choose the new binding. */ - tem1 = assq_no_quit (symbol, current_buffer->local_var_alist); + tem1 = assq_no_quit (symbol, BUF_LOCAL_VAR_ALIST (current_buffer)); XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 0; XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0; if (NILP (tem1)) @@ -1254,7 +1254,7 @@ set_internal (symbol, newval, buf, bindflag) buf = current_buffer; /* If restoring in a dead buffer, do nothing. */ - if (NILP (buf->name)) + if (NILP (BUF_NAME (buf))) return newval; CHECK_SYMBOL (symbol); @@ -1305,7 +1305,7 @@ set_internal (symbol, newval, buf, bindflag) do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->realvalue)); /* Find the new binding. */ - tem1 = Fassq (symbol, buf->local_var_alist); + tem1 = Fassq (symbol, BUF_LOCAL_VAR_ALIST (buf)); XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 1; XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame = 0; @@ -1341,8 +1341,8 @@ set_internal (symbol, newval, buf, bindflag) else { tem1 = Fcons (symbol, XCDR (current_alist_element)); - buf->local_var_alist - = Fcons (tem1, buf->local_var_alist); + BUF_LOCAL_VAR_ALIST (buf) + = Fcons (tem1, BUF_LOCAL_VAR_ALIST (buf)); } } @@ -1658,7 +1658,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) } /* Make sure this buffer has its own value of symbol. */ XSETSYMBOL (variable, sym); /* Propagate variable indirections. */ - tem = Fassq (variable, current_buffer->local_var_alist); + tem = Fassq (variable, BUF_LOCAL_VAR_ALIST (current_buffer)); if (NILP (tem)) { /* Swap out any local binding for some other buffer, and make @@ -1666,9 +1666,9 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) default value. */ find_symbol_value (variable); - current_buffer->local_var_alist + BUF_LOCAL_VAR_ALIST (current_buffer) = Fcons (Fcons (variable, XCDR (XBUFFER_LOCAL_VALUE (sym->value)->cdr)), - current_buffer->local_var_alist); + BUF_LOCAL_VAR_ALIST (current_buffer)); /* Make sure symbol does not think it is set up for this buffer; force it to look once again for this buffer's value. */ @@ -1729,10 +1729,10 @@ From now on the default value will apply in this buffer. Return VARIABLE. */) /* Get rid of this buffer's alist element, if any. */ XSETSYMBOL (variable, sym); /* Propagate variable indirection. */ - tem = Fassq (variable, current_buffer->local_var_alist); + tem = Fassq (variable, BUF_LOCAL_VAR_ALIST (current_buffer)); if (!NILP (tem)) - current_buffer->local_var_alist - = Fdelq (tem, current_buffer->local_var_alist); + BUF_LOCAL_VAR_ALIST (current_buffer) + = Fdelq (tem, BUF_LOCAL_VAR_ALIST (current_buffer)); /* If the symbol is set up with the current buffer's binding loaded, recompute its value. We have to do it now, or else @@ -1844,7 +1844,7 @@ BUFFER defaults to the current buffer. */) { Lisp_Object tail, elt; - for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) + for (tail = BUF_LOCAL_VAR_ALIST (buf); CONSP (tail); tail = XCDR (tail)) { elt = XCAR (tail); if (EQ (variable, XCAR (elt))) @@ -1898,7 +1898,7 @@ BUFFER defaults to the current buffer. */) Lisp_Object tail, elt; if (XBUFFER_LOCAL_VALUE (valcontents)->local_if_set) return Qt; - for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) + for (tail = BUF_LOCAL_VAR_ALIST (buf); CONSP (tail); tail = XCDR (tail)) { elt = XCAR (tail); if (EQ (variable, XCAR (elt))) diff --git a/src/dispextern.h b/src/dispextern.h index ec45a948ef5..d8ebff1a559 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -1353,7 +1353,7 @@ struct glyph_string && !(W)->pseudo_window_p \ && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ && BUFFERP ((W)->buffer) \ - && !NILP (XBUFFER ((W)->buffer)->mode_line_format) \ + && !NILP (BUF_MODE_LINE_FORMAT (XBUFFER ((W)->buffer))) \ && WINDOW_TOTAL_LINES (W) > 1) /* Value is non-zero if window W wants a header line. */ @@ -1363,8 +1363,8 @@ struct glyph_string && !(W)->pseudo_window_p \ && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ && BUFFERP ((W)->buffer) \ - && !NILP (XBUFFER ((W)->buffer)->header_line_format) \ - && WINDOW_TOTAL_LINES (W) > 1 + !NILP (XBUFFER ((W)->buffer)->mode_line_format)) + && !NILP (BUF_HEADER_LINE_FORMAT (XBUFFER ((W)->buffer))) \ + && WINDOW_TOTAL_LINES (W) > 1 + !NILP (BUF_MODE_LINE_FORMAT (XBUFFER ((W)->buffer)))) /* Return proper value to be used as baseline offset of font that has diff --git a/src/dispnew.c b/src/dispnew.c index 2b205fa06d1..0c428852621 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -3482,7 +3482,7 @@ direct_output_for_insert (g) /* Non-null means that redisplay of W is based on window matrices. */ int window_redisplay_p = FRAME_WINDOW_P (f); /* Non-null means we are in overwrite mode. */ - int overwrite_p = !NILP (current_buffer->overwrite_mode); + int overwrite_p = !NILP (BUF_OVERWRITE_MODE (current_buffer)); int added_width; struct text_pos pos; int delta, delta_bytes; @@ -3515,7 +3515,7 @@ direct_output_for_insert (g) || g == '\t' || g == '\n' || g == '\r' - || (g == ' ' && !NILP (current_buffer->word_wrap)) + || (g == ' ' && !NILP (BUF_WORD_WRAP (current_buffer))) /* Give up if unable to display the cursor in the window. */ || w->cursor.vpos < 0 /* Give up if we are showing a message or just cleared the message @@ -3548,7 +3548,7 @@ direct_output_for_insert (g) position. */ clear_glyph_row (&scratch_glyph_row); SET_TEXT_POS (pos, PT, PT_BYTE); - DEC_TEXT_POS (pos, !NILP (current_buffer->enable_multibyte_characters)); + DEC_TEXT_POS (pos, !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))); init_iterator (&it, w, CHARPOS (pos), BYTEPOS (pos), &scratch_glyph_row, DEFAULT_FACE_ID); @@ -3777,11 +3777,11 @@ direct_output_forward_char (n) return 0; /* Give up if the buffer's direction is reversed. */ - if (!NILP (XBUFFER (w->buffer)->direction_reversed)) + if (!NILP (BUF_DIRECTION_REVERSED (XBUFFER (w->buffer)))) return 0; /* Can't use direct output if highlighting a region. */ - if (!NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active)) + if (!NILP (Vtransient_mark_mode) && !NILP (BUF_MARK_ACTIVE (current_buffer))) return 0; /* Can't use direct output if highlighting trailing whitespace. */ @@ -6746,7 +6746,7 @@ pass nil for VARIABLE. */) { buf = XCDR (XCAR (tail)); /* Ignore buffers that aren't included in buffer lists. */ - if (SREF (XBUFFER (buf)->name, 0) == ' ') + if (SREF (BUF_NAME (XBUFFER (buf)), 0) == ' ') continue; if (vecp == end) goto changed; @@ -6754,7 +6754,7 @@ pass nil for VARIABLE. */) goto changed; if (vecp == end) goto changed; - if (!EQ (*vecp++, XBUFFER (buf)->read_only)) + if (!EQ (*vecp++, BUF_READ_ONLY (XBUFFER (buf)))) goto changed; if (vecp == end) goto changed; @@ -6801,10 +6801,10 @@ pass nil for VARIABLE. */) { buf = XCDR (XCAR (tail)); /* Ignore buffers that aren't included in buffer lists. */ - if (SREF (XBUFFER (buf)->name, 0) == ' ') + if (SREF (BUF_NAME (XBUFFER (buf)), 0) == ' ') continue; *vecp++ = buf; - *vecp++ = XBUFFER (buf)->read_only; + *vecp++ = BUF_READ_ONLY (XBUFFER (buf)); *vecp++ = Fbuffer_modified_p (buf); } /* Fill up the vector with lambdas (always at least one). */ diff --git a/src/editfns.c b/src/editfns.c index d838616b168..57537d04e62 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -323,10 +323,10 @@ region_limit (beginningp) if (!NILP (Vtransient_mark_mode) && NILP (Vmark_even_if_inactive) - && NILP (current_buffer->mark_active)) + && NILP (BUF_MARK_ACTIVE (current_buffer))) xsignal0 (Qmark_inactive); - m = Fmarker_position (current_buffer->mark); + m = Fmarker_position (BUF_MARK (current_buffer)); if (NILP (m)) error ("The mark is not set now, so there is no region"); @@ -355,7 +355,7 @@ Watch out! Moving this marker changes the mark position. If you set the marker not to point anywhere, the buffer will have no mark. */) () { - return current_buffer->mark; + return BUF_MARK (current_buffer); } @@ -893,9 +893,9 @@ save_excursion_save () == current_buffer); return Fcons (Fpoint_marker (), - Fcons (Fcopy_marker (current_buffer->mark, Qnil), + Fcons (Fcopy_marker (BUF_MARK (current_buffer), Qnil), Fcons (visible ? Qt : Qnil, - Fcons (current_buffer->mark_active, + Fcons (BUF_MARK_ACTIVE (current_buffer), selected_window)))); } @@ -928,8 +928,8 @@ save_excursion_restore (info) /* Mark marker. */ info = XCDR (info); tem = XCAR (info); - omark = Fmarker_position (current_buffer->mark); - Fset_marker (current_buffer->mark, tem, Fcurrent_buffer ()); + omark = Fmarker_position (BUF_MARK (current_buffer)); + Fset_marker (BUF_MARK (current_buffer), tem, Fcurrent_buffer ()); nmark = Fmarker_position (tem); unchain_marker (XMARKER (tem)); @@ -950,14 +950,14 @@ save_excursion_restore (info) /* Mark active */ info = XCDR (info); tem = XCAR (info); - tem1 = current_buffer->mark_active; - current_buffer->mark_active = tem; + tem1 = BUF_MARK_ACTIVE (current_buffer); + BUF_MARK_ACTIVE (current_buffer) = tem; if (!NILP (Vrun_hooks)) { /* If mark is active now, and either was not active or was at a different place, run the activate hook. */ - if (! NILP (current_buffer->mark_active)) + if (! NILP (BUF_MARK_ACTIVE (current_buffer))) { if (! EQ (omark, nmark)) call1 (Vrun_hooks, intern ("activate-mark-hook")); @@ -1147,7 +1147,7 @@ At the beginning of the buffer or accessible region, return 0. */) Lisp_Object temp; if (PT <= BEGV) XSETFASTINT (temp, 0); - else if (!NILP (current_buffer->enable_multibyte_characters)) + else if (!NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) { int pos = PT_BYTE; DEC_POS (pos); @@ -1263,7 +1263,7 @@ If POS is out of range, the value is nil. */) pos_byte = CHAR_TO_BYTE (XINT (pos)); } - if (!NILP (current_buffer->enable_multibyte_characters)) + if (!NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) { DEC_POS (pos_byte); XSETFASTINT (val, FETCH_CHAR (pos_byte)); @@ -2184,7 +2184,7 @@ general_insert_function (void (*insert_func) unsigned char str[MAX_MULTIBYTE_LENGTH]; int len; - if (!NILP (current_buffer->enable_multibyte_characters)) + if (!NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) len = CHAR_STRING (XFASTINT (val), str); else { @@ -2325,7 +2325,7 @@ from adjoining text, if those properties are sticky. */) CHECK_NUMBER (character); CHECK_NUMBER (count); - if (!NILP (current_buffer->enable_multibyte_characters)) + if (!NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) len = CHAR_STRING (XFASTINT (character), str); else str[0] = XFASTINT (character), len = 1; @@ -2373,7 +2373,7 @@ from adjoining text, if those properties are sticky. */) if (XINT (byte) < 0 || XINT (byte) > 255) args_out_of_range_3 (byte, make_number (0), make_number (255)); if (XINT (byte) >= 128 - && ! NILP (current_buffer->enable_multibyte_characters)) + && ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) XSETFASTINT (byte, BYTE8_TO_CHAR (XINT (byte))); return Finsert_char (byte, count, inherit); } @@ -2430,7 +2430,7 @@ make_buffer_string_both (start, start_byte, end, end_byte, props) if (start < GPT && GPT < end) move_gap (start); - if (! NILP (current_buffer->enable_multibyte_characters)) + if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) result = make_uninit_multibyte_string (end - start, end_byte - start_byte); else result = make_uninit_string (end - start); @@ -2550,7 +2550,7 @@ They default to the values of (point-min) and (point-max) in BUFFER. */) if (NILP (buf)) nsberror (buffer); bp = XBUFFER (buf); - if (NILP (bp->name)) + if (NILP (BUF_NAME (bp))) error ("Selecting deleted buffer"); if (NILP (start)) @@ -2599,8 +2599,8 @@ determines whether case is significant or ignored. */) register int begp1, endp1, begp2, endp2, temp; register struct buffer *bp1, *bp2; register Lisp_Object trt - = (!NILP (current_buffer->case_fold_search) - ? current_buffer->case_canon_table : Qnil); + = (!NILP (BUF_CASE_FOLD_SEARCH (current_buffer)) + ? BUF_CASE_CANON_TABLE (current_buffer) : Qnil); int chars = 0; int i1, i2, i1_byte, i2_byte; @@ -2615,7 +2615,7 @@ determines whether case is significant or ignored. */) if (NILP (buf1)) nsberror (buffer1); bp1 = XBUFFER (buf1); - if (NILP (bp1->name)) + if (NILP (BUF_NAME (bp1))) error ("Selecting deleted buffer"); } @@ -2653,7 +2653,7 @@ determines whether case is significant or ignored. */) if (NILP (buf2)) nsberror (buffer2); bp2 = XBUFFER (buf2); - if (NILP (bp2->name)) + if (NILP (BUF_NAME (bp2))) error ("Selecting deleted buffer"); } @@ -2693,7 +2693,7 @@ determines whether case is significant or ignored. */) QUIT; - if (! NILP (bp1->enable_multibyte_characters)) + if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (bp1))) { c1 = BUF_FETCH_MULTIBYTE_CHAR (bp1, i1_byte); BUF_INC_POS (bp1, i1_byte); @@ -2706,7 +2706,7 @@ determines whether case is significant or ignored. */) i1++; } - if (! NILP (bp2->enable_multibyte_characters)) + if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (bp2))) { c2 = BUF_FETCH_MULTIBYTE_CHAR (bp2, i2_byte); BUF_INC_POS (bp2, i2_byte); @@ -2747,14 +2747,14 @@ static Lisp_Object subst_char_in_region_unwind (arg) Lisp_Object arg; { - return current_buffer->undo_list = arg; + return BUF_UNDO_LIST (current_buffer) = arg; } static Lisp_Object subst_char_in_region_unwind_1 (arg) Lisp_Object arg; { - return current_buffer->filename = arg; + return BUF_FILENAME (current_buffer) = arg; } DEFUN ("subst-char-in-region", Fsubst_char_in_region, @@ -2781,7 +2781,7 @@ Both characters must have the same length of multi-byte form. */) #define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER) int maybe_byte_combining = COMBINING_NO; int last_changed = 0; - int multibyte_p = !NILP (current_buffer->enable_multibyte_characters); + int multibyte_p = !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); restart: @@ -2825,12 +2825,12 @@ Both characters must have the same length of multi-byte form. */) if (!changed && !NILP (noundo)) { record_unwind_protect (subst_char_in_region_unwind, - current_buffer->undo_list); - current_buffer->undo_list = Qt; + BUF_UNDO_LIST (current_buffer)); + BUF_UNDO_LIST (current_buffer) = Qt; /* Don't do file-locking. */ record_unwind_protect (subst_char_in_region_unwind_1, - current_buffer->filename); - current_buffer->filename = Qnil; + BUF_FILENAME (current_buffer)); + BUF_FILENAME (current_buffer) = Qnil; } if (pos_byte < GPT_BYTE) @@ -2893,7 +2893,7 @@ Both characters must have the same length of multi-byte form. */) struct gcpro gcpro1; - tem = current_buffer->undo_list; + tem = BUF_UNDO_LIST (current_buffer); GCPRO1 (tem); /* Make a multibyte string containing this single character. */ @@ -2912,7 +2912,7 @@ Both characters must have the same length of multi-byte form. */) INC_POS (pos_byte_next); if (! NILP (noundo)) - current_buffer->undo_list = tem; + BUF_UNDO_LIST (current_buffer) = tem; UNGCPRO; } @@ -3017,7 +3017,7 @@ It returns the number of characters changed. */) int cnt; /* Number of changes made. */ int size; /* Size of translate table. */ int pos, pos_byte, end_pos; - int multibyte = !NILP (current_buffer->enable_multibyte_characters); + int multibyte = !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); int string_multibyte; Lisp_Object val; @@ -4222,20 +4222,20 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */) if (XINT (c1) == XINT (c2)) return Qt; - if (NILP (current_buffer->case_fold_search)) + if (NILP (BUF_CASE_FOLD_SEARCH (current_buffer))) return Qnil; /* Do these in separate statements, then compare the variables. because of the way DOWNCASE uses temp variables. */ i1 = XFASTINT (c1); - if (NILP (current_buffer->enable_multibyte_characters) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) && ! ASCII_CHAR_P (i1)) { MAKE_CHAR_MULTIBYTE (i1); } i2 = XFASTINT (c2); - if (NILP (current_buffer->enable_multibyte_characters) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) && ! ASCII_CHAR_P (i2)) { MAKE_CHAR_MULTIBYTE (i2); diff --git a/src/fileio.c b/src/fileio.c index 9ef40340e21..ff4626ca883 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -872,7 +872,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */ if (NILP (default_directory)) - default_directory = current_buffer->directory; + default_directory = BUF_DIRECTORY (current_buffer); if (! STRINGP (default_directory)) { #ifdef DOS_NT @@ -2777,7 +2777,7 @@ See `file-symlink-p' to distinguish symlinks. */) struct stat st; Lisp_Object handler; - absname = expand_and_dir_to_file (filename, current_buffer->directory); + absname = expand_and_dir_to_file (filename, BUF_DIRECTORY (current_buffer)); /* If the file name has special constructs in it, call the corresponding file handler. */ @@ -2832,7 +2832,7 @@ See `file-symlink-p' to distinguish symlinks. */) struct stat st; Lisp_Object handler; - absname = expand_and_dir_to_file (filename, current_buffer->directory); + absname = expand_and_dir_to_file (filename, BUF_DIRECTORY (current_buffer)); /* If the file name has special constructs in it, call the corresponding file handler. */ @@ -2873,7 +2873,7 @@ Return nil, if file does not exist or is not accessible. */) struct stat st; Lisp_Object handler; - absname = expand_and_dir_to_file (filename, current_buffer->directory); + absname = expand_and_dir_to_file (filename, BUF_DIRECTORY (current_buffer)); /* If the file name has special constructs in it, call the corresponding file handler. */ @@ -2907,7 +2907,7 @@ symbolic notation, like the `chmod' command from GNU Coreutils. */) Lisp_Object absname, encoded_absname; Lisp_Object handler; - absname = Fexpand_file_name (filename, current_buffer->directory); + absname = Fexpand_file_name (filename, BUF_DIRECTORY (current_buffer)); CHECK_NUMBER (mode); /* If the file name has special constructs in it, @@ -2972,7 +2972,7 @@ Use the current time if TIME is nil. TIME is in the format of if (! lisp_time_argument (time, &sec, &usec)) error ("Invalid time specification"); - absname = Fexpand_file_name (filename, current_buffer->directory); + absname = Fexpand_file_name (filename, BUF_DIRECTORY (current_buffer)); /* If the file name has special constructs in it, call the corresponding file handler. */ @@ -3035,8 +3035,8 @@ otherwise, if FILE2 does not exist, the answer is t. */) absname1 = Qnil; GCPRO2 (absname1, file2); - absname1 = expand_and_dir_to_file (file1, current_buffer->directory); - absname2 = expand_and_dir_to_file (file2, current_buffer->directory); + absname1 = expand_and_dir_to_file (file1, BUF_DIRECTORY (current_buffer)); + absname2 = expand_and_dir_to_file (file2, BUF_DIRECTORY (current_buffer)); UNGCPRO; /* If the file name has special constructs in it, @@ -3105,8 +3105,8 @@ decide_coding_unwind (unwind_data) TEMP_SET_PT_BOTH (BEG, BEG_BYTE); /* Now we are safe to change the buffer's multibyteness directly. */ - current_buffer->enable_multibyte_characters = multibyte; - current_buffer->undo_list = undo_list; + BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer) = multibyte; + BUF_UNDO_LIST (current_buffer) = undo_list; return Qnil; } @@ -3201,7 +3201,7 @@ variable `last-coding-system-used' to the coding system actually used. */) if (current_buffer->base_buffer && ! NILP (visit)) error ("Cannot do file visiting in an indirect buffer"); - if (!NILP (current_buffer->read_only)) + if (!NILP (BUF_READ_ONLY (current_buffer))) Fbarf_if_buffer_read_only (); val = Qnil; @@ -3392,16 +3392,16 @@ variable `last-coding-system-used' to the coding system actually used. */) buf = XBUFFER (buffer); delete_all_overlays (buf); - buf->directory = current_buffer->directory; - buf->read_only = Qnil; - buf->filename = Qnil; - buf->undo_list = Qt; + BUF_DIRECTORY (buf) = BUF_DIRECTORY (current_buffer); + BUF_READ_ONLY (buf) = Qnil; + BUF_FILENAME (buf) = Qnil; + BUF_UNDO_LIST (buf) = Qt; eassert (buf->overlays_before == NULL); eassert (buf->overlays_after == NULL); set_buffer_internal (buf); Ferase_buffer (); - buf->enable_multibyte_characters = Qnil; + BUF_ENABLE_MULTIBYTE_CHARACTERS (buf) = Qnil; insert_1_both (read_buf, nread, nread, 0, 0, 0); TEMP_SET_PT_BOTH (BEG, BEG_BYTE); @@ -3439,7 +3439,7 @@ variable `last-coding-system-used' to the coding system actually used. */) else CHECK_CODING_SYSTEM (coding_system); - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) /* We must suppress all character code conversion except for end-of-line conversion. */ coding_system = raw_text_coding_system (coding_system); @@ -3586,7 +3586,7 @@ variable `last-coding-system-used' to the coding system actually used. */) we cannot use this method; giveup and try the other. */ if (same_at_end > same_at_start && FETCH_BYTE (same_at_end - 1) >= 0200 - && ! NILP (current_buffer->enable_multibyte_characters) + && ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) && (CODING_MAY_REQUIRE_DECODING (&coding))) giveup_match_end = 1; break; @@ -3605,14 +3605,14 @@ variable `last-coding-system-used' to the coding system actually used. */) /* Extend the start of non-matching text area to multibyte character boundary. */ - if (! NILP (current_buffer->enable_multibyte_characters)) + if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) while (same_at_start > BEGV_BYTE && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start))) same_at_start--; /* Extend the end of non-matching text area to multibyte character boundary. */ - if (! NILP (current_buffer->enable_multibyte_characters)) + if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) while (same_at_end < ZV_BYTE && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end))) same_at_end++; @@ -3661,7 +3661,7 @@ variable `last-coding-system-used' to the coding system actually used. */) unsigned char *decoded; EMACS_INT temp; int this_count = SPECPDL_INDEX (); - int multibyte = ! NILP (current_buffer->enable_multibyte_characters); + int multibyte = ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); Lisp_Object conversion_buffer; conversion_buffer = code_conversion_save (1, multibyte); @@ -3766,7 +3766,7 @@ variable `last-coding-system-used' to the coding system actually used. */) /* Extend the start of non-matching text area to the previous multibyte character boundary. */ - if (! NILP (current_buffer->enable_multibyte_characters)) + if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) while (same_at_start > BEGV_BYTE && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start))) same_at_start--; @@ -3783,7 +3783,7 @@ variable `last-coding-system-used' to the coding system actually used. */) /* Extend the end of non-matching text area to the next multibyte character boundary. */ - if (! NILP (current_buffer->enable_multibyte_characters)) + if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) while (same_at_end < ZV_BYTE && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end))) same_at_end++; @@ -3858,9 +3858,9 @@ variable `last-coding-system-used' to the coding system actually used. */) if (NILP (visit) && inserted > 0) { #ifdef CLASH_DETECTION - if (!NILP (current_buffer->file_truename) + if (!NILP (BUF_FILE_TRUENAME (current_buffer)) /* Make binding buffer-file-name to nil effective. */ - && !NILP (current_buffer->filename) + && !NILP (BUF_FILENAME (current_buffer)) && SAVE_MODIFF >= MODIFF) we_locked_file = 1; #endif /* CLASH_DETECTION */ @@ -3962,7 +3962,7 @@ variable `last-coding-system-used' to the coding system actually used. */) { #ifdef CLASH_DETECTION if (we_locked_file) - unlock_file (current_buffer->file_truename); + unlock_file (BUF_FILE_TRUENAME (current_buffer)); #endif Vdeactivate_mark = old_Vdeactivate_mark; } @@ -4013,11 +4013,11 @@ variable `last-coding-system-used' to the coding system actually used. */) Lisp_Object unwind_data; int count = SPECPDL_INDEX (); - unwind_data = Fcons (current_buffer->enable_multibyte_characters, - Fcons (current_buffer->undo_list, + unwind_data = Fcons (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer), + Fcons (BUF_UNDO_LIST (current_buffer), Fcurrent_buffer ())); - current_buffer->enable_multibyte_characters = Qnil; - current_buffer->undo_list = Qt; + BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer) = Qnil; + BUF_UNDO_LIST (current_buffer) = Qt; record_unwind_protect (decide_coding_unwind, unwind_data); if (inserted > 0 && ! NILP (Vset_auto_coding_function)) @@ -4047,7 +4047,7 @@ variable `last-coding-system-used' to the coding system actually used. */) else CHECK_CODING_SYSTEM (coding_system); - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) /* We must suppress all character code conversion except for end-of-line conversion. */ coding_system = raw_text_coding_system (coding_system); @@ -4065,10 +4065,10 @@ variable `last-coding-system-used' to the coding system actually used. */) && NILP (replace)) /* Visiting a file with these coding system makes the buffer unibyte. */ - current_buffer->enable_multibyte_characters = Qnil; + BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer) = Qnil; } - coding.dst_multibyte = ! NILP (current_buffer->enable_multibyte_characters); + coding.dst_multibyte = ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); if (CODING_MAY_REQUIRE_DECODING (&coding) && (inserted > 0 || CODING_REQUIRE_FLUSHING (&coding))) { @@ -4109,13 +4109,13 @@ variable `last-coding-system-used' to the coding system actually used. */) if (!NILP (visit)) { - if (!EQ (current_buffer->undo_list, Qt) && !nochange) - current_buffer->undo_list = Qnil; + if (!EQ (BUF_UNDO_LIST (current_buffer), Qt) && !nochange) + BUF_UNDO_LIST (current_buffer) = Qnil; if (NILP (handler)) { current_buffer->modtime = st.st_mtime; - current_buffer->filename = orig_filename; + BUF_FILENAME (current_buffer) = orig_filename; } SAVE_MODIFF = MODIFF; @@ -4124,8 +4124,8 @@ variable `last-coding-system-used' to the coding system actually used. */) #ifdef CLASH_DETECTION if (NILP (handler)) { - if (!NILP (current_buffer->file_truename)) - unlock_file (current_buffer->file_truename); + if (!NILP (BUF_FILE_TRUENAME (current_buffer))) + unlock_file (BUF_FILE_TRUENAME (current_buffer)); unlock_file (filename); } #endif /* CLASH_DETECTION */ @@ -4158,8 +4158,8 @@ variable `last-coding-system-used' to the coding system actually used. */) specbind (Qinhibit_modification_hooks, Qt); /* Save old undo list and don't record undo for decoding. */ - old_undo = current_buffer->undo_list; - current_buffer->undo_list = Qt; + old_undo = BUF_UNDO_LIST (current_buffer); + BUF_UNDO_LIST (current_buffer) = Qt; if (NILP (replace)) { @@ -4247,7 +4247,7 @@ variable `last-coding-system-used' to the coding system actually used. */) if (NILP (visit)) { - current_buffer->undo_list = old_undo; + BUF_UNDO_LIST (current_buffer) = old_undo; if (CONSP (old_undo) && inserted != old_inserted) { /* Adjust the last undo record for the size change during @@ -4262,7 +4262,7 @@ variable `last-coding-system-used' to the coding system actually used. */) else /* If undo_list was Qt before, keep it that way. Otherwise start with an empty undo_list. */ - current_buffer->undo_list = EQ (old_undo, Qt) ? Qt : Qnil; + BUF_UNDO_LIST (current_buffer) = EQ (old_undo, Qt) ? Qt : Qnil; unbind_to (count, Qnil); } @@ -4318,8 +4318,8 @@ choose_write_coding_system (start, end, filename, Lisp_Object eol_parent = Qnil; if (auto_saving - && NILP (Fstring_equal (current_buffer->filename, - current_buffer->auto_save_file_name))) + && NILP (Fstring_equal (BUF_FILENAME (current_buffer), + BUF_AUTO_SAVE_FILE_NAME (current_buffer)))) { val = Qutf_8_emacs; eol_parent = Qunix; @@ -4348,12 +4348,12 @@ choose_write_coding_system (start, end, filename, int using_default_coding = 0; int force_raw_text = 0; - val = current_buffer->buffer_file_coding_system; + val = BUF_BUFFER_FILE_CODING_SYSTEM (current_buffer); if (NILP (val) || NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil))) { val = Qnil; - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) force_raw_text = 1; } @@ -4374,7 +4374,7 @@ choose_write_coding_system (start, end, filename, { /* If we still have not decided a coding system, use the default value of buffer-file-coding-system. */ - val = current_buffer->buffer_file_coding_system; + val = BUF_BUFFER_FILE_CODING_SYSTEM (current_buffer); using_default_coding = 1; } @@ -4398,9 +4398,9 @@ choose_write_coding_system (start, end, filename, format, we use that of `default-buffer-file-coding-system'. */ if (! using_default_coding - && ! NILP (buffer_defaults.buffer_file_coding_system)) + && ! NILP (BUF_BUFFER_FILE_CODING_SYSTEM (&buffer_defaults))) val = (coding_inherit_eol_type - (val, buffer_defaults.buffer_file_coding_system)); + (val, BUF_BUFFER_FILE_CODING_SYSTEM (&buffer_defaults))); /* If we decide not to encode text, use `raw-text' or one of its subsidiaries. */ @@ -4411,7 +4411,7 @@ choose_write_coding_system (start, end, filename, val = coding_inherit_eol_type (val, eol_parent); setup_coding_system (val, coding); - if (!STRINGP (start) && !NILP (current_buffer->selective_display)) + if (!STRINGP (start) && !NILP (BUF_SELECTIVE_DISPLAY (current_buffer))) coding->mode |= CODING_MODE_SELECTIVE_DISPLAY; return val; } @@ -4516,8 +4516,8 @@ This calls `write-region-annotate-functions' at the start, and if (visiting) { SAVE_MODIFF = MODIFF; - XSETFASTINT (current_buffer->save_length, Z - BEG); - current_buffer->filename = visit_file; + XSETFASTINT (BUF_SAVE_LENGTH (current_buffer), Z - BEG); + BUF_FILENAME (current_buffer) = visit_file; } UNGCPRO; return val; @@ -4727,15 +4727,15 @@ This calls `write-region-annotate-functions' at the start, and if (visiting) { SAVE_MODIFF = MODIFF; - XSETFASTINT (current_buffer->save_length, Z - BEG); - current_buffer->filename = visit_file; + XSETFASTINT (BUF_SAVE_LENGTH (current_buffer), Z - BEG); + BUF_FILENAME (current_buffer) = visit_file; update_mode_lines++; } else if (quietly) { if (auto_saving - && ! NILP (Fstring_equal (current_buffer->filename, - current_buffer->auto_save_file_name))) + && ! NILP (Fstring_equal (BUF_FILENAME (current_buffer), + BUF_AUTO_SAVE_FILE_NAME (current_buffer)))) SAVE_MODIFF = MODIFF; return Qnil; @@ -4819,10 +4819,10 @@ build_annotations (start, end) } /* Now do the same for annotation functions implied by the file-format */ - if (auto_saving && (!EQ (current_buffer->auto_save_file_format, Qt))) - p = current_buffer->auto_save_file_format; + if (auto_saving && (!EQ (BUF_AUTO_SAVE_FILE_FORMAT (current_buffer), Qt))) + p = BUF_AUTO_SAVE_FILE_FORMAT (current_buffer); else - p = current_buffer->file_format; + p = BUF_FILE_FORMAT (current_buffer); for (i = 0; CONSP (p); p = XCDR (p), ++i) { struct buffer *given_buffer = current_buffer; @@ -5006,17 +5006,17 @@ See Info node `(elisp)Modification Time' for more details. */) CHECK_BUFFER (buf); b = XBUFFER (buf); - if (!STRINGP (b->filename)) return Qt; + if (!STRINGP (BUF_FILENAME (b))) return Qt; if (b->modtime == 0) return Qt; /* If the file name has special constructs in it, call the corresponding file handler. */ - handler = Ffind_file_name_handler (b->filename, + handler = Ffind_file_name_handler (BUF_FILENAME (b), Qverify_visited_file_modtime); if (!NILP (handler)) return call2 (handler, Qverify_visited_file_modtime, buf); - filename = ENCODE_FILE (b->filename); + filename = ENCODE_FILE (BUF_FILENAME (b)); if (stat (SDATA (filename), &st) < 0) { @@ -5079,7 +5079,7 @@ An argument specifies the modification time value to use struct stat st; Lisp_Object handler; - filename = Fexpand_file_name (current_buffer->filename, Qnil); + filename = Fexpand_file_name (BUF_FILENAME (current_buffer), Qnil); /* If the file name has special constructs in it, call the corresponding file handler. */ @@ -5112,7 +5112,7 @@ auto_save_error (error) ring_bell (XFRAME (selected_frame)); args[0] = build_string ("Auto-saving %s: %s"); - args[1] = current_buffer->name; + args[1] = BUF_NAME (current_buffer); args[2] = Ferror_message_string (error); msg = Fformat (3, args); GCPRO1 (msg); @@ -5143,19 +5143,19 @@ auto_save_1 () auto_save_mode_bits = 0666; /* Get visited file's mode to become the auto save file's mode. */ - if (! NILP (current_buffer->filename)) + if (! NILP (BUF_FILENAME (current_buffer))) { - if (stat (SDATA (current_buffer->filename), &st) >= 0) + if (stat (SDATA (BUF_FILENAME (current_buffer)), &st) >= 0) /* But make sure we can overwrite it later! */ auto_save_mode_bits = st.st_mode | 0600; - else if ((modes = Ffile_modes (current_buffer->filename), + else if ((modes = Ffile_modes (BUF_FILENAME (current_buffer)), INTEGERP (modes))) /* Remote files don't cooperate with stat. */ auto_save_mode_bits = XINT (modes) | 0600; } return - Fwrite_region (Qnil, Qnil, current_buffer->auto_save_file_name, Qnil, + Fwrite_region (Qnil, Qnil, BUF_AUTO_SAVE_FILE_NAME (current_buffer), Qnil, NILP (Vauto_save_visited_file_name) ? Qlambda : Qt, Qnil, Qnil); } @@ -5299,18 +5299,18 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) /* Record all the buffers that have auto save mode in the special file that lists them. For each of these buffers, Record visited name (if any) and auto save name. */ - if (STRINGP (b->auto_save_file_name) + if (STRINGP (BUF_AUTO_SAVE_FILE_NAME (b)) && stream != NULL && do_handled_files == 0) { BLOCK_INPUT; - if (!NILP (b->filename)) + if (!NILP (BUF_FILENAME (b))) { - fwrite (SDATA (b->filename), 1, - SBYTES (b->filename), stream); + fwrite (SDATA (BUF_FILENAME (b)), 1, + SBYTES (BUF_FILENAME (b)), stream); } putc ('\n', stream); - fwrite (SDATA (b->auto_save_file_name), 1, - SBYTES (b->auto_save_file_name), stream); + fwrite (SDATA (BUF_AUTO_SAVE_FILE_NAME (b)), 1, + SBYTES (BUF_AUTO_SAVE_FILE_NAME (b)), stream); putc ('\n', stream); UNBLOCK_INPUT; } @@ -5327,13 +5327,13 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) /* Check for auto save enabled and file changed since last auto save and file changed since last real save. */ - if (STRINGP (b->auto_save_file_name) + if (STRINGP (BUF_AUTO_SAVE_FILE_NAME (b)) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) && BUF_AUTOSAVE_MODIFF (b) < BUF_MODIFF (b) /* -1 means we've turned off autosaving for a while--see below. */ - && XINT (b->save_length) >= 0 + && XINT (BUF_SAVE_LENGTH (b)) >= 0 && (do_handled_files - || NILP (Ffind_file_name_handler (b->auto_save_file_name, + || NILP (Ffind_file_name_handler (BUF_AUTO_SAVE_FILE_NAME (b), Qwrite_region)))) { EMACS_TIME before_time, after_time; @@ -5347,23 +5347,23 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) set_buffer_internal (b); if (NILP (Vauto_save_include_big_deletions) - && (XFASTINT (b->save_length) * 10 + && (XFASTINT (BUF_SAVE_LENGTH (b)) * 10 > (BUF_Z (b) - BUF_BEG (b)) * 13) /* A short file is likely to change a large fraction; spare the user annoying messages. */ - && XFASTINT (b->save_length) > 5000 + && XFASTINT (BUF_SAVE_LENGTH (b)) > 5000 /* These messages are frequent and annoying for `*mail*'. */ - && !EQ (b->filename, Qnil) + && !EQ (BUF_FILENAME (b), Qnil) && NILP (no_message)) { /* It has shrunk too much; turn off auto-saving here. */ minibuffer_auto_raise = orig_minibuffer_auto_raise; message_with_string ("Buffer %s has shrunk a lot; auto save disabled in that buffer until next real save", - b->name, 1); + BUF_NAME (b), 1); minibuffer_auto_raise = 0; /* Turn off auto-saving until there's a real save, and prevent any more warnings. */ - XSETINT (b->save_length, -1); + XSETINT (BUF_SAVE_LENGTH (b), -1); Fsleep_for (make_number (1), Qnil); continue; } diff --git a/src/filelock.c b/src/filelock.c index 57a2be23c5b..68cfd9d64be 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -671,9 +671,9 @@ unlock_all_files () for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) { b = XBUFFER (XCDR (XCAR (tail))); - if (STRINGP (b->file_truename) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) + if (STRINGP (BUF_FILE_TRUENAME (b)) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) { - unlock_file(b->file_truename); + unlock_file(BUF_FILE_TRUENAME (b)); } } } @@ -687,7 +687,7 @@ or else nothing is done if current buffer isn't visiting a file. */) Lisp_Object file; { if (NILP (file)) - file = current_buffer->file_truename; + file = BUF_FILE_TRUENAME (current_buffer); else CHECK_STRING (file); if (SAVE_MODIFF < MODIFF @@ -704,8 +704,8 @@ should not be locked in that case. */) () { if (SAVE_MODIFF < MODIFF - && STRINGP (current_buffer->file_truename)) - unlock_file (current_buffer->file_truename); + && STRINGP (BUF_FILE_TRUENAME (current_buffer))) + unlock_file (BUF_FILE_TRUENAME (current_buffer)); return Qnil; } @@ -716,8 +716,8 @@ unlock_buffer (buffer) struct buffer *buffer; { if (BUF_SAVE_MODIFF (buffer) < BUF_MODIFF (buffer) - && STRINGP (buffer->file_truename)) - unlock_file (buffer->file_truename); + && STRINGP (BUF_FILE_TRUENAME (buffer))) + unlock_file (BUF_FILE_TRUENAME (buffer)); } DEFUN ("file-locked-p", Ffile_locked_p, Sfile_locked_p, 1, 1, 0, diff --git a/src/fns.c b/src/fns.c index 1ab16ce80f1..ed2dcc1cc98 100644 --- a/src/fns.c +++ b/src/fns.c @@ -3285,7 +3285,7 @@ into shorter lines. */) SAFE_ALLOCA (encoded, char *, allength); encoded_length = base64_encode_1 (BYTE_POS_ADDR (ibeg), encoded, length, NILP (no_line_break), - !NILP (current_buffer->enable_multibyte_characters)); + !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))); if (encoded_length > allength) abort (); @@ -3472,7 +3472,7 @@ If the region can't be decoded, signal an error and don't modify the buffer. */ int old_pos = PT; int decoded_length; int inserted_chars; - int multibyte = !NILP (current_buffer->enable_multibyte_characters); + int multibyte = !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); USE_SAFE_ALLOCA; validate_region (&beg, &end); @@ -5062,12 +5062,12 @@ guesswork fails. Normally, an error is signaled in such case. */) { int force_raw_text = 0; - coding_system = XBUFFER (object)->buffer_file_coding_system; + coding_system = BUF_BUFFER_FILE_CODING_SYSTEM (XBUFFER (object)); if (NILP (coding_system) || NILP (Flocal_variable_p (Qbuffer_file_coding_system, Qnil))) { coding_system = Qnil; - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) force_raw_text = 1; } @@ -5084,11 +5084,11 @@ guesswork fails. Normally, an error is signaled in such case. */) } if (NILP (coding_system) - && !NILP (XBUFFER (object)->buffer_file_coding_system)) + && !NILP (BUF_BUFFER_FILE_CODING_SYSTEM (XBUFFER (object)))) { /* If we still have not decided a coding system, use the default value of buffer-file-coding-system. */ - coding_system = XBUFFER (object)->buffer_file_coding_system; + coding_system = BUF_BUFFER_FILE_CODING_SYSTEM (XBUFFER (object)); } if (!force_raw_text diff --git a/src/font.c b/src/font.c index 5a033c8d036..558c5971de0 100644 --- a/src/font.c +++ b/src/font.c @@ -3880,7 +3880,7 @@ font_at (c, pos, face, w, string) Lisp_Object font_object; multibyte = (NILP (string) - ? ! NILP (current_buffer->enable_multibyte_characters) + ? ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) : STRING_MULTIBYTE (string)); if (c < 0) { diff --git a/src/frame.c b/src/frame.c index 74c69004ee8..c162fd7b1b4 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1871,7 +1871,7 @@ make_frame_visible_1 (window) w = XWINDOW (window); if (!NILP (w->buffer)) - XBUFFER (w->buffer)->display_time = Fcurrent_time (); + BUF_DISPLAY_TIME (XBUFFER (w->buffer)) = Fcurrent_time (); if (!NILP (w->vchild)) make_frame_visible_1 (w->vchild); diff --git a/src/fringe.c b/src/fringe.c index dad9c37bce8..5aec49fcdb3 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -696,7 +696,7 @@ get_logical_cursor_bitmap (w, cursor) { Lisp_Object cmap, bm = Qnil; - if ((cmap = XBUFFER (w->buffer)->fringe_cursor_alist), !NILP (cmap)) + if ((cmap = BUF_FRINGE_CURSOR_ALIST (XBUFFER (w->buffer))), !NILP (cmap)) { bm = Fassq (cursor, cmap); if (CONSP (bm)) @@ -706,9 +706,9 @@ get_logical_cursor_bitmap (w, cursor) return lookup_fringe_bitmap (bm); } } - if (EQ (cmap, buffer_defaults.fringe_cursor_alist)) + if (EQ (cmap, BUF_FRINGE_CURSOR_ALIST (&buffer_defaults))) return NO_FRINGE_BITMAP; - bm = Fassq (cursor, buffer_defaults.fringe_cursor_alist); + bm = Fassq (cursor, BUF_FRINGE_CURSOR_ALIST (&buffer_defaults)); if (!CONSP (bm) || ((bm = XCDR (bm)), NILP (bm))) return NO_FRINGE_BITMAP; return lookup_fringe_bitmap (bm); @@ -736,7 +736,7 @@ get_logical_fringe_bitmap (w, bitmap, right_p, partial_p) If partial, lookup partial bitmap in default value if not found here. If not partial, or no partial spec is present, use non-partial bitmap. */ - if ((cmap = XBUFFER (w->buffer)->fringe_indicator_alist), !NILP (cmap)) + if ((cmap = BUF_FRINGE_INDICATOR_ALIST (XBUFFER (w->buffer))), !NILP (cmap)) { bm1 = Fassq (bitmap, cmap); if (CONSP (bm1)) @@ -770,10 +770,10 @@ get_logical_fringe_bitmap (w, bitmap, right_p, partial_p) } } - if (!EQ (cmap, buffer_defaults.fringe_indicator_alist) - && !NILP (buffer_defaults.fringe_indicator_alist)) + if (!EQ (cmap, BUF_FRINGE_INDICATOR_ALIST (&buffer_defaults)) + && !NILP (BUF_FRINGE_INDICATOR_ALIST (&buffer_defaults))) { - bm2 = Fassq (bitmap, buffer_defaults.fringe_indicator_alist); + bm2 = Fassq (bitmap, BUF_FRINGE_INDICATOR_ALIST (&buffer_defaults)); if (CONSP (bm2)) { if ((bm2 = XCDR (bm2)), !NILP (bm2)) @@ -964,7 +964,7 @@ update_window_fringes (w, keep_current_p) return 0; if (!MINI_WINDOW_P (w) - && (ind = XBUFFER (w->buffer)->indicate_buffer_boundaries, !NILP (ind))) + && (ind = BUF_INDICATE_BUFFER_BOUNDARIES (XBUFFER (w->buffer)), !NILP (ind))) { if (EQ (ind, Qleft) || EQ (ind, Qright)) boundary_top = boundary_bot = arrow_top = arrow_bot = ind; @@ -1040,7 +1040,7 @@ update_window_fringes (w, keep_current_p) } } - empty_pos = XBUFFER (w->buffer)->indicate_empty_lines; + empty_pos = BUF_INDICATE_EMPTY_LINES (XBUFFER (w->buffer)); if (!NILP (empty_pos) && !EQ (empty_pos, Qright)) empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft; diff --git a/src/hack-buffer-objfwd.el b/src/hack-buffer-objfwd.el new file mode 100644 index 00000000000..ee0f06bb602 --- /dev/null +++ b/src/hack-buffer-objfwd.el @@ -0,0 +1,206 @@ +;; Rewrite all references to buffer-objfwd fields in struct buffer +;; to use accessor macros. +;; This works in a tricky way: it renames all such fields, then +;; recompiles Emacs. Then it visits each error location and +;; rewrites the expressions. +;; This has a few requirements in order to work. +;; First, Emacs must compile before the script is run. +;; It does not handle errors arising for other reasons. +;; Second, you need a GCC which has been hacked to emit proper +;; column location even when the -> expression in question has +;; been wrapped in a macro call. (This is a one-liner in libcpp.) +;; After running this script, a few changes need to be made by hand. +;; These occur mostly in macros in headers, but also in +;; reset_buffer and reset_buffer_local_variables. + +(defvar gcc-prefix "/home/tromey/gnu/Trunk/install/") + +(defvar emacs-src "/home/tromey/gnu/Emacs/Gitorious/emacs-mt/src/") +(defvar emacs-build "/home/tromey/gnu/Emacs/Gitorious/build/src/") + +(defun file-error (text) + (error "%s:%d:%d: error: expected %s" + buffer-file-name (line-number-at-pos (point)) + (current-column) + text)) + +(defun assert-looking-at (exp) + (unless (looking-at exp) + (file-error exp))) + +(defvar field-names nil) + +(defvar field-regexp nil) + +(defun modify-buffer.h () + (message "Modifying fields in struct buffer") + (find-file (expand-file-name "buffer.h" emacs-src)) + (goto-char (point-min)) + (re-search-forward "^struct buffer$") + (forward-line) + (assert-looking-at "^{") + (let ((starting-point (point)) + (closing-brace (save-excursion + (forward-sexp) + (point)))) + ;; Find each field. + (while (re-search-forward "^\\s *Lisp_Object\\s +" + closing-brace 'move) + (goto-char (match-end 0)) + (while (not (looking-at ";")) + (assert-looking-at "\\([A-Za-z0-9_]+\\)\\(;\\|,\\s *\\)") + ;; Remember the name so we can generate accessors. + (push (match-string 1) field-names) + ;; Rename it. + (goto-char (match-beginning 2)) + (insert "_") + ;; On to the next one, if any. + (if (looking-at ",\\s *") + (goto-char (match-end 0))))) + ;; Generate accessors. + (goto-char starting-point) + (forward-sexp) + (forward-line) + (insert "\n") + (dolist (name field-names) + (insert "#define BUF_" (upcase name) "(BUF) " + "*find_variable_location (&((BUF)->" + name "_))\n")) + (insert "\n")) + (setq field-regexp (concat "\\(->\\|\\.\\)" + (regexp-opt field-names t) + "\\_>")) + (save-buffer)) + +(defun get-field-name () + (save-excursion + (assert-looking-at "\\(\\.\\|->\\)\\([A-Za-z0-9_]+\\)\\_>") + (prog1 + (match-string 2) + (delete-region (match-beginning 0) (match-end 0))))) + +(defun skip-backward-lhs () + (skip-chars-backward " \t\n") + (cond + ((eq (char-before) ?\]) + (file-error "array ref!") + ;; fixme + ) + ((eq (char-before) ?\)) + ;; A paren expression is preceding. + ;; See if this is just a paren expression or whether it is a + ;; function call. + ;; For now assume that there are no function-calls-via-expr. + (backward-sexp) + (skip-chars-backward " \t\n") + (if (save-excursion + (backward-char) + (looking-at "[A-Za-z0-9_]")) + (backward-sexp))) + ((save-excursion + (backward-char) + (looking-at "[A-Za-z0-9_]")) + (backward-sexp)) + (t + (file-error "unhandled case!")))) + +(defun do-fix-instance () + (cond + ((looking-at "->") + (let ((field-name (get-field-name))) + (insert ")") + (backward-char) + (skip-backward-lhs) + (insert "BUF_" (upcase field-name) " ("))) + ((eq (char-after) ?.) + (let ((field-name (get-field-name))) + (insert ")") + (backward-char) + (backward-sexp) + (assert-looking-at "\\(buffer_defaults\\|buffer_local_flags\\)") + (insert "BUF_" (upcase field-name) " (&"))) + (t + (message "%s:%d:%d: warning: did not see -> or ., probably macro" + buffer-file-name (line-number-at-pos (point)) + (current-column))))) + +(defun update-header-files () + (dolist (file (directory-files emacs-src t "h$")) + (message "Applying header changes to %s" file) + (find-file file) + (while (re-search-forward + "\\(current_buffer->\\|buffer_defaults\\.\\)" + nil 'move) + (goto-char (match-end 0)) + (skip-chars-backward "->.") + (when (looking-at field-regexp) + (do-fix-instance))) + (goto-char (point-min)) + (while (search-forward "XBUFFER (" nil 'move) + (goto-char (- (match-end 0) 1)) + (forward-sexp) + ;; This works even for the new #define BUF_ macros + ;; because the field-regexp ends with \_>. + (when (looking-at field-regexp) + (do-fix-instance))) + (save-buffer))) + +(defun fix-one-instance (filename line column) + (message "%s:%d:%d: info: fixing instance" filename line column) + (find-file filename) + (goto-char (point-min)) + (forward-line (- line 1)) + ;; (move-to-column (- column 1)) + (forward-char (- column 1)) + (do-fix-instance)) + +(defvar make-accumulation "") + +(defvar last-error-line nil) +(defvar error-list nil) + +(defun make-filter (process string) + (setq make-accumulation (concat make-accumulation string)) + (while (string-match "^[^\n]*\n" make-accumulation) + (let ((line (substring (match-string 0 make-accumulation) 0 -1))) + (setq make-accumulation (substring make-accumulation + (match-end 0))) + (message "%s" line) + (if (string-match "^\\([^:]+\\):\\([0-9]+\\):\\([0-9]+\\)+: error:" + line) + (save-excursion + (let ((file-name (match-string 1 line)) + (line-no (string-to-number (match-string 2 line))) + (col-no (string-to-number (match-string 3 line)))) + ;; Process all errors on a given line in reverse order. + (unless (eq line-no last-error-line) + (dolist (one-item error-list) + (apply #'fix-one-instance one-item)) + (setq error-list nil) + (setq last-error-line line-no)) + (push (list file-name line-no col-no) error-list))))))) + +(defvar make-done nil) + +(defun make-sentinel (process string) + (dolist (one-item error-list) + (apply #'fix-one-instance one-item)) + (setq make-done t)) + +(defun recompile-emacs () + (let* ((default-directory emacs-build) + (output-buffer (get-buffer-create "*recompile*")) + (make (start-process "make" output-buffer "make" "-k"))) + (set-process-filter make #'make-filter) + (set-process-sentinel make #'make-sentinel) + (while (not make-done) + (accept-process-output)))) + +(modify-buffer.h) +(update-header-files) +(recompile-emacs) +(dolist (buf (buffer-list)) + (with-current-buffer buf + (when buffer-file-name + (message "Saving %s" buffer-file-name) + (save-buffer)))) diff --git a/src/indent.c b/src/indent.c index a7f41f7e8e4..1238872b22b 100644 --- a/src/indent.c +++ b/src/indent.c @@ -76,7 +76,7 @@ buffer_display_table () { Lisp_Object thisbuf; - thisbuf = current_buffer->display_table; + thisbuf = BUF_DISPLAY_TABLE (current_buffer); if (DISP_TABLE_P (thisbuf)) return XCHAR_TABLE (thisbuf); if (DISP_TABLE_P (Vstandard_display_table)) @@ -152,9 +152,9 @@ recompute_width_table (buf, disptab) int i; struct Lisp_Vector *widthtab; - if (!VECTORP (buf->width_table)) - buf->width_table = Fmake_vector (make_number (256), make_number (0)); - widthtab = XVECTOR (buf->width_table); + if (!VECTORP (BUF_WIDTH_TABLE (buf))) + BUF_WIDTH_TABLE (buf) = Fmake_vector (make_number (256), make_number (0)); + widthtab = XVECTOR (BUF_WIDTH_TABLE (buf)); if (widthtab->size != 256) abort (); @@ -168,17 +168,17 @@ recompute_width_table (buf, disptab) static void width_run_cache_on_off () { - if (NILP (current_buffer->cache_long_line_scans) + if (NILP (BUF_CACHE_LONG_LINE_SCANS (current_buffer)) /* And, for the moment, this feature doesn't work on multibyte characters. */ - || !NILP (current_buffer->enable_multibyte_characters)) + || !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) { /* It should be off. */ if (current_buffer->width_run_cache) { free_region_cache (current_buffer->width_run_cache); current_buffer->width_run_cache = 0; - current_buffer->width_table = Qnil; + BUF_WIDTH_TABLE (current_buffer) = Qnil; } } else @@ -345,8 +345,8 @@ current_column () register int tab_seen; int post_tab; register int c; - register int tab_width = XINT (current_buffer->tab_width); - int ctl_arrow = !NILP (current_buffer->ctl_arrow); + register int tab_width = XINT (BUF_TAB_WIDTH (current_buffer)); + int ctl_arrow = !NILP (BUF_CTL_ARROW (current_buffer)); register struct Lisp_Char_Table *dp = buffer_display_table (); if (PT == last_known_column_point @@ -433,7 +433,7 @@ current_column () col++; else if (c == '\n' || (c == '\r' - && EQ (current_buffer->selective_display, Qt))) + && EQ (BUF_SELECTIVE_DISPLAY (current_buffer), Qt))) { ptr++; goto start_of_line_found; @@ -529,10 +529,10 @@ check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos) static void scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) { - register EMACS_INT tab_width = XINT (current_buffer->tab_width); - register int ctl_arrow = !NILP (current_buffer->ctl_arrow); + register EMACS_INT tab_width = XINT (BUF_TAB_WIDTH (current_buffer)); + register int ctl_arrow = !NILP (BUF_CTL_ARROW (current_buffer)); register struct Lisp_Char_Table *dp = buffer_display_table (); - int multibyte = !NILP (current_buffer->enable_multibyte_characters); + int multibyte = !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); struct composition_it cmp_it; Lisp_Object window; struct window *w; @@ -654,7 +654,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) if (c == '\n') goto endloop; - if (c == '\r' && EQ (current_buffer->selective_display, Qt)) + if (c == '\r' && EQ (BUF_SELECTIVE_DISPLAY (current_buffer), Qt)) goto endloop; if (c == '\t') { @@ -672,7 +672,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) if (c == '\n') goto endloop; - if (c == '\r' && EQ (current_buffer->selective_display, Qt)) + if (c == '\r' && EQ (BUF_SELECTIVE_DISPLAY (current_buffer), Qt)) goto endloop; if (c == '\t') { @@ -827,7 +827,7 @@ The return value is COLUMN. */) { int mincol; register int fromcol; - register int tab_width = XINT (current_buffer->tab_width); + register int tab_width = XINT (BUF_TAB_WIDTH (current_buffer)); CHECK_NUMBER (column); if (NILP (minimum)) @@ -891,7 +891,7 @@ position_indentation (pos_byte) register int pos_byte; { register EMACS_INT column = 0; - register EMACS_INT tab_width = XINT (current_buffer->tab_width); + register EMACS_INT tab_width = XINT (BUF_TAB_WIDTH (current_buffer)); register unsigned char *p; register unsigned char *stop; unsigned char *start; @@ -943,7 +943,7 @@ position_indentation (pos_byte) switch (*p++) { case 0240: - if (! NILP (current_buffer->enable_multibyte_characters)) + if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) return column; case ' ': column++; @@ -953,7 +953,7 @@ position_indentation (pos_byte) break; default: if (ASCII_BYTE_P (p[-1]) - || NILP (current_buffer->enable_multibyte_characters)) + || NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) return column; { int c; @@ -1150,13 +1150,13 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width, register EMACS_INT pos; EMACS_INT pos_byte; register int c = 0; - register EMACS_INT tab_width = XFASTINT (current_buffer->tab_width); - register int ctl_arrow = !NILP (current_buffer->ctl_arrow); + register EMACS_INT tab_width = XFASTINT (BUF_TAB_WIDTH (current_buffer)); + register int ctl_arrow = !NILP (BUF_CTL_ARROW (current_buffer)); register struct Lisp_Char_Table *dp = window_display_table (win); int selective - = (INTEGERP (current_buffer->selective_display) - ? XINT (current_buffer->selective_display) - : !NILP (current_buffer->selective_display) ? -1 : 0); + = (INTEGERP (BUF_SELECTIVE_DISPLAY (current_buffer)) + ? XINT (BUF_SELECTIVE_DISPLAY (current_buffer)) + : !NILP (BUF_SELECTIVE_DISPLAY (current_buffer)) ? -1 : 0); int selective_rlen = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp)) ? XVECTOR (DISP_INVIS_VECTOR (dp))->size : 0); @@ -1178,7 +1178,7 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width, EMACS_INT next_width_run = from; Lisp_Object window; - int multibyte = !NILP (current_buffer->enable_multibyte_characters); + int multibyte = !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); /* If previous char scanned was a wide character, this is the column where it ended. Otherwise, this is 0. */ EMACS_INT wide_column_end_hpos = 0; @@ -1197,8 +1197,8 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width, width_run_cache_on_off (); if (dp == buffer_display_table ()) - width_table = (VECTORP (current_buffer->width_table) - ? XVECTOR (current_buffer->width_table)->contents + width_table = (VECTORP (BUF_WIDTH_TABLE (current_buffer)) + ? XVECTOR (BUF_WIDTH_TABLE (current_buffer))->contents : 0); else /* If the window has its own display table, we can't use the width @@ -1364,7 +1364,7 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width, } if (hscroll || truncate - || !NILP (current_buffer->truncate_lines)) + || !NILP (BUF_TRUNCATE_LINES (current_buffer))) { /* Truncating: skip to newline, unless we are already past TO (we need to go back below). */ @@ -1869,9 +1869,9 @@ vmotion (from, vtarget, w) EMACS_INT from_byte; EMACS_INT lmargin = hscroll > 0 ? 1 - hscroll : 0; int selective - = (INTEGERP (current_buffer->selective_display) - ? XINT (current_buffer->selective_display) - : !NILP (current_buffer->selective_display) ? -1 : 0); + = (INTEGERP (BUF_SELECTIVE_DISPLAY (current_buffer)) + ? XINT (BUF_SELECTIVE_DISPLAY (current_buffer)) + : !NILP (BUF_SELECTIVE_DISPLAY (current_buffer)) ? -1 : 0); Lisp_Object window; EMACS_INT start_hpos = 0; int did_motion; diff --git a/src/insdel.c b/src/insdel.c index 68d5316c42c..2f797a22018 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -88,7 +88,7 @@ void check_markers () { register struct Lisp_Marker *tail; - int multibyte = ! NILP (current_buffer->enable_multibyte_characters); + int multibyte = ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next) { @@ -751,7 +751,7 @@ insert_char (int c) unsigned char str[MAX_MULTIBYTE_LENGTH]; int len; - if (! NILP (current_buffer->enable_multibyte_characters)) + if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) len = CHAR_STRING (c, str); else { @@ -939,7 +939,7 @@ insert_1_both (const unsigned char *string, if (nchars == 0) return; - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) nchars = nbytes; if (prepare) @@ -1059,7 +1059,7 @@ insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, /* Make OUTGOING_NBYTES describe the text as it will be inserted in this buffer. */ - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) outgoing_nbytes = nchars; else if (! STRING_MULTIBYTE (string)) outgoing_nbytes @@ -1082,7 +1082,7 @@ insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, between single-byte and multibyte. */ copy_text (SDATA (string) + pos_byte, GPT_ADDR, nbytes, STRING_MULTIBYTE (string), - ! NILP (current_buffer->enable_multibyte_characters)); + ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))); #ifdef BYTE_COMBINING_DEBUG /* We have copied text into the gap, but we have not altered @@ -1142,7 +1142,7 @@ insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, void insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes) { - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) nchars = nbytes; record_insert (GPT, nchars); @@ -1210,9 +1210,9 @@ insert_from_buffer_1 (struct buffer *buf, /* Make OUTGOING_NBYTES describe the text as it will be inserted in this buffer. */ - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) outgoing_nbytes = nchars; - else if (NILP (buf->enable_multibyte_characters)) + else if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (buf))) { EMACS_INT outgoing_before_gap = 0; EMACS_INT outgoing_after_gap = 0; @@ -1263,8 +1263,8 @@ insert_from_buffer_1 (struct buffer *buf, chunk_expanded = copy_text (BUF_BYTE_ADDRESS (buf, from_byte), GPT_ADDR, chunk, - ! NILP (buf->enable_multibyte_characters), - ! NILP (current_buffer->enable_multibyte_characters)); + ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (buf)), + ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))); } else chunk_expanded = chunk = 0; @@ -1272,8 +1272,8 @@ insert_from_buffer_1 (struct buffer *buf, if (chunk < incoming_nbytes) copy_text (BUF_BYTE_ADDRESS (buf, from_byte + chunk), GPT_ADDR + chunk_expanded, incoming_nbytes - chunk, - ! NILP (buf->enable_multibyte_characters), - ! NILP (current_buffer->enable_multibyte_characters)); + ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (buf)), + ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))); #ifdef BYTE_COMBINING_DEBUG /* We have copied text into the gap, but we have not altered @@ -1368,7 +1368,7 @@ adjust_after_replace (EMACS_INT from, EMACS_INT from_byte, adjust_markers_for_insert (from, from_byte, from + len, from_byte + len_byte, 0); - if (! EQ (current_buffer->undo_list, Qt)) + if (! EQ (BUF_UNDO_LIST (current_buffer), Qt)) { if (nchars_del > 0) record_delete (from, prev_text); @@ -1529,7 +1529,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new, /* Make OUTGOING_INSBYTES describe the text as it will be inserted in this buffer. */ - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) outgoing_insbytes = inschars; else if (! STRING_MULTIBYTE (new)) outgoing_insbytes @@ -1551,7 +1551,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new, /* Even if we don't record for undo, we must keep the original text because we may have to recover it because of inappropriate byte combining. */ - if (! EQ (current_buffer->undo_list, Qt)) + if (! EQ (BUF_UNDO_LIST (current_buffer), Qt)) deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1); GAP_SIZE += nbytes_del; @@ -1578,7 +1578,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new, between single-byte and multibyte. */ copy_text (SDATA (new), GPT_ADDR, insbytes, STRING_MULTIBYTE (new), - ! NILP (current_buffer->enable_multibyte_characters)); + ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))); #ifdef BYTE_COMBINING_DEBUG /* We have copied text into the gap, but we have not marked @@ -1591,7 +1591,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new, abort (); #endif - if (! EQ (current_buffer->undo_list, Qt)) + if (! EQ (BUF_UNDO_LIST (current_buffer), Qt)) { /* Record the insertion first, so that when we undo, the deletion will be undone first. Thus, undo @@ -1934,7 +1934,7 @@ del_range_2 (EMACS_INT from, EMACS_INT from_byte, abort (); #endif - if (ret_string || ! EQ (current_buffer->undo_list, Qt)) + if (ret_string || ! EQ (BUF_UNDO_LIST (current_buffer), Qt)) deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1); else deletion = Qnil; @@ -1945,7 +1945,7 @@ del_range_2 (EMACS_INT from, EMACS_INT from_byte, so that undo handles this after reinserting the text. */ adjust_markers_for_delete (from, from_byte, to, to_byte); - if (! EQ (current_buffer->undo_list, Qt)) + if (! EQ (BUF_UNDO_LIST (current_buffer), Qt)) record_delete (from, deletion); MODIFF++; CHARS_MODIFF = MODIFF; @@ -2016,7 +2016,7 @@ modify_region (struct buffer *buffer, EMACS_INT start, EMACS_INT end, if (! preserve_chars_modiff) CHARS_MODIFF = MODIFF; - buffer->point_before_scroll = Qnil; + BUF_POINT_BEFORE_SCROLL (buffer) = Qnil; if (buffer != old_buffer) set_buffer_internal (old_buffer); @@ -2038,7 +2038,7 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end, { struct buffer *base_buffer; - if (!NILP (current_buffer->read_only)) + if (!NILP (BUF_READ_ONLY (current_buffer))) Fbarf_if_buffer_read_only (); /* Let redisplay consider other windows than selected_window @@ -2070,11 +2070,11 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end, base_buffer = current_buffer; #ifdef CLASH_DETECTION - if (!NILP (base_buffer->file_truename) + if (!NILP (BUF_FILE_TRUENAME (base_buffer)) /* Make binding buffer-file-name to nil effective. */ - && !NILP (base_buffer->filename) + && !NILP (BUF_FILENAME (base_buffer)) && SAVE_MODIFF >= MODIFF) - lock_file (base_buffer->file_truename); + lock_file (BUF_FILE_TRUENAME (base_buffer)); #else /* At least warn if this file has changed on disk since it was visited. */ if (!NILP (base_buffer->filename) @@ -2322,7 +2322,7 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute, non-nil, and insertion calls a file handler (e.g. through lock_file) which scribbles into a temp file -- cyd */ if (!BUFFERP (combine_after_change_buffer) - || NILP (XBUFFER (combine_after_change_buffer)->name)) + || NILP (BUF_NAME (XBUFFER (combine_after_change_buffer)))) { combine_after_change_list = Qnil; return Qnil; diff --git a/src/intervals.c b/src/intervals.c index 9836f763489..cc50ed72915 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -2026,7 +2026,7 @@ set_point_both (EMACS_INT charpos, EMACS_INT bytepos) int have_overlays; EMACS_INT original_position; - current_buffer->point_before_scroll = Qnil; + BUF_POINT_BEFORE_SCROLL (current_buffer) = Qnil; if (charpos == PT) return; @@ -2396,7 +2396,7 @@ get_local_map (position, buffer, type) if (EQ (type, Qkeymap)) return Qnil; else - return buffer->keymap; + return BUF_KEYMAP (buffer); } /* Produce an interval tree reflecting the intervals in diff --git a/src/intervals.h b/src/intervals.h index a0e4c5fe059..172acd6dfa5 100644 --- a/src/intervals.h +++ b/src/intervals.h @@ -237,9 +237,9 @@ struct interval and 2 if it is invisible but with an ellipsis. */ #define TEXT_PROP_MEANS_INVISIBLE(prop) \ - (EQ (current_buffer->invisibility_spec, Qt) \ + (EQ (BUF_INVISIBILITY_SPEC (current_buffer), Qt) \ ? !NILP (prop) \ - : invisible_p (prop, current_buffer->invisibility_spec)) + : invisible_p (prop, BUF_INVISIBILITY_SPEC (current_buffer))) /* Declared in alloc.c */ diff --git a/src/keyboard.c b/src/keyboard.c index 4f9a77d1ba6..5fcb50a2d8a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1786,7 +1786,7 @@ command_loop_1 () && (XFASTINT (XWINDOW (selected_window)->last_point) == PT - 1) && !windows_or_buffers_changed - && EQ (current_buffer->selective_display, Qnil) + && EQ (BUF_SELECTIVE_DISPLAY (current_buffer), Qnil) && !detect_input_pending () && NILP (XWINDOW (selected_window)->column_number_displayed) && NILP (Vexecuting_kbd_macro)) @@ -1823,7 +1823,7 @@ command_loop_1 () && (XFASTINT (XWINDOW (selected_window)->last_point) == PT + 1) && !windows_or_buffers_changed - && EQ (current_buffer->selective_display, Qnil) + && EQ (BUF_SELECTIVE_DISPLAY (current_buffer), Qnil) && !detect_input_pending () && NILP (XWINDOW (selected_window)->column_number_displayed) && NILP (Vexecuting_kbd_macro)) @@ -1858,7 +1858,7 @@ command_loop_1 () != PT) || MODIFF <= SAVE_MODIFF || windows_or_buffers_changed - || !EQ (current_buffer->selective_display, Qnil) + || !EQ (BUF_SELECTIVE_DISPLAY (current_buffer), Qnil) || detect_input_pending () || !NILP (XWINDOW (selected_window)->column_number_displayed) || !NILP (Vexecuting_kbd_macro)); @@ -1955,7 +1955,7 @@ command_loop_1 () this_single_command_key_start = 0; } - if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks)) + if (!NILP (BUF_MARK_ACTIVE (current_buffer)) && !NILP (Vrun_hooks)) { /* In Emacs 22, setting transient-mark-mode to `only' was a way of turning it on for just one command. This usage is @@ -8911,7 +8911,7 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps) /* Prompt with that and read response. */ message2_nolog (menu, strlen (menu), - ! NILP (current_buffer->enable_multibyte_characters)); + ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))); /* Make believe its not a keyboard macro in case the help char is pressed. Help characters are not recorded because menu prompting @@ -10177,7 +10177,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, /* Treat uppercase keys as shifted. */ || (INTEGERP (key) && (KEY_TO_CHAR (key) - < XCHAR_TABLE (current_buffer->downcase_table)->size) + < XCHAR_TABLE (BUF_DOWNCASE_TABLE (current_buffer))->size) && UPPERCASEP (KEY_TO_CHAR (key)))) { Lisp_Object new_key diff --git a/src/keymap.c b/src/keymap.c index 9a30927c177..f6f47db23f5 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1982,7 +1982,7 @@ bindings; see the description of `lookup-key' for more details about this. */) Lisp_Object keys, accept_default; { register Lisp_Object map; - map = current_buffer->keymap; + map = BUF_KEYMAP (current_buffer); if (NILP (map)) return Qnil; return Flookup_key (map, keys, accept_default); @@ -2092,7 +2092,7 @@ If KEYMAP is nil, that means no local keymap. */) if (!NILP (keymap)) keymap = get_keymap (keymap, 1, 1); - current_buffer->keymap = keymap; + BUF_KEYMAP (current_buffer) = keymap; return Qnil; } @@ -2102,7 +2102,7 @@ DEFUN ("current-local-map", Fcurrent_local_map, Scurrent_local_map, 0, 0, 0, Normally the local keymap is set by the major mode with `use-local-map'. */) () { - return current_buffer->keymap; + return BUF_KEYMAP (current_buffer); } DEFUN ("current-global-map", Fcurrent_global_map, Scurrent_global_map, 0, 0, 0, @@ -2490,7 +2490,7 @@ push_key_description (c, p, force_multibyte) *p++ = 'C'; } else if (c < 128 - || (NILP (current_buffer->enable_multibyte_characters) + || (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) && SINGLE_BYTE_CHAR_P (c) && !force_multibyte)) { @@ -2499,7 +2499,7 @@ push_key_description (c, p, force_multibyte) else { /* Now we are sure that C is a valid character code. */ - if (NILP (current_buffer->enable_multibyte_characters) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) && ! force_multibyte) *p++ = multibyte_char_to_unibyte (c, Qnil); else @@ -3163,7 +3163,7 @@ You type Translation\n\ XBUFFER (buffer), Qlocal_map); if (!NILP (start1)) { - if (EQ (start1, XBUFFER (buffer)->keymap)) + if (EQ (start1, BUF_KEYMAP (XBUFFER (buffer)))) describe_map_tree (start1, 1, shadow, prefix, "\f\nMajor Mode Bindings", nomenu, 0, 0, 0); else diff --git a/src/lisp.h b/src/lisp.h index 32ec9cc548b..0d27c55efce 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -1975,11 +1975,11 @@ extern Lisp_Object case_temp2; /* Current buffer's map from characters to lower-case characters. */ -#define DOWNCASE_TABLE current_buffer->downcase_table +#define DOWNCASE_TABLE BUF_DOWNCASE_TABLE (current_buffer) /* Current buffer's map from characters to upper-case characters. */ -#define UPCASE_TABLE current_buffer->upcase_table +#define UPCASE_TABLE BUF_UPCASE_TABLE (current_buffer) /* Downcase a character, or make no change if that cannot be done. */ diff --git a/src/lread.c b/src/lread.c index b49e8a3b62e..075c87cb4e2 100644 --- a/src/lread.c +++ b/src/lread.c @@ -298,7 +298,7 @@ readchar (readcharfun, multibyte) if (pt_byte >= BUF_ZV_BYTE (inbuffer)) return -1; - if (! NILP (inbuffer->enable_multibyte_characters)) + if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (inbuffer))) { /* Fetch the character code from the buffer. */ unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, pt_byte); @@ -327,7 +327,7 @@ readchar (readcharfun, multibyte) if (bytepos >= BUF_ZV_BYTE (inbuffer)) return -1; - if (! NILP (inbuffer->enable_multibyte_characters)) + if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (inbuffer))) { /* Fetch the character code from the buffer. */ unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, bytepos); @@ -461,7 +461,7 @@ unreadchar (readcharfun, c) int bytepos = BUF_PT_BYTE (b); BUF_PT (b)--; - if (! NILP (b->enable_multibyte_characters)) + if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (b))) BUF_DEC_POS (b, bytepos); else bytepos--; @@ -474,7 +474,7 @@ unreadchar (readcharfun, c) int bytepos = XMARKER (readcharfun)->bytepos; XMARKER (readcharfun)->charpos--; - if (! NILP (b->enable_multibyte_characters)) + if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (b))) BUF_DEC_POS (b, bytepos); else bytepos--; @@ -1438,7 +1438,7 @@ openp (path, str, suffixes, storeptr, predicate) /* Of course, this could conceivably lose if luser sets default-directory to be something non-absolute... */ { - filename = Fexpand_file_name (filename, current_buffer->directory); + filename = Fexpand_file_name (filename, BUF_DIRECTORY (current_buffer)); if (!complete_filename_p (filename)) /* Give up on this path element! */ continue; @@ -1703,7 +1703,7 @@ readevalloop (readcharfun, stream, sourcename, evalfun, { int count1 = SPECPDL_INDEX (); - if (b != 0 && NILP (b->name)) + if (b != 0 && NILP (BUF_NAME (b))) error ("Reading from killed buffer"); if (!NILP (start)) @@ -1844,7 +1844,7 @@ This function preserves the position of point. */) tem = printflag; if (NILP (filename)) - filename = XBUFFER (buf)->filename; + filename = BUF_FILENAME (XBUFFER (buf)); specbind (Qeval_buffer_list, Fcons (buf, Veval_buffer_list)); specbind (Qstandard_output, tem); @@ -1885,7 +1885,7 @@ This function does not move point. */) specbind (Qeval_buffer_list, Fcons (cbuf, Veval_buffer_list)); /* readevalloop calls functions which check the type of start and end. */ - readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, Feval, + readevalloop (cbuf, 0, BUF_FILENAME (XBUFFER (cbuf)), Feval, !NILP (printflag), Qnil, read_function, start, end); diff --git a/src/marker.c b/src/marker.c index b3381f9c369..99a8fc4d52a 100644 --- a/src/marker.c +++ b/src/marker.c @@ -506,7 +506,7 @@ Returns MARKER. */) CHECK_BUFFER (buffer); b = XBUFFER (buffer); /* If buffer is dead, set marker to point nowhere. */ - if (EQ (b->name, Qnil)) + if (EQ (BUF_NAME (b), Qnil)) { unchain_marker (m); return marker; @@ -582,7 +582,7 @@ set_marker_restricted (marker, pos, buffer) CHECK_BUFFER (buffer); b = XBUFFER (buffer); /* If buffer is dead, set marker to point nowhere. */ - if (EQ (b->name, Qnil)) + if (EQ (BUF_NAME (b), Qnil)) { unchain_marker (m); return marker; @@ -649,7 +649,7 @@ set_marker_both (marker, buffer, charpos, bytepos) CHECK_BUFFER (buffer); b = XBUFFER (buffer); /* If buffer is dead, set marker to point nowhere. */ - if (EQ (b->name, Qnil)) + if (EQ (BUF_NAME (b), Qnil)) { unchain_marker (m); return marker; @@ -699,7 +699,7 @@ set_marker_restricted_both (marker, buffer, charpos, bytepos) CHECK_BUFFER (buffer); b = XBUFFER (buffer); /* If buffer is dead, set marker to point nowhere. */ - if (EQ (b->name, Qnil)) + if (EQ (BUF_NAME (b), Qnil)) { unchain_marker (m); return marker; @@ -755,7 +755,7 @@ unchain_marker (marker) if (b == 0) return; - if (EQ (b->name, Qnil)) + if (EQ (BUF_NAME (b), Qnil)) abort (); marker->buffer = 0; diff --git a/src/minibuf.c b/src/minibuf.c index 42920eabb78..c6f62f52e26 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -503,7 +503,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, CHECK_STRING (initial); } val = Qnil; - ambient_dir = current_buffer->directory; + ambient_dir = BUF_DIRECTORY (current_buffer); input_method = Qnil; enable_multibyte = Qnil; @@ -617,7 +617,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, /* `current-input-method' is buffer local. So, remember it in INPUT_METHOD before changing the current buffer. */ input_method = Fsymbol_value (Qcurrent_input_method); - enable_multibyte = current_buffer->enable_multibyte_characters; + enable_multibyte = BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer); } /* Switch to the minibuffer. */ @@ -627,7 +627,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ if (inherit_input_method) - current_buffer->enable_multibyte_characters = enable_multibyte; + BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer) = 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 @@ -638,7 +638,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, you think of something better to do? Find another buffer with a better directory, and use that one instead. */ if (STRINGP (ambient_dir)) - current_buffer->directory = ambient_dir; + BUF_DIRECTORY (current_buffer) = ambient_dir; else { Lisp_Object buf_list; @@ -650,9 +650,9 @@ read_minibuf (map, initial, prompt, backup_n, expflag, Lisp_Object other_buf; other_buf = XCDR (XCAR (buf_list)); - if (STRINGP (XBUFFER (other_buf)->directory)) + if (STRINGP (BUF_DIRECTORY (XBUFFER (other_buf)))) { - current_buffer->directory = XBUFFER (other_buf)->directory; + BUF_DIRECTORY (current_buffer) = BUF_DIRECTORY (XBUFFER (other_buf)); break; } } @@ -695,7 +695,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, specbind (Qinhibit_modification_hooks, Qt); Ferase_buffer (); - if (!NILP (current_buffer->enable_multibyte_characters) + if (!NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) && ! STRING_MULTIBYTE (minibuf_prompt)) minibuf_prompt = Fstring_make_multibyte (minibuf_prompt); @@ -725,7 +725,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, } clear_message (1, 1); - current_buffer->keymap = map; + BUF_KEYMAP (current_buffer) = map; /* Turn on an input method stored in INPUT_METHOD if any. */ if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method))) @@ -739,7 +739,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, call1 (Vrun_hooks, Qminibuffer_setup_hook); /* Don't allow the user to undo past this point. */ - current_buffer->undo_list = Qnil; + BUF_UNDO_LIST (current_buffer) = Qnil; recursive_edit_1 (); @@ -858,7 +858,7 @@ get_minibuffer (depth) Vminibuffer_list = nconc2 (Vminibuffer_list, tail); } buf = Fcar (tail); - if (NILP (buf) || NILP (XBUFFER (buf)->name)) + if (NILP (buf) || NILP (BUF_NAME (XBUFFER (buf)))) { sprintf (name, " *Minibuf-%d*", depth); buf = Fget_buffer_create (build_string (name)); @@ -1203,7 +1203,7 @@ function, instead of the usual behavior. */) int count = SPECPDL_INDEX (); if (BUFFERP (def)) - def = XBUFFER (def)->name; + def = BUF_NAME (XBUFFER (def)); specbind (Qcompletion_ignore_case, read_buffer_completion_ignore_case ? Qt : Qnil); diff --git a/src/print.c b/src/print.c index 96e261f795d..d8815ec4014 100644 --- a/src/print.c +++ b/src/print.c @@ -189,7 +189,7 @@ int print_output_debug_flag = 1; int old_point_byte = -1, start_point_byte = -1; \ int specpdl_count = SPECPDL_INDEX (); \ int free_print_buffer = 0; \ - int multibyte = !NILP (current_buffer->enable_multibyte_characters); \ + int multibyte = !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); \ Lisp_Object original #define PRINTPREPARE \ @@ -222,10 +222,10 @@ int print_output_debug_flag = 1; if (NILP (printcharfun)) \ { \ Lisp_Object string; \ - if (NILP (current_buffer->enable_multibyte_characters) \ + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) \ && ! print_escape_multibyte) \ specbind (Qprint_escape_multibyte, Qt); \ - if (! NILP (current_buffer->enable_multibyte_characters) \ + if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) \ && ! print_escape_nonascii) \ specbind (Qprint_escape_nonascii, Qt); \ if (print_buffer != 0) \ @@ -251,7 +251,7 @@ int print_output_debug_flag = 1; if (NILP (printcharfun)) \ { \ if (print_buffer_pos != print_buffer_pos_byte \ - && NILP (current_buffer->enable_multibyte_characters)) \ + && NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) \ { \ unsigned char *temp \ = (unsigned char *) alloca (print_buffer_pos + 1); \ @@ -331,7 +331,7 @@ printchar (ch, fun) else { int multibyte_p - = !NILP (current_buffer->enable_multibyte_characters); + = !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); setup_echo_area_for_printing (multibyte_p); insert_char (ch); @@ -386,7 +386,7 @@ strout (ptr, size, size_byte, printcharfun, multibyte) job. */ int i; int multibyte_p - = !NILP (current_buffer->enable_multibyte_characters); + = !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); setup_echo_area_for_printing (multibyte_p); message_dolog (ptr, size_byte, 0, multibyte_p); @@ -455,8 +455,8 @@ print_string (string, printcharfun) chars = SCHARS (string); else if (! print_escape_nonascii && (EQ (printcharfun, Qt) - ? ! NILP (buffer_defaults.enable_multibyte_characters) - : ! NILP (current_buffer->enable_multibyte_characters))) + ? ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (&buffer_defaults)) + : ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)))) { /* If unibyte string STRING contains 8-bit codes, we must convert STRING to a multibyte string containing the same @@ -595,14 +595,14 @@ temp_output_buffer_setup (bufname) Fkill_all_local_variables (); delete_all_overlays (current_buffer); - current_buffer->directory = old->directory; - current_buffer->read_only = Qnil; - current_buffer->filename = Qnil; - current_buffer->undo_list = Qt; + BUF_DIRECTORY (current_buffer) = BUF_DIRECTORY (old); + BUF_READ_ONLY (current_buffer) = Qnil; + BUF_FILENAME (current_buffer) = Qnil; + BUF_UNDO_LIST (current_buffer) = Qt; eassert (current_buffer->overlays_before == NULL); eassert (current_buffer->overlays_after == NULL); - current_buffer->enable_multibyte_characters - = buffer_defaults.enable_multibyte_characters; + BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer) + = BUF_ENABLE_MULTIBYTE_CHARACTERS (&buffer_defaults); specbind (Qinhibit_read_only, Qt); specbind (Qinhibit_modification_hooks, Qt); Ferase_buffer (); @@ -2019,7 +2019,7 @@ print_object (obj, printcharfun, escapeflag) if (!NILP (XWINDOW (obj)->buffer)) { strout (" on ", -1, -1, printcharfun, 0); - print_string (XBUFFER (XWINDOW (obj)->buffer)->name, printcharfun); + print_string (BUF_NAME (XBUFFER (XWINDOW (obj)->buffer)), printcharfun); } PRINTCHAR ('>'); } @@ -2119,16 +2119,16 @@ print_object (obj, printcharfun, escapeflag) } else if (BUFFERP (obj)) { - if (NILP (XBUFFER (obj)->name)) + if (NILP (BUF_NAME (XBUFFER (obj)))) strout ("#", -1, -1, printcharfun, 0); else if (escapeflag) { strout ("#name, printcharfun); + print_string (BUF_NAME (XBUFFER (obj)), printcharfun); PRINTCHAR ('>'); } else - print_string (XBUFFER (obj)->name, printcharfun); + print_string (BUF_NAME (XBUFFER (obj)), printcharfun); } else if (WINDOW_CONFIGURATIONP (obj)) { @@ -2240,7 +2240,7 @@ print_object (obj, printcharfun, escapeflag) sprintf (buf, "at %d", marker_position (obj)); strout (buf, -1, -1, printcharfun, 0); strout (" in ", -1, -1, printcharfun, 0); - print_string (XMARKER (obj)->buffer->name, printcharfun); + print_string (BUF_NAME (XMARKER (obj)->buffer), printcharfun); } PRINTCHAR ('>'); break; @@ -2255,7 +2255,7 @@ print_object (obj, printcharfun, escapeflag) marker_position (OVERLAY_START (obj)), marker_position (OVERLAY_END (obj))); strout (buf, -1, -1, printcharfun, 0); - print_string (XMARKER (OVERLAY_START (obj))->buffer->name, + print_string (BUF_NAME (XMARKER (OVERLAY_START (obj))->buffer), printcharfun); } PRINTCHAR ('>'); diff --git a/src/process.c b/src/process.c index 4743103b145..ef6dec7beb3 100644 --- a/src/process.c +++ b/src/process.c @@ -675,7 +675,7 @@ setup_process_coding_systems (process) ; else if (BUFFERP (p->buffer)) { - if (NILP (XBUFFER (p->buffer)->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (XBUFFER (p->buffer)))) coding_system = raw_text_coding_system (coding_system); } setup_coding_system (coding_system, proc_decode_coding_system[inch]); @@ -756,7 +756,7 @@ get_process (name) { proc = Fget_buffer_process (obj); if (NILP (proc)) - error ("Buffer %s has no process", SDATA (XBUFFER (obj)->name)); + error ("Buffer %s has no process", SDATA (BUF_NAME (XBUFFER (obj)))); } else { @@ -1361,12 +1361,12 @@ list_processes_1 (query_only) w_proc = i; if (!NILP (p->buffer)) { - if (NILP (XBUFFER (p->buffer)->name)) + if (NILP (BUF_NAME (XBUFFER (p->buffer)))) { if (w_buffer < 8) w_buffer = 8; /* (Killed) */ } - else if ((i = SCHARS (XBUFFER (p->buffer)->name), (i > w_buffer))) + else if ((i = SCHARS (BUF_NAME (XBUFFER (p->buffer))), (i > w_buffer))) w_buffer = i; } if (STRINGP (p->tty_name) @@ -1390,9 +1390,9 @@ list_processes_1 (query_only) XSETFASTINT (minspace, 1); set_buffer_internal (XBUFFER (Vstandard_output)); - current_buffer->undo_list = Qt; + BUF_UNDO_LIST (current_buffer) = Qt; - current_buffer->truncate_lines = Qt; + BUF_TRUNCATE_LINES (current_buffer) = Qt; write_string ("Proc", -1); Findent_to (i_status, minspace); write_string ("Status", -1); @@ -1475,10 +1475,10 @@ list_processes_1 (query_only) Findent_to (i_buffer, minspace); if (NILP (p->buffer)) insert_string ("(none)"); - else if (NILP (XBUFFER (p->buffer)->name)) + else if (NILP (BUF_NAME (XBUFFER (p->buffer)))) insert_string ("(Killed)"); else - Finsert (1, &XBUFFER (p->buffer)->name); + Finsert (1, &BUF_NAME (XBUFFER (p->buffer))); if (!NILP (i_tty)) { @@ -1629,7 +1629,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) { struct gcpro gcpro1, gcpro2; - current_dir = current_buffer->directory; + current_dir = BUF_DIRECTORY (current_buffer); GCPRO2 (buffer, current_dir); @@ -1641,7 +1641,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) current_dir = expand_and_dir_to_file (current_dir, Qnil); if (NILP (Ffile_accessible_directory_p (current_dir))) report_file_error ("Setting current directory", - Fcons (current_buffer->directory, Qnil)); + Fcons (BUF_DIRECTORY (current_buffer), Qnil)); UNGCPRO; } @@ -3029,8 +3029,8 @@ usage: (make-serial-process &rest ARGS) */) } else if (!NILP (Vcoding_system_for_read)) val = Vcoding_system_for_read; - else if ((!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters)) - || (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters))) + else if ((!NILP (buffer) && NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (XBUFFER (buffer)))) + || (NILP (buffer) && NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (&buffer_defaults)))) val = Qnil; p->decode_coding_system = val; @@ -3043,8 +3043,8 @@ usage: (make-serial-process &rest ARGS) */) } else if (!NILP (Vcoding_system_for_write)) val = Vcoding_system_for_write; - else if ((!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters)) - || (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters))) + else if ((!NILP (buffer) && NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (XBUFFER (buffer)))) + || (NILP (buffer) && NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (&buffer_defaults)))) val = Qnil; p->encode_coding_system = val; @@ -3839,8 +3839,8 @@ usage: (make-network-process &rest ARGS) */) } else if (!NILP (Vcoding_system_for_read)) val = Vcoding_system_for_read; - else if ((!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters)) - || (NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters))) + else if ((!NILP (buffer) && NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (XBUFFER (buffer)))) + || (NILP (buffer) && NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (&buffer_defaults)))) /* We dare not decode end-of-line format by setting VAL to Qraw_text, because the existing Emacs Lisp libraries assume that they receive bare code including a sequene of @@ -3875,7 +3875,7 @@ usage: (make-network-process &rest ARGS) */) } else if (!NILP (Vcoding_system_for_write)) val = Vcoding_system_for_write; - else if (NILP (current_buffer->enable_multibyte_characters)) + else if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) val = Qnil; else { @@ -5403,7 +5403,7 @@ read_process_output (proc, channel) is test them for EQness, and none of them should be a string. */ odeactivate = Vdeactivate_mark; XSETBUFFER (obuffer, current_buffer); - okeymap = current_buffer->keymap; + okeymap = BUF_KEYMAP (current_buffer); specbind (Qinhibit_quit, Qt); specbind (Qlast_nonmenu_event, Qt); @@ -5497,7 +5497,7 @@ read_process_output (proc, channel) } /* If no filter, write into buffer if it isn't dead. */ - if (!NILP (p->buffer) && !NILP (XBUFFER (p->buffer)->name)) + if (!NILP (p->buffer) && !NILP (BUF_NAME (XBUFFER (p->buffer)))) { Lisp_Object old_read_only; int old_begv, old_zv; @@ -5515,13 +5515,13 @@ read_process_output (proc, channel) Fset_buffer (p->buffer); opoint = PT; opoint_byte = PT_BYTE; - old_read_only = current_buffer->read_only; + old_read_only = BUF_READ_ONLY (current_buffer); old_begv = BEGV; old_zv = ZV; old_begv_byte = BEGV_BYTE; old_zv_byte = ZV_BYTE; - current_buffer->read_only = Qnil; + BUF_READ_ONLY (current_buffer) = Qnil; /* Insert new output into buffer at the current end-of-output marker, @@ -5566,7 +5566,7 @@ read_process_output (proc, channel) p->decoding_carryover = coding->carryover_bytes; } /* Adjust the multibyteness of TEXT to that of the buffer. */ - if (NILP (current_buffer->enable_multibyte_characters) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) != ! STRING_MULTIBYTE (text)) text = (STRING_MULTIBYTE (text) ? Fstring_as_unibyte (text) @@ -5612,7 +5612,7 @@ read_process_output (proc, channel) /* Handling the process output should not deactivate the mark. */ Vdeactivate_mark = odeactivate; - current_buffer->read_only = old_read_only; + BUF_READ_ONLY (current_buffer) = old_read_only; SET_PT_BOTH (opoint, opoint_byte); unbind_to (count, Qnil); } @@ -5679,7 +5679,7 @@ send_process (proc, buf, len, object) if ((STRINGP (object) && STRING_MULTIBYTE (object)) || (BUFFERP (object) - && !NILP (XBUFFER (object)->enable_multibyte_characters)) + && !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (XBUFFER (object)))) || EQ (object, Qt)) { if (!EQ (Vlast_coding_system_used, p->encode_coding_system)) @@ -6842,7 +6842,7 @@ exec_sentinel (proc, reason) is test them for EQness, and none of them should be a string. */ odeactivate = Vdeactivate_mark; XSETBUFFER (obuffer, current_buffer); - okeymap = current_buffer->keymap; + okeymap = BUF_KEYMAP (current_buffer); sentinel = p->sentinel; if (NILP (sentinel)) @@ -6986,11 +6986,11 @@ status_notify (deleting_process) int opoint, opoint_byte; int before, before_byte; - ro = XBUFFER (buffer)->read_only; + ro = BUF_READ_ONLY (XBUFFER (buffer)); /* Avoid error if buffer is deleted (probably that's why the process is dead, too) */ - if (NILP (XBUFFER (buffer)->name)) + if (NILP (BUF_NAME (XBUFFER (buffer)))) continue; Fset_buffer (buffer); @@ -7007,13 +7007,13 @@ status_notify (deleting_process) before = PT; before_byte = PT_BYTE; - tem = current_buffer->read_only; - current_buffer->read_only = Qnil; + tem = BUF_READ_ONLY (current_buffer); + BUF_READ_ONLY (current_buffer) = Qnil; insert_string ("\nProcess "); Finsert (1, &p->name); insert_string (" "); Finsert (1, &msg); - current_buffer->read_only = tem; + BUF_READ_ONLY (current_buffer) = tem; set_marker_both (p->mark, p->buffer, PT, PT_BYTE); if (opoint >= before) diff --git a/src/search.c b/src/search.c index 456e85a4594..e5959460590 100644 --- a/src/search.c +++ b/src/search.c @@ -170,7 +170,7 @@ compile_pattern_1 (cp, pattern, translate, regp, posix) /* If the compiled pattern hard codes some of the contents of the syntax-table, it can only be reused with *this* syntax table. */ - cp->syntax_table = cp->buf.used_syntax ? current_buffer->syntax_table : Qt; + cp->syntax_table = cp->buf.used_syntax ? BUF_SYNTAX_TABLE (current_buffer) : Qt; re_set_whitespace_regexp (NULL); @@ -253,7 +253,7 @@ compile_pattern (pattern, regp, translate, posix, multibyte) && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) && cp->posix == posix && (EQ (cp->syntax_table, Qt) - || EQ (cp->syntax_table, current_buffer->syntax_table)) + || EQ (cp->syntax_table, BUF_SYNTAX_TABLE (current_buffer))) && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp)) && cp->buf.charset_unibyte == charset_unibyte) break; @@ -304,17 +304,17 @@ looking_at_1 (string, posix) save_search_regs (); /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ - XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] - = current_buffer->case_eqv_table; + XCHAR_TABLE (BUF_CASE_CANON_TABLE (current_buffer))->extras[2] + = BUF_CASE_EQV_TABLE (current_buffer); CHECK_STRING (string); bufp = compile_pattern (string, (NILP (Vinhibit_changing_match_data) ? &search_regs : NULL), - (!NILP (current_buffer->case_fold_search) - ? current_buffer->case_canon_table : Qnil), + (!NILP (BUF_CASE_FOLD_SEARCH (current_buffer)) + ? BUF_CASE_CANON_TABLE (current_buffer) : Qnil), posix, - !NILP (current_buffer->enable_multibyte_characters)); + !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))); immediate_quit = 1; QUIT; /* Do a pending quit right away, to avoid paradoxical behavior */ @@ -423,14 +423,14 @@ string_match_1 (regexp, string, start, posix) } /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ - XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] - = current_buffer->case_eqv_table; + XCHAR_TABLE (BUF_CASE_CANON_TABLE (current_buffer))->extras[2] + = BUF_CASE_EQV_TABLE (current_buffer); bufp = compile_pattern (regexp, (NILP (Vinhibit_changing_match_data) ? &search_regs : NULL), - (!NILP (current_buffer->case_fold_search) - ? current_buffer->case_canon_table : Qnil), + (!NILP (BUF_CASE_FOLD_SEARCH (current_buffer)) + ? BUF_CASE_CANON_TABLE (current_buffer) : Qnil), posix, STRING_MULTIBYTE (string)); immediate_quit = 1; @@ -620,7 +620,7 @@ fast_looking_at (regexp, pos, pos_byte, limit, limit_byte, string) s2 = 0; } re_match_object = Qnil; - multibyte = ! NILP (current_buffer->enable_multibyte_characters); + multibyte = ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); } buf = compile_pattern (regexp, 0, Qnil, 0, multibyte); @@ -643,7 +643,7 @@ static void newline_cache_on_off (buf) struct buffer *buf; { - if (NILP (buf->cache_long_line_scans)) + if (NILP (BUF_CACHE_LONG_LINE_SCANS (buf))) { /* It should be off. */ if (buf->newline_cache) @@ -1044,15 +1044,15 @@ search_command (string, bound, noerror, count, direction, RE, posix) } /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ - XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] - = current_buffer->case_eqv_table; + XCHAR_TABLE (BUF_CASE_CANON_TABLE (current_buffer))->extras[2] + = BUF_CASE_EQV_TABLE (current_buffer); np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE, - (!NILP (current_buffer->case_fold_search) - ? current_buffer->case_canon_table + (!NILP (BUF_CASE_FOLD_SEARCH (current_buffer)) + ? BUF_CASE_CANON_TABLE (current_buffer) : Qnil), - (!NILP (current_buffer->case_fold_search) - ? current_buffer->case_eqv_table + (!NILP (BUF_CASE_FOLD_SEARCH (current_buffer)) + ? BUF_CASE_EQV_TABLE (current_buffer) : Qnil), posix); if (np <= 0) @@ -1191,7 +1191,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, (NILP (Vinhibit_changing_match_data) ? &search_regs : &search_regs_1), trt, posix, - !NILP (current_buffer->enable_multibyte_characters)); + !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))); immediate_quit = 1; /* Quit immediately if user types ^G, because letting this function finish @@ -1312,7 +1312,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, int raw_pattern_size; int raw_pattern_size_byte; unsigned char *patbuf; - int multibyte = !NILP (current_buffer->enable_multibyte_characters); + int multibyte = !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); unsigned char *base_pat; /* Set to positive if we find a non-ASCII char that need translation. Otherwise set to zero later. */ @@ -1512,7 +1512,7 @@ simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte) EMACS_INT pos, pos_byte; EMACS_INT lim, lim_byte; { - int multibyte = ! NILP (current_buffer->enable_multibyte_characters); + int multibyte = ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); int forward = n > 0; /* Number of buffer bytes matched. Note that this may be different from len_byte in a multibyte buffer. */ @@ -1736,7 +1736,7 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt, register unsigned char *cursor, *p_limit; register int i, j; unsigned char *pat, *pat_end; - int multibyte = ! NILP (current_buffer->enable_multibyte_characters); + int multibyte = ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); unsigned char simple_translate[0400]; /* These are set to the preceding bytes of a byte to be translated @@ -2718,7 +2718,7 @@ since only regular expressions have distinguished subexpressions. */) int length = SBYTES (newtext); unsigned char *substed; int substed_alloc_size, substed_len; - int buf_multibyte = !NILP (current_buffer->enable_multibyte_characters); + int buf_multibyte = !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); int str_multibyte = STRING_MULTIBYTE (newtext); Lisp_Object rev_tbl; int really_changed = 0; diff --git a/src/syntax.c b/src/syntax.c index b4a44445c28..06fca1dd2d5 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -234,7 +234,7 @@ update_syntax_table (charpos, count, init, object) else { gl_state.use_global = 0; - gl_state.current_syntax_table = current_buffer->syntax_table; + gl_state.current_syntax_table = BUF_SYNTAX_TABLE (current_buffer); } } @@ -321,7 +321,7 @@ INLINE EMACS_INT inc_bytepos (bytepos) EMACS_INT bytepos; { - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) return bytepos + 1; INC_POS (bytepos); @@ -335,7 +335,7 @@ INLINE EMACS_INT dec_bytepos (bytepos) EMACS_INT bytepos; { - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) return bytepos - 1; DEC_POS (bytepos); @@ -752,7 +752,7 @@ DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0, This is the one specified by the current buffer. */) () { - return current_buffer->syntax_table; + return BUF_SYNTAX_TABLE (current_buffer); } DEFUN ("standard-syntax-table", Fstandard_syntax_table, @@ -799,7 +799,7 @@ One argument, a syntax table. */) { int idx; check_syntax_table (table); - current_buffer->syntax_table = table; + BUF_SYNTAX_TABLE (current_buffer) = 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); @@ -1009,7 +1009,7 @@ usage: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE) */) CHECK_CHARACTER (c); if (NILP (syntax_table)) - syntax_table = current_buffer->syntax_table; + syntax_table = BUF_SYNTAX_TABLE (current_buffer); else check_syntax_table (syntax_table); @@ -1432,7 +1432,7 @@ skip_chars (forwardp, string, lim, handle_iso_classes) if (XINT (lim) < BEGV) XSETFASTINT (lim, BEGV); - multibyte = (!NILP (current_buffer->enable_multibyte_characters) + multibyte = (!NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); string_multibyte = SBYTES (string) > SCHARS (string); @@ -1920,7 +1920,7 @@ skip_syntaxes (forwardp, string, lim) if (forwardp ? (PT >= XFASTINT (lim)) : (PT <= XFASTINT (lim))) return make_number (0); - multibyte = (!NILP (current_buffer->enable_multibyte_characters) + multibyte = (!NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)) && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); bzero (fastmap, sizeof fastmap); @@ -2677,7 +2677,7 @@ scan_lists (from, count, depth, sexpflag) while (from > stop) { temp_pos = from_byte; - if (! NILP (current_buffer->enable_multibyte_characters)) + if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) DEC_POS (temp_pos); else temp_pos--; diff --git a/src/syntax.h b/src/syntax.h index ec8fab0166c..7a02fb3b8f4 100644 --- a/src/syntax.h +++ b/src/syntax.h @@ -23,7 +23,7 @@ extern void update_syntax_table P_ ((int, int, int, Lisp_Object)); /* The standard syntax table is stored where it will automatically be used in all new buffers. */ -#define Vstandard_syntax_table buffer_defaults.syntax_table +#define Vstandard_syntax_table BUF_SYNTAX_TABLE (&buffer_defaults) /* A syntax table is a chartable whose elements are cons cells (CODE+FLAGS . MATCHING-CHAR). MATCHING-CHAR can be nil if the char @@ -78,7 +78,7 @@ enum syntaxcode # define CURRENT_SYNTAX_TABLE gl_state.current_syntax_table #else # define SYNTAX_ENTRY SYNTAX_ENTRY_INT -# define CURRENT_SYNTAX_TABLE current_buffer->syntax_table +# define CURRENT_SYNTAX_TABLE BUF_SYNTAX_TABLE (current_buffer) #endif #define SYNTAX_ENTRY_INT(c) CHAR_TABLE_REF (CURRENT_SYNTAX_TABLE, (c)) diff --git a/src/undo.c b/src/undo.c index b5a022a6f06..af635c74c42 100644 --- a/src/undo.c +++ b/src/undo.c @@ -90,12 +90,12 @@ record_point (pt) Fundo_boundary (); last_undo_buffer = current_buffer; - if (CONSP (current_buffer->undo_list)) + if (CONSP (BUF_UNDO_LIST (current_buffer))) { /* Set AT_BOUNDARY to 1 only when we have nothing other than marker adjustment before undo boundary. */ - Lisp_Object tail = current_buffer->undo_list, elt; + Lisp_Object tail = BUF_UNDO_LIST (current_buffer), elt; while (1) { @@ -120,8 +120,8 @@ record_point (pt) if (at_boundary && current_buffer == last_boundary_buffer && last_boundary_position != pt) - current_buffer->undo_list - = Fcons (make_number (last_boundary_position), current_buffer->undo_list); + BUF_UNDO_LIST (current_buffer) + = Fcons (make_number (last_boundary_position), BUF_UNDO_LIST (current_buffer)); } /* Record an insertion that just happened or is about to happen, @@ -135,17 +135,17 @@ record_insert (beg, length) { Lisp_Object lbeg, lend; - if (EQ (current_buffer->undo_list, Qt)) + if (EQ (BUF_UNDO_LIST (current_buffer), Qt)) return; record_point (beg); /* If this is following another insertion and consecutive with it in the buffer, combine the two. */ - if (CONSP (current_buffer->undo_list)) + if (CONSP (BUF_UNDO_LIST (current_buffer))) { Lisp_Object elt; - elt = XCAR (current_buffer->undo_list); + elt = XCAR (BUF_UNDO_LIST (current_buffer)); if (CONSP (elt) && INTEGERP (XCAR (elt)) && INTEGERP (XCDR (elt)) @@ -158,8 +158,8 @@ record_insert (beg, length) XSETFASTINT (lbeg, beg); XSETINT (lend, beg + length); - current_buffer->undo_list = Fcons (Fcons (lbeg, lend), - current_buffer->undo_list); + BUF_UNDO_LIST (current_buffer) = Fcons (Fcons (lbeg, lend), + BUF_UNDO_LIST (current_buffer)); } /* Record that a deletion is about to take place, @@ -172,7 +172,7 @@ record_delete (beg, string) { Lisp_Object sbeg; - if (EQ (current_buffer->undo_list, Qt)) + if (EQ (BUF_UNDO_LIST (current_buffer), Qt)) return; if (PT == beg + SCHARS (string)) @@ -186,8 +186,8 @@ record_delete (beg, string) record_point (beg); } - current_buffer->undo_list - = Fcons (Fcons (string, sbeg), current_buffer->undo_list); + BUF_UNDO_LIST (current_buffer) + = Fcons (Fcons (string, sbeg), BUF_UNDO_LIST (current_buffer)); } /* Record the fact that MARKER is about to be adjusted by ADJUSTMENT. @@ -200,7 +200,7 @@ record_marker_adjustment (marker, adjustment) Lisp_Object marker; int adjustment; { - if (EQ (current_buffer->undo_list, Qt)) + if (EQ (BUF_UNDO_LIST (current_buffer), Qt)) return; /* Allocate a cons cell to be the undo boundary after this command. */ @@ -211,9 +211,9 @@ record_marker_adjustment (marker, adjustment) Fundo_boundary (); last_undo_buffer = current_buffer; - current_buffer->undo_list + BUF_UNDO_LIST (current_buffer) = Fcons (Fcons (marker, make_number (adjustment)), - current_buffer->undo_list); + BUF_UNDO_LIST (current_buffer)); } /* Record that a replacement is about to take place, @@ -238,7 +238,7 @@ record_first_change () Lisp_Object high, low; struct buffer *base_buffer = current_buffer; - if (EQ (current_buffer->undo_list, Qt)) + if (EQ (BUF_UNDO_LIST (current_buffer), Qt)) return; if (current_buffer != last_undo_buffer) @@ -250,7 +250,7 @@ record_first_change () XSETFASTINT (high, (base_buffer->modtime >> 16) & 0xffff); XSETFASTINT (low, base_buffer->modtime & 0xffff); - current_buffer->undo_list = Fcons (Fcons (Qt, Fcons (high, low)), current_buffer->undo_list); + BUF_UNDO_LIST (current_buffer) = Fcons (Fcons (Qt, Fcons (high, low)), BUF_UNDO_LIST (current_buffer)); } /* Record a change in property PROP (whose old value was VAL) @@ -265,7 +265,7 @@ record_property_change (beg, length, prop, value, buffer) struct buffer *obuf = current_buffer, *buf = XBUFFER (buffer); int boundary = 0; - if (EQ (buf->undo_list, Qt)) + if (EQ (BUF_UNDO_LIST (buf), Qt)) return; /* Allocate a cons cell to be the undo boundary after this command. */ @@ -288,7 +288,7 @@ record_property_change (beg, length, prop, value, buffer) XSETINT (lbeg, beg); XSETINT (lend, beg + length); entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend)))); - current_buffer->undo_list = Fcons (entry, current_buffer->undo_list); + BUF_UNDO_LIST (current_buffer) = Fcons (entry, BUF_UNDO_LIST (current_buffer)); current_buffer = obuf; } @@ -300,9 +300,9 @@ but another undo command will undo to the previous boundary. */) () { Lisp_Object tem; - if (EQ (current_buffer->undo_list, Qt)) + if (EQ (BUF_UNDO_LIST (current_buffer), Qt)) return Qnil; - tem = Fcar (current_buffer->undo_list); + tem = Fcar (BUF_UNDO_LIST (current_buffer)); if (!NILP (tem)) { /* One way or another, cons nil onto the front of the undo list. */ @@ -310,12 +310,12 @@ but another undo command will undo to the previous boundary. */) { /* If we have preallocated the cons cell to use here, use that one. */ - XSETCDR (pending_boundary, current_buffer->undo_list); - current_buffer->undo_list = pending_boundary; + XSETCDR (pending_boundary, BUF_UNDO_LIST (current_buffer)); + BUF_UNDO_LIST (current_buffer) = pending_boundary; pending_boundary = Qnil; } else - current_buffer->undo_list = Fcons (Qnil, current_buffer->undo_list); + BUF_UNDO_LIST (current_buffer) = Fcons (Qnil, BUF_UNDO_LIST (current_buffer)); } last_boundary_position = PT; last_boundary_buffer = current_buffer; @@ -345,7 +345,7 @@ truncate_undo_list (b) record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); set_buffer_internal (b); - list = b->undo_list; + list = BUF_UNDO_LIST (b); prev = Qnil; next = list; @@ -457,7 +457,7 @@ truncate_undo_list (b) XSETCDR (last_boundary, Qnil); /* There's nothing we decided to keep, so clear it out. */ else - b->undo_list = Qnil; + BUF_UNDO_LIST (b) = Qnil; unbind_to (count, Qnil); } @@ -495,13 +495,13 @@ Return what remains of the list. */) /* In a writable buffer, enable undoing read-only text that is so because of text properties. */ - if (NILP (current_buffer->read_only)) + if (NILP (BUF_READ_ONLY (current_buffer))) specbind (Qinhibit_read_only, Qt); /* Don't let `intangible' properties interfere with undo. */ specbind (Qinhibit_point_motion_hooks, Qt); - oldlist = current_buffer->undo_list; + oldlist = BUF_UNDO_LIST (current_buffer); while (arg > 0) { @@ -656,9 +656,9 @@ Return what remains of the list. */) so the test in `undo' for continuing an undo series will work right. */ if (did_apply - && EQ (oldlist, current_buffer->undo_list)) - current_buffer->undo_list - = Fcons (list3 (Qapply, Qcdr, Qnil), current_buffer->undo_list); + && EQ (oldlist, BUF_UNDO_LIST (current_buffer))) + BUF_UNDO_LIST (current_buffer) + = Fcons (list3 (Qapply, Qcdr, Qnil), BUF_UNDO_LIST (current_buffer)); UNGCPRO; return unbind_to (count, list); diff --git a/src/window.c b/src/window.c index 60b50e0998f..d32b3dd8011 100644 --- a/src/window.c +++ b/src/window.c @@ -1408,8 +1408,8 @@ window_display_table (w) { struct buffer *b = XBUFFER (w->buffer); - if (DISP_TABLE_P (b->display_table)) - dp = XCHAR_TABLE (b->display_table); + if (DISP_TABLE_P (BUF_DISPLAY_TABLE (b))) + dp = XCHAR_TABLE (BUF_DISPLAY_TABLE (b)); else if (DISP_TABLE_P (Vstandard_display_table)) dp = XCHAR_TABLE (Vstandard_display_table); } @@ -1463,9 +1463,9 @@ unshow_buffer (w) So don't clobber point in that buffer. */ if (! EQ (buf, XWINDOW (selected_window)->buffer) /* This line helps to fix Horsley's testbug.el bug. */ - && !(WINDOWP (b->last_selected_window) - && w != XWINDOW (b->last_selected_window) - && EQ (buf, XWINDOW (b->last_selected_window)->buffer))) + && !(WINDOWP (BUF_LAST_SELECTED_WINDOW (b)) + && w != XWINDOW (BUF_LAST_SELECTED_WINDOW (b)) + && EQ (buf, XWINDOW (BUF_LAST_SELECTED_WINDOW (b))->buffer))) temp_set_point_both (b, clip_to_bounds (BUF_BEGV (b), XMARKER (w->pointm)->charpos, @@ -1474,9 +1474,9 @@ unshow_buffer (w) marker_byte_position (w->pointm), BUF_ZV_BYTE (b))); - if (WINDOWP (b->last_selected_window) - && w == XWINDOW (b->last_selected_window)) - b->last_selected_window = Qnil; + if (WINDOWP (BUF_LAST_SELECTED_WINDOW (b)) + && w == XWINDOW (BUF_LAST_SELECTED_WINDOW (b))) + BUF_LAST_SELECTED_WINDOW (b) = Qnil; } /* Put replacement into the window structure in place of old. */ @@ -2391,7 +2391,7 @@ window_loop (type, obj, mini, frames) /* Check for a window that has a killed buffer. */ case CHECK_ALL_WINDOWS: if (! NILP (w->buffer) - && NILP (XBUFFER (w->buffer)->name)) + && NILP (BUF_NAME (XBUFFER (w->buffer)))) abort (); break; @@ -2798,7 +2798,7 @@ window_min_size_2 (w, width_p, safe_p) { int safe_size = (MIN_SAFE_WINDOW_HEIGHT + ((BUFFERP (w->buffer) - && !NILP (XBUFFER (w->buffer)->mode_line_format)) + && !NILP (BUF_MODE_LINE_FORMAT (XBUFFER (w->buffer)))) ? 1 : 0)); return safe_p ? safe_size : max (window_min_height, safe_size); @@ -3450,15 +3450,15 @@ set_window_buffer (window, buffer, run_hooks_p, keep_margins_p) w->buffer = buffer; if (EQ (window, selected_window)) - b->last_selected_window = window; + BUF_LAST_SELECTED_WINDOW (b) = window; /* Let redisplay errors through. */ b->display_error_modiff = 0; /* Update time stamps of buffer display. */ - if (INTEGERP (b->display_count)) - XSETINT (b->display_count, XINT (b->display_count) + 1); - b->display_time = Fcurrent_time (); + if (INTEGERP (BUF_DISPLAY_COUNT (b))) + XSETINT (BUF_DISPLAY_COUNT (b), XINT (BUF_DISPLAY_COUNT (b)) + 1); + BUF_DISPLAY_TIME (b) = Fcurrent_time (); XSETFASTINT (w->window_end_pos, 0); XSETFASTINT (w->window_end_vpos, 0); @@ -3511,18 +3511,18 @@ set_window_buffer (window, buffer, run_hooks_p, keep_margins_p) w->left_margin_cols = w->right_margin_cols = Qnil; Fset_window_fringes (window, - b->left_fringe_width, b->right_fringe_width, - b->fringes_outside_margins); + BUF_LEFT_FRINGE_WIDTH (b), BUF_RIGHT_FRINGE_WIDTH (b), + BUF_FRINGES_OUTSIDE_MARGINS (b)); Fset_window_scroll_bars (window, - b->scroll_bar_width, - b->vertical_scroll_bar_type, Qnil); + BUF_SCROLL_BAR_WIDTH (b), + BUF_VERTICAL_SCROLL_BAR_TYPE (b), Qnil); w->left_margin_cols = save_left; w->right_margin_cols = save_right; Fset_window_margins (window, - b->left_margin_cols, b->right_margin_cols); + BUF_LEFT_MARGIN_COLS (b), BUF_RIGHT_MARGIN_COLS (b)); } if (run_hooks_p) @@ -3560,7 +3560,7 @@ This function runs `window-scroll-functions' before running XSETWINDOW (window, w); buffer = Fget_buffer (buffer_or_name); CHECK_BUFFER (buffer); - if (NILP (XBUFFER (buffer)->name)) + if (NILP (BUF_NAME (XBUFFER (buffer)))) error ("Attempt to display deleted buffer"); tem = w->buffer; @@ -3571,7 +3571,7 @@ This function runs `window-scroll-functions' before running { if (!EQ (tem, buffer)) if (EQ (w->dedicated, Qt)) - error ("Window is dedicated to `%s'", SDATA (XBUFFER (tem)->name)); + error ("Window is dedicated to `%s'", SDATA (BUF_NAME (XBUFFER (tem)))); else w->dedicated = Qnil; @@ -3650,7 +3650,7 @@ selected window before each command. */) record_buffer (w->buffer); Fset_buffer (w->buffer); - XBUFFER (w->buffer)->last_selected_window = window; + BUF_LAST_SELECTED_WINDOW (XBUFFER (w->buffer)) = window; /* Go to the point recorded in the window. This is important when the buffer is in more @@ -3723,7 +3723,7 @@ displaying that buffer. */) if (STRINGP (object)) object = Fget_buffer (object); - if (BUFFERP (object) && !NILP (XBUFFER (object)->name)) + if (BUFFERP (object) && !NILP (BUF_NAME (XBUFFER (object)))) { /* Walk all windows looking for buffer, and force update of each of those windows. */ @@ -3747,7 +3747,7 @@ temp_output_buffer_show (buf) register Lisp_Object window; register struct window *w; - XBUFFER (buf)->directory = current_buffer->directory; + BUF_DIRECTORY (XBUFFER (buf)) = BUF_DIRECTORY (current_buffer); Fset_buffer (buf); BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF; @@ -6002,7 +6002,7 @@ the return value is nil. Otherwise the value is t. */) saved_windows = XVECTOR (data->saved_windows); new_current_buffer = data->m_current_buffer; - if (NILP (XBUFFER (new_current_buffer)->name)) + if (NILP (BUF_NAME (XBUFFER (new_current_buffer)))) new_current_buffer = Qnil; else { @@ -6187,14 +6187,14 @@ the return value is nil. Otherwise the value is t. */) w->buffer = p->buffer; else { - if (!NILP (XBUFFER (p->buffer)->name)) + if (!NILP (BUF_NAME (XBUFFER (p->buffer)))) /* If saved buffer is alive, install it. */ { w->buffer = p->buffer; w->start_at_line_beg = p->start_at_line_beg; set_marker_restricted (w->start, p->start, w->buffer); set_marker_restricted (w->pointm, p->pointm, w->buffer); - Fset_marker (XBUFFER (w->buffer)->mark, + Fset_marker (BUF_MARK (XBUFFER (w->buffer)), p->mark, w->buffer); /* As documented in Fcurrent_window_configuration, don't @@ -6204,7 +6204,7 @@ the return value is nil. Otherwise the value is t. */) && XBUFFER (p->buffer) == current_buffer) Fgoto_char (w->pointm); } - else if (NILP (w->buffer) || NILP (XBUFFER (w->buffer)->name)) + else if (NILP (w->buffer) || NILP (BUF_NAME (XBUFFER (w->buffer)))) /* Else unless window has a live buffer, get one. */ { w->buffer = Fcdr (Fcar (Vbuffer_alist)); @@ -6245,7 +6245,7 @@ the return value is nil. Otherwise the value is t. */) XWINDOW (data->current_window)->buffer); Fselect_window (data->current_window, Qnil); - XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window + BUF_LAST_SELECTED_WINDOW (XBUFFER (XWINDOW (selected_window)->buffer)) = selected_window; if (NILP (data->focus_frame) @@ -6462,7 +6462,7 @@ save_window_save (window, vector, i) p->start = Fcopy_marker (w->start, Qnil); p->start_at_line_beg = w->start_at_line_beg; - tem = XBUFFER (w->buffer)->mark; + tem = BUF_MARK (XBUFFER (w->buffer)); p->mark = Fcopy_marker (tem, Qnil); } else diff --git a/src/xdisp.c b/src/xdisp.c index bb1108152c5..3826ba04bb8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1344,12 +1344,12 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, rowh, vpos) if (WINDOW_WANTS_MODELINE_P (w)) current_mode_line_height = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w), - current_buffer->mode_line_format); + BUF_MODE_LINE_FORMAT (current_buffer)); if (WINDOW_WANTS_HEADER_LINE_P (w)) current_header_line_height = display_mode_line (w, HEADER_LINE_FACE_ID, - current_buffer->header_line_format); + BUF_HEADER_LINE_FORMAT (current_buffer)); start_display (&it, w, top); move_it_to (&it, charpos, -1, it.last_visible_y-1, -1, @@ -2610,10 +2610,10 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id) if (base_face_id == DEFAULT_FACE_ID && FRAME_WINDOW_P (it->f)) { - if (NATNUMP (current_buffer->extra_line_spacing)) - it->extra_line_spacing = XFASTINT (current_buffer->extra_line_spacing); - else if (FLOATP (current_buffer->extra_line_spacing)) - it->extra_line_spacing = (XFLOAT_DATA (current_buffer->extra_line_spacing) + if (NATNUMP (BUF_EXTRA_LINE_SPACING (current_buffer))) + it->extra_line_spacing = XFASTINT (BUF_EXTRA_LINE_SPACING (current_buffer)); + else if (FLOATP (BUF_EXTRA_LINE_SPACING (current_buffer))) + it->extra_line_spacing = (XFLOAT_DATA (BUF_EXTRA_LINE_SPACING (current_buffer)) * FRAME_LINE_HEIGHT (it->f)); else if (it->f->extra_line_spacing > 0) it->extra_line_spacing = it->f->extra_line_spacing; @@ -2636,29 +2636,29 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id) it->override_ascent = -1; /* Are control characters displayed as `^C'? */ - it->ctl_arrow_p = !NILP (current_buffer->ctl_arrow); + it->ctl_arrow_p = !NILP (BUF_CTL_ARROW (current_buffer)); /* -1 means everything between a CR and the following line end is invisible. >0 means lines indented more than this value are invisible. */ - it->selective = (INTEGERP (current_buffer->selective_display) - ? XFASTINT (current_buffer->selective_display) - : (!NILP (current_buffer->selective_display) + it->selective = (INTEGERP (BUF_SELECTIVE_DISPLAY (current_buffer)) + ? XFASTINT (BUF_SELECTIVE_DISPLAY (current_buffer)) + : (!NILP (BUF_SELECTIVE_DISPLAY (current_buffer)) ? -1 : 0)); it->selective_display_ellipsis_p - = !NILP (current_buffer->selective_display_ellipses); + = !NILP (BUF_SELECTIVE_DISPLAY_ELLIPSES (current_buffer)); /* Display table to use. */ it->dp = window_display_table (w); /* Are multibyte characters enabled in current_buffer? */ - it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters); + it->multibyte_p = !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); /* Non-zero if we should highlight the region. */ highlight_region_p = (!NILP (Vtransient_mark_mode) - && !NILP (current_buffer->mark_active) - && XMARKER (current_buffer->mark)->buffer != 0); + && !NILP (BUF_MARK_ACTIVE (current_buffer)) + && XMARKER (BUF_MARK (current_buffer))->buffer != 0); /* Set IT->region_beg_charpos and IT->region_end_charpos to the start and end of a visible region in window IT->w. Set both to @@ -2675,7 +2675,7 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id) && WINDOWP (minibuf_selected_window) && w == XWINDOW (minibuf_selected_window)))) { - int charpos = marker_position (current_buffer->mark); + int charpos = marker_position (BUF_MARK (current_buffer)); it->region_beg_charpos = min (PT, charpos); it->region_end_charpos = max (PT, charpos); } @@ -2692,7 +2692,7 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id) it->redisplay_end_trigger_charpos = XINT (w->redisplay_end_trigger); /* Correct bogus values of tab_width. */ - it->tab_width = XINT (current_buffer->tab_width); + it->tab_width = XINT (BUF_TAB_WIDTH (current_buffer)); if (it->tab_width <= 0 || it->tab_width > 1000) it->tab_width = 8; @@ -2706,8 +2706,8 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id) && (WINDOW_TOTAL_COLS (it->w) < XINT (Vtruncate_partial_width_windows)))))) it->line_wrap = TRUNCATE; - else if (NILP (current_buffer->truncate_lines)) - it->line_wrap = NILP (current_buffer->word_wrap) + else if (NILP (BUF_TRUNCATE_LINES (current_buffer))) + it->line_wrap = NILP (BUF_WORD_WRAP (current_buffer)) ? WINDOW_WRAP : WORD_WRAP; else it->line_wrap = TRUNCATE; @@ -5506,7 +5506,7 @@ reseat_1 (it, pos, set_stop_p) it->method = GET_FROM_BUFFER; it->object = it->w->buffer; it->area = TEXT_AREA; - it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters); + it->multibyte_p = !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); it->sp = 0; it->string_from_display_prop_p = 0; it->face_before_selective_p = 0; @@ -7727,7 +7727,7 @@ message_dolog (m, nbytes, nlflag, multibyte) old_deactivate_mark = Vdeactivate_mark; oldbuf = current_buffer; Fset_buffer (Fget_buffer_create (Vmessages_buffer_name)); - current_buffer->undo_list = Qt; + BUF_UNDO_LIST (current_buffer) = Qt; oldpoint = message_dolog_marker1; set_marker_restricted (oldpoint, make_number (PT), Qnil); @@ -7751,7 +7751,7 @@ message_dolog (m, nbytes, nlflag, multibyte) /* Insert the string--maybe converting multibyte to single byte or vice versa, so that all the text fits the buffer. */ if (multibyte - && NILP (current_buffer->enable_multibyte_characters)) + && NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) { int i, c, char_bytes; unsigned char work[1]; @@ -7768,7 +7768,7 @@ message_dolog (m, nbytes, nlflag, multibyte) } } else if (! multibyte - && ! NILP (current_buffer->enable_multibyte_characters)) + && ! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) { int i, c, char_bytes; unsigned char *msg = (unsigned char *) m; @@ -8285,7 +8285,7 @@ update_echo_area () Lisp_Object string; string = Fcurrent_message (); message3 (string, SBYTES (string), - !NILP (current_buffer->enable_multibyte_characters)); + !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))); } } @@ -8300,7 +8300,7 @@ ensure_echo_area_buffers () for (i = 0; i < 2; ++i) if (!BUFFERP (echo_buffer[i]) - || NILP (XBUFFER (echo_buffer[i])->name)) + || NILP (BUF_NAME (XBUFFER (echo_buffer[i])))) { char name[30]; Lisp_Object old_buffer; @@ -8309,7 +8309,7 @@ ensure_echo_area_buffers () old_buffer = echo_buffer[i]; sprintf (name, " *Echo Area %d*", i); echo_buffer[i] = Fget_buffer_create (build_string (name)); - XBUFFER (echo_buffer[i])->truncate_lines = Qnil; + BUF_TRUNCATE_LINES (XBUFFER (echo_buffer[i])) = Qnil; /* to force word wrap in echo area - it was decided to postpone this*/ /* XBUFFER (echo_buffer[i])->word_wrap = Qt; */ @@ -8406,8 +8406,8 @@ with_echo_area_buffer (w, which, fn, a1, a2, a3, a4) set_marker_both (w->pointm, buffer, BEG, BEG_BYTE); } - current_buffer->undo_list = Qt; - current_buffer->read_only = Qnil; + BUF_UNDO_LIST (current_buffer) = Qt; + BUF_READ_ONLY (current_buffer) = Qnil; specbind (Qinhibit_read_only, Qt); specbind (Qinhibit_modification_hooks, Qt); @@ -8523,7 +8523,7 @@ setup_echo_area_for_printing (multibyte_p) /* Switch to that buffer and clear it. */ set_buffer_internal (XBUFFER (echo_area_buffer[0])); - current_buffer->truncate_lines = Qnil; + BUF_TRUNCATE_LINES (current_buffer) = Qnil; if (Z > BEG) { @@ -8537,7 +8537,7 @@ setup_echo_area_for_printing (multibyte_p) /* Set up the buffer for the multibyteness we need. */ if (multibyte_p - != !NILP (current_buffer->enable_multibyte_characters)) + != !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) Fset_buffer_multibyte (multibyte_p ? Qt : Qnil); /* Raise the frame containing the echo area. */ @@ -8566,7 +8566,7 @@ setup_echo_area_for_printing (multibyte_p) { /* Someone switched buffers between print requests. */ set_buffer_internal (XBUFFER (echo_area_buffer[0])); - current_buffer->truncate_lines = Qnil; + BUF_TRUNCATE_LINES (current_buffer) = Qnil; } } } @@ -9030,10 +9030,10 @@ set_message_1 (a1, a2, nbytes, multibyte_p) /* Change multibyteness of the echo buffer appropriately. */ if (message_enable_multibyte - != !NILP (current_buffer->enable_multibyte_characters)) + != !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil); - current_buffer->truncate_lines = message_truncate_lines ? Qt : Qnil; + BUF_TRUNCATE_LINES (current_buffer) = message_truncate_lines ? Qt : Qnil; /* Insert new message at BEG. */ TEMP_SET_PT_BOTH (BEG, BEG_BYTE); @@ -9056,7 +9056,7 @@ set_message_1 (a1, a2, nbytes, multibyte_p) if (nbytes == 0) nbytes = strlen (s); - if (multibyte_p && NILP (current_buffer->enable_multibyte_characters)) + if (multibyte_p && NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) { /* Convert from multi-byte to single-byte. */ int i, c, n; @@ -9073,7 +9073,7 @@ set_message_1 (a1, a2, nbytes, multibyte_p) } } else if (!multibyte_p - && !NILP (current_buffer->enable_multibyte_characters)) + && !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) { /* Convert from single-byte to multi-byte. */ int i, c, n; @@ -9696,7 +9696,7 @@ update_menu_bar (f, save_match_data, hooks_run) < BUF_MODIFF (XBUFFER (w->buffer))) != !NILP (w->last_had_star)) || ((!NILP (Vtransient_mark_mode) - && !NILP (XBUFFER (w->buffer)->mark_active)) + && !NILP (BUF_MARK_ACTIVE (XBUFFER (w->buffer)))) != !NILP (w->region_showing))) { struct buffer *prev = current_buffer; @@ -9899,7 +9899,7 @@ update_tool_bar (f, save_match_data) < BUF_MODIFF (XBUFFER (w->buffer))) != !NILP (w->last_had_star)) || ((!NILP (Vtransient_mark_mode) - && !NILP (XBUFFER (w->buffer)->mark_active)) + && !NILP (BUF_MARK_ACTIVE (XBUFFER (w->buffer)))) != !NILP (w->region_showing))) { struct buffer *prev = current_buffer; @@ -11012,8 +11012,8 @@ text_outside_line_unchanged_p (w, start, end) /* If selective display, can't optimize if changes start at the beginning of the line. */ if (unchanged_p - && INTEGERP (current_buffer->selective_display) - && XINT (current_buffer->selective_display) > 0 + && INTEGERP (BUF_SELECTIVE_DISPLAY (current_buffer)) + && XINT (BUF_SELECTIVE_DISPLAY (current_buffer)) > 0 && (BEG_UNCHANGED < start || GPT <= start)) unchanged_p = 0; @@ -11583,11 +11583,11 @@ redisplay_internal (preserve_echo_area) the whole window. The assignment to this_line_start_pos prevents the optimization directly below this if-statement. */ if (((!NILP (Vtransient_mark_mode) - && !NILP (XBUFFER (w->buffer)->mark_active)) + && !NILP (BUF_MARK_ACTIVE (XBUFFER (w->buffer)))) != !NILP (w->region_showing)) || (!NILP (w->region_showing) && !EQ (w->region_showing, - Fmarker_position (XBUFFER (w->buffer)->mark)))) + Fmarker_position (BUF_MARK (XBUFFER (w->buffer)))))) CHARPOS (this_line_start_pos) = 0; /* Optimize the case that only the line containing the cursor in the @@ -11747,8 +11747,8 @@ redisplay_internal (preserve_echo_area) /* If highlighting the region, or if the cursor is in the echo area, then we can't just move the cursor. */ else if (! (!NILP (Vtransient_mark_mode) - && !NILP (current_buffer->mark_active)) - && (EQ (selected_window, current_buffer->last_selected_window) + && !NILP (BUF_MARK_ACTIVE (current_buffer))) + && (EQ (selected_window, BUF_LAST_SELECTED_WINDOW (current_buffer)) || highlight_nonselected_windows) && NILP (w->region_showing) && NILP (Vshow_trailing_whitespace) @@ -12667,8 +12667,8 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, scroll_max = (max (scroll_step, max (scroll_conservatively, temp_scroll_step)) * FRAME_LINE_HEIGHT (f)); - else if (NUMBERP (current_buffer->scroll_down_aggressively) - || NUMBERP (current_buffer->scroll_up_aggressively)) + else if (NUMBERP (BUF_SCROLL_DOWN_AGGRESSIVELY (current_buffer)) + || NUMBERP (BUF_SCROLL_UP_AGGRESSIVELY (current_buffer))) /* We're trying to scroll because of aggressive scrolling but no scroll_step is set. Choose an arbitrary one. */ scroll_max = 10 * FRAME_LINE_HEIGHT (f); @@ -12725,7 +12725,7 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, amount_to_scroll = scroll_max; else { - aggressive = current_buffer->scroll_up_aggressively; + aggressive = BUF_SCROLL_UP_AGGRESSIVELY (current_buffer); height = WINDOW_BOX_TEXT_HEIGHT (w); if (NUMBERP (aggressive)) { @@ -12789,7 +12789,7 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, amount_to_scroll = scroll_max; else { - aggressive = current_buffer->scroll_down_aggressively; + aggressive = BUF_SCROLL_DOWN_AGGRESSIVELY (current_buffer); height = WINDOW_BOX_TEXT_HEIGHT (w); if (NUMBERP (aggressive)) { @@ -12970,7 +12970,7 @@ try_cursor_movement (window, startp, scroll_step) region exists, cursor movement has to do more than just set the cursor. */ && !(!NILP (Vtransient_mark_mode) - && !NILP (current_buffer->mark_active)) + && !NILP (BUF_MARK_ACTIVE (current_buffer))) && NILP (w->region_showing) && NILP (Vshow_trailing_whitespace) /* Right after splitting windows, last_point may be nil. */ @@ -13410,7 +13410,7 @@ redisplay_window (window, just_this_one_p) struct Lisp_Char_Table *disptab = buffer_display_table (); if (! disptab_matches_widthtab (disptab, - XVECTOR (current_buffer->width_table))) + XVECTOR (BUF_WIDTH_TABLE (current_buffer)))) { invalidate_region_cache (current_buffer, current_buffer->width_run_cache, @@ -13532,7 +13532,7 @@ redisplay_window (window, just_this_one_p) /* If we are highlighting the region, then we just changed the region, so redisplay to show it. */ if (!NILP (Vtransient_mark_mode) - && !NILP (current_buffer->mark_active)) + && !NILP (BUF_MARK_ACTIVE (current_buffer))) { clear_glyph_matrix (w->desired_matrix); if (!try_window (window, startp, 0)) @@ -13695,8 +13695,8 @@ redisplay_window (window, just_this_one_p) if ((scroll_conservatively || scroll_step || temp_scroll_step - || NUMBERP (current_buffer->scroll_up_aggressively) - || NUMBERP (current_buffer->scroll_down_aggressively)) + || NUMBERP (BUF_SCROLL_UP_AGGRESSIVELY (current_buffer)) + || NUMBERP (BUF_SCROLL_DOWN_AGGRESSIVELY (current_buffer))) && !current_buffer->clip_changed && CHARPOS (startp) >= BEGV && CHARPOS (startp) <= ZV) @@ -14134,7 +14134,7 @@ try_window_reusing_current_matrix (w) /* Can't do this if region may have changed. */ if ((!NILP (Vtransient_mark_mode) - && !NILP (current_buffer->mark_active)) + && !NILP (BUF_MARK_ACTIVE (current_buffer))) || !NILP (w->region_showing) || !NILP (Vshow_trailing_whitespace)) return 0; @@ -14903,7 +14903,7 @@ try_window_id (w) /* Can't use this if highlighting a region because a cursor movement will do more than just set the cursor. */ if (!NILP (Vtransient_mark_mode) - && !NILP (current_buffer->mark_active)) + && !NILP (BUF_MARK_ACTIVE (current_buffer))) GIVE_UP (9); /* Likewise if highlighting trailing whitespace. */ @@ -14923,7 +14923,7 @@ try_window_id (w) wrapped line can change the wrap position, altering the line above it. It might be worthwhile to handle this more intelligently, but for now just redisplay from scratch. */ - if (!NILP (XBUFFER (w->buffer)->word_wrap)) + if (!NILP (BUF_WORD_WRAP (XBUFFER (w->buffer)))) GIVE_UP (21); /* Make sure beg_unchanged and end_unchanged are up to date. Do it @@ -15899,7 +15899,7 @@ get_overlay_arrow_glyph_row (w, overlay_arrow_string) it.glyph_row->used[TEXT_AREA] = 0; SET_TEXT_POS (it.position, 0, 0); - multibyte_p = !NILP (buffer->enable_multibyte_characters); + multibyte_p = !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (buffer)); p = arrow_string; while (p < arrow_end) { @@ -16581,7 +16581,7 @@ display_line (it) row->glyphs[TEXT_AREA]->charpos = -1; row->displays_text_p = 0; - if (!NILP (XBUFFER (it->w->buffer)->indicate_empty_lines) + if (!NILP (BUF_INDICATE_EMPTY_LINES (XBUFFER (it->w->buffer))) && (!MINI_WINDOW_P (it->w) || (minibuf_level && EQ (it->window, minibuf_window)))) row->indicate_empty_line_p = 1; @@ -17244,14 +17244,14 @@ display_mode_lines (w) /* Select mode line face based on the real selected window. */ display_mode_line (w, CURRENT_MODE_LINE_FACE_ID_3 (sel_w, sel_w, w), - current_buffer->mode_line_format); + BUF_MODE_LINE_FORMAT (current_buffer)); ++n; } if (WINDOW_WANTS_HEADER_LINE_P (w)) { display_mode_line (w, HEADER_LINE_FACE_ID, - current_buffer->header_line_format); + BUF_HEADER_LINE_FORMAT (current_buffer)); ++n; } @@ -18206,7 +18206,7 @@ decode_mode_spec_coding (coding_system, buf, eol_flag) int eol_flag; { Lisp_Object val; - int multibyte = !NILP (current_buffer->enable_multibyte_characters); + int multibyte = !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)); const unsigned char *eol_str; int eol_str_len; /* The EOL conversion we are using. */ @@ -18305,7 +18305,7 @@ decode_mode_spec (w, c, field_width, precision, string) switch (c) { case '*': - if (!NILP (b->read_only)) + if (!NILP (BUF_READ_ONLY (b))) return "%"; if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) return "*"; @@ -18315,7 +18315,7 @@ decode_mode_spec (w, c, field_width, precision, string) /* This differs from %* only for a modified read-only buffer. */ if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) return "*"; - if (!NILP (b->read_only)) + if (!NILP (BUF_READ_ONLY (b))) return "%"; return "-"; @@ -18377,7 +18377,7 @@ decode_mode_spec (w, c, field_width, precision, string) } case 'b': - obj = b->name; + obj = BUF_NAME (b); break; case 'c': @@ -18417,7 +18417,7 @@ decode_mode_spec (w, c, field_width, precision, string) return "Emacs"; case 'f': - obj = b->filename; + obj = BUF_FILENAME (b); break; case 'i': @@ -18552,7 +18552,7 @@ decode_mode_spec (w, c, field_width, precision, string) break; case 'm': - obj = b->mode_name; + obj = BUF_MODE_NAME (b); break; case 'n': @@ -18635,11 +18635,8 @@ decode_mode_spec (w, c, field_width, precision, string) case '@': { - int count = inhibit_garbage_collection (); - Lisp_Object val = call1 (intern ("file-remote-p"), - current_buffer->directory); - unbind_to (count, Qnil); - + Lisp_Object val; + val = call1 (intern ("file-remote-p"), BUF_DIRECTORY (current_buffer)); if (NILP (val)) return "-"; else @@ -18672,7 +18669,7 @@ decode_mode_spec (w, c, field_width, precision, string) (FRAME_TERMINAL_CODING (f)->id), p, 0); } - p = decode_mode_spec_coding (b->buffer_file_coding_system, + p = decode_mode_spec_coding (BUF_BUFFER_FILE_CODING_SYSTEM (b), p, eol_flag); #if 0 /* This proves to be annoying; I think we can do without. -- rms. */ @@ -18722,8 +18719,8 @@ display_count_lines (start, start_byte, limit_byte, count, byte_pos_ptr) /* If we are not in selective display mode, check only for newlines. */ - int selective_display = (!NILP (current_buffer->selective_display) - && !INTEGERP (current_buffer->selective_display)); + int selective_display = (!NILP (BUF_SELECTIVE_DISPLAY (current_buffer)) + && !INTEGERP (BUF_SELECTIVE_DISPLAY (current_buffer))); if (count > 0) { @@ -22182,13 +22179,13 @@ get_window_cursor_type (w, glyph, width, active_cursor) { if (w == XWINDOW (echo_area_window)) { - if (EQ (b->cursor_type, Qt) || NILP (b->cursor_type)) + if (EQ (BUF_CURSOR_TYPE (b), Qt) || NILP (BUF_CURSOR_TYPE (b))) { *width = FRAME_CURSOR_WIDTH (f); return FRAME_DESIRED_CURSOR (f); } else - return get_specified_cursor_type (b->cursor_type, width); + return get_specified_cursor_type (BUF_CURSOR_TYPE (b), width); } *active_cursor = 0; @@ -22211,23 +22208,23 @@ get_window_cursor_type (w, glyph, width, active_cursor) } /* Never display a cursor in a window in which cursor-type is nil. */ - if (NILP (b->cursor_type)) + if (NILP (BUF_CURSOR_TYPE (b))) return NO_CURSOR; /* Get the normal cursor type for this window. */ - if (EQ (b->cursor_type, Qt)) + if (EQ (BUF_CURSOR_TYPE (b), Qt)) { cursor_type = FRAME_DESIRED_CURSOR (f); *width = FRAME_CURSOR_WIDTH (f); } else - cursor_type = get_specified_cursor_type (b->cursor_type, width); + cursor_type = get_specified_cursor_type (BUF_CURSOR_TYPE (b), width); /* Use cursor-in-non-selected-windows instead for non-selected window or frame. */ if (non_selected) { - alt_cursor = b->cursor_in_non_selected_windows; + alt_cursor = BUF_CURSOR_IN_NON_SELECTED_WINDOWS (b); if (!EQ (Qt, alt_cursor)) return get_specified_cursor_type (alt_cursor, width); /* t means modify the normal cursor type. */ @@ -22276,7 +22273,7 @@ get_window_cursor_type (w, glyph, width, active_cursor) /* Cursor is blinked off, so determine how to "toggle" it. */ /* First look for an entry matching the buffer's cursor-type in blink-cursor-alist. */ - if ((alt_cursor = Fassoc (b->cursor_type, Vblink_cursor_alist), !NILP (alt_cursor))) + if ((alt_cursor = Fassoc (BUF_CURSOR_TYPE (b), Vblink_cursor_alist), !NILP (alt_cursor))) return get_specified_cursor_type (XCDR (alt_cursor), width); /* Then see if frame has specified a specific blink off cursor type. */ diff --git a/src/xfaces.c b/src/xfaces.c index ec764604aa8..5a156079cce 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -6227,7 +6227,7 @@ compute_char_face (f, ch, prop) { int face_id; - if (NILP (current_buffer->enable_multibyte_characters)) + if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) ch = 0; if (NILP (prop)) diff --git a/src/xfns.c b/src/xfns.c index 60f152114c6..cc71459cbb5 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -4716,7 +4716,7 @@ x_create_tip_frame (dpyinfo, parms, text) Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil); old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (buffer)); - current_buffer->truncate_lines = Qnil; + BUF_TRUNCATE_LINES (current_buffer) = Qnil; specbind (Qinhibit_read_only, Qt); specbind (Qinhibit_modification_hooks, Qt); Ferase_buffer (); @@ -5197,7 +5197,7 @@ Text larger than the specified size is clipped. */) /* Display the tooltip text in a temporary buffer. */ old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); - current_buffer->truncate_lines = Qnil; + BUF_TRUNCATE_LINES (current_buffer) = Qnil; clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); SET_TEXT_POS (pos, BEGV, BEGV_BYTE); -- 2.39.5