diff --git a/src/buffer.c b/src/buffer.c index ab47748191..2f8cb1d7c5 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -133,6 +133,69 @@ CHECK_OVERLAY (Lisp_Object x) /* These setters are used only in this file, so they can be private. The public setters are inline functions defined in buffer.h. */ + + +/* *************************************************************************** */ +/* begin MULTIPLE-CURSORS */ + +static void +bset_mc_real_fake_cursor (struct buffer *b, Lisp_Object val) +{ + b->mc_real_fake_cursor_ = val; +} + +static void +bset_mc_conf (struct buffer *b, Lisp_Object val) +{ + b->mc_conf_ = val; +} + +static void +bset_mc_inactive_windows (struct buffer *b, Lisp_Object val) +{ + b->mc_inactive_windows_ = val; +} + +static void +bset_crosshairs (struct buffer *b, Lisp_Object val) +{ + b->crosshairs_ = val; +} + +static void +bset_ch_horizontal_ruler (struct buffer *b, Lisp_Object val) +{ + b->ch_horizontal_ruler_ = val; +} + +static void +bset_ch_vertical_ruler (struct buffer *b, Lisp_Object val) +{ + b->ch_vertical_ruler_ = val; +} + +static void +bset_ch_inactive_windows (struct buffer *b, Lisp_Object val) +{ + b->ch_inactive_windows_ = val; +} + +static void +bset_fc_visible (struct buffer *b, Lisp_Object val) +{ + b->fc_visible_ = val; +} + +static void +bset_fc_inactive_windows (struct buffer *b, Lisp_Object val) +{ + b->fc_inactive_windows_ = val; +} + +/* end MULTIPLE-CURSORS */ +/* *************************************************************************** */ + + static void bset_abbrev_mode (struct buffer *b, Lisp_Object val) { @@ -5142,6 +5205,24 @@ init_buffer_once (void) bset_last_selected_window (&buffer_local_flags, make_fixnum (0)); idx = 1; + + +/* *************************************************************************** */ +/* MULTIPLE-CURSORS */ + + XSETFASTINT (BVAR (&buffer_local_flags, mc_real_fake_cursor), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, mc_conf), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, mc_inactive_windows), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, crosshairs), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, ch_horizontal_ruler), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, ch_vertical_ruler), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, ch_inactive_windows), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, fc_visible), idx); ++idx; + XSETFASTINT (BVAR (&buffer_local_flags, fc_inactive_windows), idx); ++idx; + +/* *************************************************************************** */ + + XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, abbrev_mode), idx); ++idx; XSETFASTINT (BVAR (&buffer_local_flags, overwrite_mode), idx); ++idx; @@ -5228,6 +5309,24 @@ init_buffer_once (void) /* Must do these before making the first buffer! */ /* real setup is done in bindings.el */ + + +/* *************************************************************************** */ +/* MULTIPLE-CURSORS */ + + bset_mc_real_fake_cursor (&buffer_defaults, Qt); + bset_mc_conf (&buffer_defaults, Qnil); + bset_mc_inactive_windows (&buffer_defaults, Qt); + bset_crosshairs (&buffer_defaults, Qnil); + bset_ch_horizontal_ruler (&buffer_defaults, Qt); + bset_ch_vertical_ruler (&buffer_defaults, Qt); + bset_ch_inactive_windows (&buffer_defaults, Qt); + bset_fc_visible (&buffer_defaults, Qnil); + bset_fc_inactive_windows (&buffer_defaults, Qt); + +/* *************************************************************************** */ + + bset_mode_line_format (&buffer_defaults, build_pure_c_string ("%-")); bset_header_line_format (&buffer_defaults, Qnil); bset_abbrev_mode (&buffer_defaults, Qnil); @@ -5464,6 +5563,23 @@ syms_of_buffer (void) staticpro (&QSFundamental); staticpro (&Vbuffer_alist); + +/* *************************************************************************** */ +/* MULTIPLE-CURSORS */ + + DEFSYM (Qmc_real_fake_cursor, "mc-real-fake-cursor"); + DEFSYM (Qmc_conf, "mc-conf"); + DEFSYM (Qmc_inactive_windows, "mc-inactive-windows"); + DEFSYM (Qcrosshairs, "crosshairs"); + DEFSYM (Qch_horizontal_ruler, "ch-horizontal-ruler"); + DEFSYM (Qch_vertical_ruler, "ch-vertical-ruler"); + DEFSYM (Qch_inactive_windows, "ch-inactive-windows"); + DEFSYM (Qfc_visible, "fc-visible"); + DEFSYM (Qfc_visible_inactive_window, "fc-inactive-window"); + +/* *************************************************************************** */ + + DEFSYM (Qchoice, "choice"); DEFSYM (Qleft, "left"); DEFSYM (Qright, "right"); @@ -5501,6 +5617,41 @@ syms_of_buffer (void) Fput (Qprotected_field, Qerror_message, build_pure_c_string ("Attempt to modify a protected field")); + +/* *************************************************************************** */ +/* MULTIPLE-CURSORS */ + + DEFVAR_PER_BUFFER ("mc-real-fake-cursor", &BVAR (current_buffer, mc_real_fake_cursor), Qnil, + doc: /* A bufer-local variable to set the cursor type of the real fake cursor. */); + + DEFVAR_PER_BUFFER ("mc-conf", &BVAR (current_buffer, mc_conf), Qnil, + doc: /* A bufer-local variable to store the value of the multiple cursors to be displayed +during the next redisplay. */); + + DEFVAR_PER_BUFFER ("mc-inactive-windows", &BVAR (current_buffer, mc_inactive_windows), Qnil, + doc: /* When non-nil, draw multiple cursors in inactive windows. */); + + DEFVAR_PER_BUFFER ("crosshairs", &BVAR (current_buffer, crosshairs), Qnil, + doc: /* A bufer-local variable to activate/deactivate crosshairs. */); + + DEFVAR_PER_BUFFER ("ch-horizontal-ruler", &BVAR (current_buffer, ch_horizontal_ruler), Qnil, + doc: /* A bufer-local variable to activate/deactivate the crosshairs horizontal ruler. */); + + DEFVAR_PER_BUFFER ("ch-vertical-ruler", &BVAR (current_buffer, ch_vertical_ruler), Qnil, + doc: /* A bufer-local variable to activate/deactivate the crosshairs vertical ruler. */); + + DEFVAR_PER_BUFFER ("ch-inactive-windows", &BVAR (current_buffer, ch_inactive_windows), Qnil, + doc: /* When non-nil, draw crosshairs in inactive windows. */); + + DEFVAR_PER_BUFFER ("fc-visible", &BVAR (current_buffer, fc_visible), Qnil, + doc: /* A bufer-local variable to turn on/off the multiple cursors fill column. */); + + DEFVAR_PER_BUFFER ("fc-inactive-windows", &BVAR (current_buffer, fc_inactive_windows), Qnil, + doc: /* When non-nil, draw multiple cursors fill column in inactive windows. */); + +/* *************************************************************************** */ + + DEFVAR_PER_BUFFER ("header-line-format", &BVAR (current_buffer, header_line_format), Qnil, diff --git a/src/buffer.h b/src/buffer.h index 63b162161c..4dd91911da 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -636,6 +636,40 @@ struct buffer cache are enabled. See search.c, indent.c and bidi.c for details. */ Lisp_Object cache_long_scans_; + +/* *************************************************************************** */ +/* MULTIPLE-CURSORS */ + + /* The cursor type of the real fake cursor. */ + Lisp_Object mc_real_fake_cursor_; + + /* The name of list used by multiple cursors for next redisplay. */ + Lisp_Object mc_conf_; + + /* Whether to draw multiple cursors in inactive windows. */ + Lisp_Object mc_inactive_windows_; + + /* The name of the buffer-local variable. */ + Lisp_Object crosshairs_; + + /* The name of the crosshairs horizontal ruler. */ + Lisp_Object ch_horizontal_ruler_; + + /* The name of the crosshairs vertical ruler. */ + Lisp_Object ch_vertical_ruler_; + + /* Whether to draw crosshairs in inactive windows. */ + Lisp_Object ch_inactive_windows_; + + /* The name of the buffer-local variable. */ + Lisp_Object fc_visible_; + + /* Whether to draw multiple cursors fill column in inactive windows. */ + Lisp_Object fc_inactive_windows_; + +/* *************************************************************************** */ + + /* If the width run cache is enabled, this table contains the character widths width_run_cache (see above) assumes. When we do a thorough redisplay, we compare this against the buffer's @@ -787,14 +821,21 @@ struct buffer an indirect buffer since it counts as its base buffer. */ int window_count; + +/* *************************************************************************** */ +/* MULTIPLE-CURSORS */ + /* A non-zero value in slot IDX means that per-buffer variable with index IDX has a local value in this buffer. The index IDX for a buffer-local variable is stored in that variable's slot in buffer_local_flags as a Lisp integer. If the index is -1, this means the variable is always local in all buffers. */ -#define MAX_PER_BUFFER_VARS 50 +#define MAX_PER_BUFFER_VARS 60 char local_flags[MAX_PER_BUFFER_VARS]; +/* *************************************************************************** */ + + /* Set to the modtime of the visited file when read or written. modtime.tv_nsec == NONEXISTENT_MODTIME_NSECS means visited file was nonexistent. modtime.tv_nsec == @@ -903,6 +944,69 @@ XBUFFER (Lisp_Object a) /* Most code should use these functions to set Lisp fields in struct buffer. (Some setters that are private to a single .c file are defined as static in those files.) */ + + +/* *************************************************************************** */ +/* begin MULTIPLE-CURSORS */ + +INLINE void +bset_blv_mc_real_fake_cursor (struct buffer *b, Lisp_Object val) +{ + b->mc_real_fake_cursor_ = val; +} + +INLINE void +bset_blv_mc_conf (struct buffer *b, Lisp_Object val) +{ + b->mc_conf_ = val; +} + +INLINE void +bset_blv_mc_inactive_windows (struct buffer *b, Lisp_Object val) +{ + b->mc_inactive_windows_ = val; +} + +INLINE void +bset_blv_crosshairs (struct buffer *b, Lisp_Object val) +{ + b->crosshairs_ = val; +} + +INLINE void +bset_blv_ch_horizontal_ruler (struct buffer *b, Lisp_Object val) +{ + b->ch_horizontal_ruler_ = val; +} + +INLINE void +bset_blv_ch_vertical_ruler (struct buffer *b, Lisp_Object val) +{ + b->ch_vertical_ruler_ = val; +} + +INLINE void +bset_blv_ch_inactive_windows (struct buffer *b, Lisp_Object val) +{ + b->ch_inactive_windows_ = val; +} + +INLINE void +bset_blv_fc_visible (struct buffer *b, Lisp_Object val) +{ + b->fc_visible_ = val; +} + +INLINE void +bset_blv_fc_inactive_windows (struct buffer *b, Lisp_Object val) +{ + b->fc_inactive_windows_ = val; +} + +/* end MULTIPLE-CURSORS */ +/* *************************************************************************** */ + + INLINE void bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val) { diff --git a/src/pdumper.c b/src/pdumper.c index b19f206d1b..0b60f79a6c 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -2770,9 +2770,6 @@ dump_hash_table (struct dump_context *ctx, static dump_off dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer) { -#if CHECK_STRUCTS && !defined HASH_buffer_2CEE653E74 -# error "buffer changed. See CHECK_STRUCTS comment." -#endif struct buffer munged_buffer = *in_buffer; struct buffer *buffer = &munged_buffer;