See hack-buffer-objfwd.el to see how this was done.
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
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 */
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
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))
{
&& !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);
}
/* 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;
}
/* 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);
(object)
Lisp_Object object;
{
- return ((BUFFERP (object) && ! NILP (XBUFFER (object)->name))
+ return ((BUFFERP (object) && ! NILP (BUF_NAME (XBUFFER (object))))
? Qt : Qnil);
}
{
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;
}
{
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;
}
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. */
/* 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;
/* 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,
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)
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;
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);
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);
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;
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;
}
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. */
&& 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)))
}
/* 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));
}
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,
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,
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;
{
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;
/* 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))
/* 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))
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. */
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,
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. */
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;
}
b = XBUFFER (buffer);
/* Avoid trouble for buffer already dead. */
- if (NILP (b->name))
+ if (NILP (BUF_NAME (b)))
return Qnil;
tem = get_current_thread ();
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;
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.
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);
/* 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);
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)
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)
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;
}
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))
/* 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));
}
}
/* 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)))
/* 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)))
{
/* 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));
}
}
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;
set_buffer_if_live (buffer)
Lisp_Object buffer;
{
- if (! NILP (XBUFFER (buffer)->name))
+ if (! NILP (BUF_NAME (XBUFFER (buffer))))
Fset_buffer (buffer);
return Qnil;
}
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;
/* 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;
/* 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;
}
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.
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);
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++;
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);
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;
/* 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;
{
/* 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);
/* 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;
}
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))
{
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),
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),
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;
/* 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
/* 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)
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");
#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 ();
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);
}
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). */);
#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.
%% -- 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.
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,
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'.
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.
`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.
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
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.
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
#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.
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.
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;
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
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
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
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,
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,
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.
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
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.
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'.
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:
`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'.
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. */);
/* 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)))
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))))
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
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;
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_))
+
+
\f
/* This structure holds the default values of the buffer-local variables
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
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)]);
}
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);
}
else if (*string == '*')
{
string++;
- if (!NILP (current_buffer->read_only))
+ if (!NILP (BUF_READ_ONLY (current_buffer)))
{
if (!NILP (record_flag))
{
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;
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;
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;
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
{
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
- current_dir = current_buffer->directory;
+ current_dir = BUF_DIRECTORY (current_buffer);
GCPRO4 (infile, buffer, current_dir, error_file);
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);
/* 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);
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
/* 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
{
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.
{
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. */
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);
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,
}
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;
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;
}
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,
{
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);
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,
/* 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)
{
/* 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);
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
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; \
do \
{ \
(charpos)++; \
- if (NILP (current_buffer->enable_multibyte_characters)) \
+ if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) \
(bytepos)++; \
else \
INC_POS ((bytepos)); \
do \
{ \
(charpos)--; \
- if (NILP (current_buffer->enable_multibyte_characters)) \
+ if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer))) \
(bytepos)--; \
else \
DEC_POS ((bytepos)); \
#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
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);
/* 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'))
{
}
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))
{
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. */
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)
|| (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;
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)))
? !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;
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);
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;
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;
{
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;
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;
}
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);
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
{
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
{
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);
}
}
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))
{
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
{
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);
}
}
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);
}
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));
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;
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));
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);
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))
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);
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;
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));
}
}
}
/* 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
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. */
/* 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
{
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)))
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)))
&& !(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. */
&& !(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
/* 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;
|| 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
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);
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. */
{
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;
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;
{
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). */
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");
If you set the marker not to point anywhere, the buffer will have no mark. */)
()
{
- return current_buffer->mark;
+ return BUF_MARK (current_buffer);
}
\f
== 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))));
}
/* 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));
/* 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"));
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);
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));
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
{
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;
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);
}
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);
if (NILP (buf))
nsberror (buffer);
bp = XBUFFER (buf);
- if (NILP (bp->name))
+ if (NILP (BUF_NAME (bp)))
error ("Selecting deleted buffer");
if (NILP (start))
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;
if (NILP (buf1))
nsberror (buffer1);
bp1 = XBUFFER (buf1);
- if (NILP (bp1->name))
+ if (NILP (BUF_NAME (bp1)))
error ("Selecting deleted buffer");
}
if (NILP (buf2))
nsberror (buffer2);
bp2 = XBUFFER (buf2);
- if (NILP (bp2->name))
+ if (NILP (BUF_NAME (bp2)))
error ("Selecting deleted buffer");
}
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);
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);
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,
#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:
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)
struct gcpro gcpro1;
- tem = current_buffer->undo_list;
+ tem = BUF_UNDO_LIST (current_buffer);
GCPRO1 (tem);
/* Make a multibyte string containing this single character. */
INC_POS (pos_byte_next);
if (! NILP (noundo))
- current_buffer->undo_list = tem;
+ BUF_UNDO_LIST (current_buffer) = tem;
UNGCPRO;
}
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;
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);
/* 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
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. */
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. */
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. */
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,
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. */
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,
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;
}
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;
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);
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);
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;
/* 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++;
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);
/* 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--;
/* 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++;
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 */
{
#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;
}
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))
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);
&& 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)))
{
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;
#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 */
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))
{
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
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);
}
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;
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;
}
{
/* 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;
}
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. */
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;
}
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;
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;
}
/* 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;
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)
{
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. */
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);
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);
}
/* 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;
}
/* 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;
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;
}
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));
}
}
}
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
()
{
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;
}
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,
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 ();
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);
{
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;
}
}
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
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)
{
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);
{
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))
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);
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))
}
}
- 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))
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;
}
}
- 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;
--- /dev/null
+;; 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))))
{
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))
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 ();
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
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
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;
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;
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')
{
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')
{
{
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))
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;
switch (*p++)
{
case 0240:
- if (! NILP (current_buffer->enable_multibyte_characters))
+ if (! NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)))
return column;
case ' ':
column++;
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;
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);
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;
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
}
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). */
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;
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)
{
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
{
if (nchars == 0)
return;
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)))
nchars = nbytes;
if (prepare)
/* 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
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
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);
/* 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;
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;
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
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);
/* 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
/* 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;
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
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
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;
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;
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);
{
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
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)
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;
int have_overlays;
EMACS_INT original_position;
- current_buffer->point_before_scroll = Qnil;
+ BUF_POINT_BEFORE_SCROLL (current_buffer) = Qnil;
if (charpos == PT)
return;
if (EQ (type, Qkeymap))
return Qnil;
else
- return buffer->keymap;
+ return BUF_KEYMAP (buffer);
}
\f
/* Produce an interval tree reflecting the intervals in
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 */
&& (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))
&& (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))
!= 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));
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
/* 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
/* 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
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);
if (!NILP (keymap))
keymap = get_keymap (keymap, 1, 1);
- current_buffer->keymap = keymap;
+ BUF_KEYMAP (current_buffer) = keymap;
return Qnil;
}
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,
*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))
{
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
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
/* 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. */
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);
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);
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--;
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--;
/* 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;
{
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))
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);
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);
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;
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;
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;
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;
if (b == 0)
return;
- if (EQ (b->name, Qnil))
+ if (EQ (BUF_NAME (b), Qnil))
abort ();
marker->buffer = 0;
CHECK_STRING (initial);
}
val = Qnil;
- ambient_dir = current_buffer->directory;
+ ambient_dir = BUF_DIRECTORY (current_buffer);
input_method = Qnil;
enable_multibyte = Qnil;
/* `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. */
/* 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
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;
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;
}
}
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);
}
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)))
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 ();
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));
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);
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 \
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) \
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); \
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);
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);
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
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 ();
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 ('>');
}
}
else if (BUFFERP (obj))
{
- if (NILP (XBUFFER (obj)->name))
+ if (NILP (BUF_NAME (XBUFFER (obj))))
strout ("#<killed buffer>", -1, -1, printcharfun, 0);
else if (escapeflag)
{
strout ("#<buffer ", -1, -1, printcharfun, 0);
- print_string (XBUFFER (obj)->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))
{
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;
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 ('>');
;
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]);
{
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
{
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)
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);
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))
{
{
struct gcpro gcpro1, gcpro2;
- current_dir = current_buffer->directory;
+ current_dir = BUF_DIRECTORY (current_buffer);
GCPRO2 (buffer, current_dir);
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;
}
}
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;
}
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;
}
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
}
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
{
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);
}
/* 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;
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,
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)
/* 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);
}
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))
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))
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);
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)
/* 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);
&& 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;
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 */
}
/* 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;
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);
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)
}
/* 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)
(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
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. */
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. */
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
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;
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);
}
}
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);
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);
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,
{
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);
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);
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);
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);
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--;
/* 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
# 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))
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)
{
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,
{
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))
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,
{
Lisp_Object sbeg;
- if (EQ (current_buffer->undo_list, Qt))
+ if (EQ (BUF_UNDO_LIST (current_buffer), Qt))
return;
if (PT == beg + SCHARS (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.
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. */
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,
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)
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)
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. */
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;
}
()
{
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. */
{
/* 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;
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;
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);
}
/* 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)
{
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);
{
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);
}
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,
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. */
/* 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;
{
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);
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);
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)
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;
{
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;
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
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. */
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;
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
{
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
&& 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));
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)
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
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,
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;
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
&& 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);
}
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;
&& (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;
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;
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);
/* 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];
}
}
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;
Lisp_Object string;
string = Fcurrent_message ();
message3 (string, SBYTES (string),
- !NILP (current_buffer->enable_multibyte_characters));
+ !NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)));
}
}
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;
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; */
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);
/* 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)
{
/* 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. */
{
/* 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;
}
}
}
/* 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);
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;
}
}
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;
< 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;
< 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;
/* 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;
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
/* 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)
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);
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))
{
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))
{
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. */
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,
/* 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))
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)
/* 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;
/* 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. */
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
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)
{
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;
/* 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;
}
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. */
switch (c)
{
case '*':
- if (!NILP (b->read_only))
+ if (!NILP (BUF_READ_ONLY (b)))
return "%";
if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
return "*";
/* 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 "-";
}
case 'b':
- obj = b->name;
+ obj = BUF_NAME (b);
break;
case 'c':
return "Emacs";
case 'f':
- obj = b->filename;
+ obj = BUF_FILENAME (b);
break;
case 'i':
break;
case 'm':
- obj = b->mode_name;
+ obj = BUF_MODE_NAME (b);
break;
case 'n':
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
(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. */
/* 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)
{
{
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;
}
/* 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. */
/* 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. */
{
int face_id;
- if (NILP (current_buffer->enable_multibyte_characters))
+ if (NILP (BUF_ENABLE_MULTIBYTE_CHARACTERS (current_buffer)))
ch = 0;
if (NILP (prop))
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 ();
/* 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);