Next: Window Internals, Up: Object Internals
Two structures (see buffer.h) are used to represent buffers
in C. The buffer_text structure contains fields describing the
text of a buffer; the buffer structure holds other fields. In
the case of indirect buffers, two or more buffer structures
reference the same buffer_text structure.
Here are some of the fields in struct buffer_text:
beggptgpt_bytezz_bytegap_sizemodiffsave_modiffchars_modiffoverlay_modiffmodiff is incremented after each
buffer-modification event, and is never otherwise changed;
save_modiff contains the value of modiff the last time
the buffer was visited or saved; chars_modiff counts only
modifications to the characters in the buffer, ignoring all other
kinds of changes; and overlay_modiff counts only modifications
to the overlays.
beg_unchangedend_unchangedunchanged_modifiedoverlay_unchanged_modifiedmodiff and overlay_modiff, respectively,
after the last complete redisplay. If their current values match
modiff or overlay_modiff, that means
beg_unchanged and end_unchanged contain no useful
information.
markerschain are the other
markers referring to this buffer text.
intervalsSome of the fields of struct buffer are:
headerstruct vectorlike_header structure where header.next
points to the next buffer, in the chain of all buffers (including
killed buffers). This chain is used only for garbage collection, in
order to collect killed buffers properly. Note that vectors, and most
kinds of objects allocated as vectors, are all on one chain, but
buffers are on a separate chain of their own.
own_textstruct buffer_text structure that ordinarily holds the buffer
contents. In indirect buffers, this field is not used.
textbuffer_text structure for this buffer. In an
ordinary buffer, this is the own_text field above. In an
indirect buffer, this is the own_text field of the base buffer.
ptpt_bytebegvbegv_bytezvzv_bytebase_bufferlocal_flagsDEFVAR_PER_BUFFER, and their buffer-local bindings are stored
in fields in the buffer structure itself. (Some of these fields are
described in this table.)
modtimeauto_save_modifiedlast_window_startwindow-start position in the buffer as of the last time the
buffer was displayed in a window.
clip_changedprevent_redisplay_optimizations_poverlay_centeroverlays_beforeoverlays_afteroverlays_before is sorted in order of decreasing end position,
and overlays_after is sorted in order of increasing beginning
position.
namesave_lengthbuffer_text structure because indirect buffers are never
saved.
directorydefault-directory (see File Name Expansion).
filenamenil. This is
the value of the buffer-local variable buffer-file-name
(see Buffer File Name).
undo_listbacked_upauto_save_file_nameauto_save_file_formatread_onlyfile_formatfile_truenameinvisibility_specdisplay_countdisplay_timebuffer- and have
underscores replaced with dashes. For instance, undo_list
stores the value of buffer-undo-list.
markmarkers. See The Mark.
local_var_alistmajor_modelisp-mode.
mode_name"Lisp".
keymapabbrev_tablesyntax_tablecategory_tabledisplay_tabledowncase_tableupcase_tablecase_canon_tableminor_modespt_markerbegv_markerzv_markerpt, begv, and zv respectively, for this buffer
when the buffer is not current.
mode_line_formatheader_line_formatcase_fold_searchtab_widthfill_columnleft_marginauto_fill_functiontruncate_linesword_wrapctl_arrowbidi_display_reorderingbidi_paragraph_directionselective_displayselective_display_ellipsesoverwrite_modeabbrev_modemark_activeenable_multibyte_charactersbuffer_file_coding_systemcache_long_line_scanspoint_before_scrollleft_fringe_widthright_fringe_widthfringes_outside_marginsscroll_bar_widthindicate_empty_linesindicate_buffer_boundariesfringe_indicator_alistfringe_cursor_alistscroll_up_aggressivelyscroll_down_aggressivelycursor_typecursor_in_non_selected_windowsmode_line_format stores the value of mode-line-format.
last_selected_windownil
if that window no longer displays this buffer.