#include <config.h>
+#define BUFFER_INLINE EXTERN_INLINE
+
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
Setting the default value also goes through the alist of buffers
and stores into each buffer that does not say it has a local value. */
-DECL_ALIGN (struct buffer, buffer_defaults);
+struct buffer alignas (GCALIGNMENT) buffer_defaults;
/* A Lisp_Object pointer to the above, used for staticpro */
/* This structure holds the names of symbols whose values may be
buffer-local. It is indexed and accessed in the same way as the above. */
-DECL_ALIGN (struct buffer, buffer_local_symbols);
+struct buffer alignas (GCALIGNMENT) buffer_local_symbols;
/* A Lisp_Object pointer to the above, used for staticpro */
static Lisp_Object Vbuffer_local_symbols;
/* Maximum length of an overlay vector. */
#define OVERLAY_COUNT_MAX \
((ptrdiff_t) min (MOST_POSITIVE_FIXNUM, \
- min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object)))
+ min (PTRDIFF_MAX, SIZE_MAX) / word_size))
/* Flags indicating which built-in buffer-local variables
are permanent locals. */
BUF_CHARS_MODIFF (b) = 1;
BUF_OVERLAY_MODIFF (b) = 1;
BUF_SAVE_MODIFF (b) = 1;
- BUF_INTERVALS (b) = 0;
+ buffer_set_intervals (b, NULL);
BUF_UNCHANGED_MODIFIED (b) = 1;
BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1;
BUF_END_UNCHANGED (b) = 0;
BVAR (b, zv_marker) = Qnil;
name = Fcopy_sequence (buffer_or_name);
- STRING_SET_INTERVALS (name, NULL_INTERVAL);
+ string_set_intervals (name, NULL);
BVAR (b, name) = name;
BVAR (b, undo_list) = (SREF (name, 0) != ' ') ? Qnil : Qt;
all_buffers = b;
name = Fcopy_sequence (name);
- STRING_SET_INTERVALS (name, NULL_INTERVAL);
+ string_set_intervals (name, NULL);
BVAR (b, name) = name;
reset_buffer (b);
drop_overlay (struct buffer *b, struct Lisp_Overlay *ov)
{
eassert (b == XBUFFER (Fmarker_buffer (ov->start)));
- modify_overlay (b, marker_position (ov->start), marker_position (ov->end));
+ modify_overlay (b, marker_position (ov->start),
+ marker_position (ov->end));
Fset_marker (ov->start, Qnil, Qnil);
Fset_marker (ov->end, Qnil, Qnil);
/* Skip dead buffers, indirect buffers and buffers
which aren't changed since last compaction. */
- if (!NILP (buffer->BUFFER_INTERNAL_FIELD (name))
+ if (!NILP (buffer->INTERNAL_FIELD (name))
&& (buffer->base_buffer == NULL)
&& (buffer->text->compact != buffer->text->modiff))
{
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 (buffer->BUFFER_INTERNAL_FIELD (undo_list), Qt))
+ if (!EQ (buffer->INTERNAL_FIELD (undo_list), Qt))
truncate_undo_list (buffer);
/* Shrink buffer gaps. */
if (EQ (buffer, XWINDOW (minibuf_window)->buffer))
return Qnil;
- /* Notify our base buffer that we don't share the text anymore. */
- if (b->base_buffer)
- {
- eassert (b->indirections == -1);
- b->base_buffer->indirections--;
- eassert (b->base_buffer->indirections >= 0);
- }
-
/* When we kill an ordinary buffer which shares it's buffer text
with indirect buffer(s), we must kill indirect buffer(s) too.
We do it at this stage so nothing terrible happens if they
m = next;
}
BUF_MARKERS (b) = NULL;
- BUF_INTERVALS (b) = NULL_INTERVAL;
+ buffer_set_intervals (b, NULL);
/* Perhaps we should explicitly free the interval tree here... */
}
BVAR (b, name) = Qnil;
BLOCK_INPUT;
- if (! b->base_buffer)
+ if (b->base_buffer)
+ {
+ /* Notify our base buffer that we don't share the text anymore. */
+ eassert (b->indirections == -1);
+ b->base_buffer->indirections--;
+ eassert (b->base_buffer->indirections >= 0);
+ }
+ else
+ /* No one shares our buffer text, can free it. */
free_buffer_text (b);
if (b->newline_cache)
Vinhibit_quit = tem;
/* Update buffer list of selected frame. */
- f->buffer_list = Fcons (buffer, Fdelq (buffer, f->buffer_list));
- f->buried_buffer_list = Fdelq (buffer, f->buried_buffer_list);
+ FSET (f, buffer_list, Fcons (buffer, Fdelq (buffer, f->buffer_list)));
+ FSET (f, buried_buffer_list, Fdelq (buffer, f->buried_buffer_list));
/* Run buffer-list-update-hook. */
if (!NILP (Vrun_hooks))
Vinhibit_quit = tem;
/* Update buffer lists of selected frame. */
- f->buffer_list = Fdelq (buffer, f->buffer_list);
- f->buried_buffer_list = Fcons (buffer, Fdelq (buffer, f->buried_buffer_list));
+ FSET (f, buffer_list, Fdelq (buffer, f->buffer_list));
+ FSET (f, buried_buffer_list,
+ Fcons (buffer, Fdelq (buffer, f->buried_buffer_list)));
/* Run buffer-list-update-hook. */
if (!NILP (Vrun_hooks))
&& (EQ (XWINDOW (w)->buffer, buf1)
|| EQ (XWINDOW (w)->buffer, buf2)))
Fset_marker (XWINDOW (w)->pointm,
- make_number (BUF_BEGV (XBUFFER (XWINDOW (w)->buffer))),
+ make_number
+ (BUF_BEGV (XBUFFER (XWINDOW (w)->buffer))),
XWINDOW (w)->buffer);
w = Fnext_window (w, Qt, Qt);
}
}
/* It wasn't in the list, so add it to the front. */
changed = !NILP (value);
- XOVERLAY (overlay)->plist
- = Fcons (prop, Fcons (value, XOVERLAY (overlay)->plist));
+ set_overlay_plist
+ (overlay, Fcons (prop, Fcons (value, XOVERLAY (overlay)->plist)));
found:
if (! NILP (buffer))
{
ptrdiff_t i;
memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents,
- size * sizeof (Lisp_Object));
+ size * word_size);
gcpro1.var = copy;
gcpro1.nvars = size;
sure that this is still correct. Otherwise, mark_vectorlike may not
trace all Lisp_Objects in buffer_defaults and buffer_local_symbols. */
const int pvecsize
- = (offsetof (struct buffer, own_text) - sizeof (struct vectorlike_header))
- / sizeof (Lisp_Object);
+ = (offsetof (struct buffer, own_text) - header_size) / word_size;
memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags);
/* Prevent GC from getting confused. */
buffer_defaults.text = &buffer_defaults.own_text;
buffer_local_symbols.text = &buffer_local_symbols.own_text;
- BUF_INTERVALS (&buffer_defaults) = 0;
- BUF_INTERVALS (&buffer_local_symbols) = 0;
+ /* No one will share the text with these buffers, but let's play it safe. */
+ buffer_defaults.indirections = 0;
+ buffer_local_symbols.indirections = 0;
+ buffer_set_intervals (&buffer_defaults, NULL);
+ buffer_set_intervals (&buffer_local_symbols, NULL);
XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize);
XSETBUFFER (Vbuffer_defaults, &buffer_defaults);
XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize);
The local flag bits are in the local_var_flags slot of the buffer. */
/* Nothing can work if this isn't true */
- { verify (sizeof (EMACS_INT) == sizeof (Lisp_Object)); }
+ { verify (sizeof (EMACS_INT) == word_size); }
/* 0 means not a lisp var, -1 means always local, else mask */
memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions");
Fput (Qprotected_field, Qerror_conditions,
- pure_cons (Qprotected_field, pure_cons (Qerror, Qnil)));
+ listn (CONSTYPE_PURE, 2, Qprotected_field, Qerror));
Fput (Qprotected_field, Qerror_message,
build_pure_c_string ("Attempt to modify a protected field"));
doc: /* Non-nil if searches and matches should ignore case. */);
DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column),
- make_number (LISP_INT_TAG),
+ make_number (Lisp_Int0),
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", &BVAR (current_buffer, left_margin),
- make_number (LISP_INT_TAG),
+ make_number (Lisp_Int0),
doc: /* Column for the default `indent-line-function' to indent to.
Linefeed indents to this column in Fundamental mode. */);
DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width),
- make_number (LISP_INT_TAG),
+ make_number (Lisp_Int0),
doc: /* Distance between tab stops (for display of tab characters), in columns.
This should be an integer greater than zero. */);
Backing up is done before the first time the file is saved. */);
DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length),
- make_number (LISP_INT_TAG),
+ make_number (Lisp_Int0),
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.