From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#48264: [PATCH v3 15/15] Add and use BVAR_FIELD macros Date: Thu, 6 May 2021 17:33:46 -0400 Message-ID: <20210506213346.9730-16-sbaugh@catern.com> References: <877dkbsj9d.fsf@catern.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15543"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Spencer Baugh To: 48264@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 06 23:37:51 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lelgt-0003pw-3y for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 06 May 2021 23:37:51 +0200 Original-Received: from localhost ([::1]:39948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lelgs-0000Sl-64 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 06 May 2021 17:37:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leleE-0006XD-LV for bug-gnu-emacs@gnu.org; Thu, 06 May 2021 17:35:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56591) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1leleE-0002S2-6y for bug-gnu-emacs@gnu.org; Thu, 06 May 2021 17:35:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1leleE-0000FK-4V for bug-gnu-emacs@gnu.org; Thu, 06 May 2021 17:35:06 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 06 May 2021 21:35:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48264 X-GNU-PR-Package: emacs Original-Received: via spool by 48264-submit@debbugs.gnu.org id=B48264.1620336860861 (code B ref 48264); Thu, 06 May 2021 21:35:06 +0000 Original-Received: (at 48264) by debbugs.gnu.org; 6 May 2021 21:34:20 +0000 Original-Received: from localhost ([127.0.0.1]:39893 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1leldS-0000Dk-EN for submit@debbugs.gnu.org; Thu, 06 May 2021 17:34:20 -0400 Original-Received: from venus.catern.com ([68.183.49.163]:41534) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1leldF-0000B5-MX for 48264@debbugs.gnu.org; Thu, 06 May 2021 17:34:09 -0400 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=98.7.229.235; helo=localhost; envelope-from=sbaugh@catern.com; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=catern.com; s=mail; t=1620336845; bh=q2dZEn/ggv4TFXPAy5S+UQXcPxJqtbDgn/lyRTjDkuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=f5gu4dtR2TzRdcK6tQaVg3AXBEY3LjR43L7jxImBCta1CXSieWw8cc0Ennab04Kuy hp4JOs5rdsgT7yCDYu/m02r7xPXW7T44d3tVkfWwrwMSaGjDKhyQZP1am4jUppKa7/ 1ht24mrz6nPKddcHFFCfJxZc4A6x6QGflzIxBiTM= Original-Received: from localhost (cpe-98-7-229-235.nyc.res.rr.com [98.7.229.235]) by venus.catern.com (Postfix) with ESMTPSA id 617C12E966D; Thu, 6 May 2021 21:34:05 +0000 (UTC) X-Mailer: git-send-email 2.31.1 In-Reply-To: <877dkbsj9d.fsf@catern.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:205894 Archived-At: By using the BVAR_FIELD and BVAR_DEFAULTED_FIELD macros anywhere we would otherwise use the raw name of a buffer field (which is only in a few places), we can make sure that BVAR and BVAR_OR_DEFAULT are used on the correct fields. * src/alloc.c (allocate_buffer): * src/buffer.c (bset_abbrev_mode): (bset_bidi_display_reordering): (bset_fringe_cursor_alist): (bset_left_fringe_width): (bset_mode_line_format): (bset_overwrite_mode): (bset_right_fringe_width): (bset_scroll_bar_width): (reset_buffer_local_variables): (init_buffer_once): (syms_of_buffer): * src/buffer.h (BVAR_DEFAULTED_FIELD): (struct buffer): (bset_bidi_paragraph_direction): (bset_left_margin_cols): (bset_truncate_lines): (PER_BUFFER_VAR_DEFAULTED_OFFSET): * src/category.c (bset_category_table): * src/syntax.c (bset_syntax_table): Use BVAR_FIELD, BVAR_DEFAULTED_FIELD, and BVAR_DEFAULTED. --- src/alloc.c | 3 +- src/buffer.c | 166 ++++++++++++++++++++++----------------------- src/buffer.h | 180 ++++++++++++++++++++++++++----------------------- src/category.c | 2 +- src/category.h | 2 +- src/syntax.c | 2 +- src/syntax.h | 2 +- 7 files changed, 183 insertions(+), 174 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index 76d8c7ddd1..b711aa904c 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3389,7 +3389,8 @@ struct buffer * allocate_buffer (void) { struct buffer *b - = ALLOCATE_PSEUDOVECTOR (struct buffer, cursor_in_non_selected_windows_, + = ALLOCATE_PSEUDOVECTOR (struct buffer, + BVAR_DEFAULTED_FIELD (cursor_in_non_selected_windows), PVEC_BUFFER); BUFFER_PVEC_INIT (b); /* Note that the rest fields of B are not initialized. */ diff --git a/src/buffer.c b/src/buffer.c index abf112a898..e048e7559f 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -122,17 +122,17 @@ fix_position (Lisp_Object pos) static void bset_abbrev_mode (struct buffer *b, Lisp_Object val) { - b->abbrev_mode_ = val; + b->BVAR_DEFAULTED_FIELD(abbrev_mode) = val; } static void bset_abbrev_table (struct buffer *b, Lisp_Object val) { - b->abbrev_table_ = val; + b->BVAR_DEFAULTED_FIELD(abbrev_table) = val; } static void bset_auto_fill_function (struct buffer *b, Lisp_Object val) { - b->auto_fill_function_ = val; + b->BVAR_DEFAULTED_FIELD(auto_fill_function) = val; } static void bset_auto_save_file_format (struct buffer *b, Lisp_Object val) @@ -157,52 +157,52 @@ bset_begv_marker (struct buffer *b, Lisp_Object val) static void bset_bidi_display_reordering (struct buffer *b, Lisp_Object val) { - b->bidi_display_reordering_ = val; + b->BVAR_DEFAULTED_FIELD(bidi_display_reordering) = val; } static void bset_bidi_paragraph_start_re (struct buffer *b, Lisp_Object val) { - b->bidi_paragraph_start_re_ = val; + b->BVAR_DEFAULTED_FIELD(bidi_paragraph_start_re) = val; } static void bset_bidi_paragraph_separate_re (struct buffer *b, Lisp_Object val) { - b->bidi_paragraph_separate_re_ = val; + b->BVAR_DEFAULTED_FIELD(bidi_paragraph_separate_re) = val; } static void bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val) { - b->buffer_file_coding_system_ = val; + b->BVAR_DEFAULTED_FIELD(buffer_file_coding_system) = val; } static void bset_case_fold_search (struct buffer *b, Lisp_Object val) { - b->case_fold_search_ = val; + b->BVAR_DEFAULTED_FIELD(case_fold_search) = val; } static void bset_ctl_arrow (struct buffer *b, Lisp_Object val) { - b->ctl_arrow_ = val; + b->BVAR_DEFAULTED_FIELD(ctl_arrow) = val; } static void bset_cursor_in_non_selected_windows (struct buffer *b, Lisp_Object val) { - b->cursor_in_non_selected_windows_ = val; + b->BVAR_DEFAULTED_FIELD(cursor_in_non_selected_windows) = val; } static void bset_cursor_type (struct buffer *b, Lisp_Object val) { - b->cursor_type_ = val; + b->BVAR_DEFAULTED_FIELD(cursor_type) = val; } static void bset_display_table (struct buffer *b, Lisp_Object val) { - b->display_table_ = val; + b->BVAR_DEFAULTED_FIELD(display_table) = val; } static void bset_extra_line_spacing (struct buffer *b, Lisp_Object val) { - b->extra_line_spacing_ = val; + b->BVAR_DEFAULTED_FIELD(extra_line_spacing) = val; } static void bset_file_format (struct buffer *b, Lisp_Object val) @@ -217,37 +217,37 @@ bset_file_truename (struct buffer *b, Lisp_Object val) static void bset_fringe_cursor_alist (struct buffer *b, Lisp_Object val) { - b->fringe_cursor_alist_ = val; + b->BVAR_DEFAULTED_FIELD(fringe_cursor_alist) = val; } static void bset_fringe_indicator_alist (struct buffer *b, Lisp_Object val) { - b->fringe_indicator_alist_ = val; + b->BVAR_DEFAULTED_FIELD(fringe_indicator_alist) = val; } static void bset_fringes_outside_margins (struct buffer *b, Lisp_Object val) { - b->fringes_outside_margins_ = val; + b->BVAR_DEFAULTED_FIELD(fringes_outside_margins) = val; } static void bset_header_line_format (struct buffer *b, Lisp_Object val) { - b->header_line_format_ = val; + b->BVAR_DEFAULTED_FIELD(header_line_format) = val; } static void bset_tab_line_format (struct buffer *b, Lisp_Object val) { - b->tab_line_format_ = val; + b->BVAR_DEFAULTED_FIELD(tab_line_format) = val; } static void bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val) { - b->indicate_buffer_boundaries_ = val; + b->BVAR_DEFAULTED_FIELD(indicate_buffer_boundaries) = val; } static void bset_indicate_empty_lines (struct buffer *b, Lisp_Object val) { - b->indicate_empty_lines_ = val; + b->BVAR_DEFAULTED_FIELD(indicate_empty_lines) = val; } static void bset_invisibility_spec (struct buffer *b, Lisp_Object val) @@ -257,7 +257,7 @@ bset_invisibility_spec (struct buffer *b, Lisp_Object val) static void bset_left_fringe_width (struct buffer *b, Lisp_Object val) { - b->left_fringe_width_ = val; + b->BVAR_DEFAULTED_FIELD(left_fringe_width) = val; } static void bset_major_mode (struct buffer *b, Lisp_Object val) @@ -277,7 +277,7 @@ bset_mark (struct buffer *b, Lisp_Object val) static void bset_mode_line_format (struct buffer *b, Lisp_Object val) { - b->mode_line_format_ = val; + b->BVAR_DEFAULTED_FIELD(mode_line_format) = val; } static void bset_mode_name (struct buffer *b, Lisp_Object val) @@ -292,7 +292,7 @@ bset_name (struct buffer *b, Lisp_Object val) static void bset_overwrite_mode (struct buffer *b, Lisp_Object val) { - b->overwrite_mode_ = val; + b->BVAR_DEFAULTED_FIELD(overwrite_mode) = val; } static void bset_pt_marker (struct buffer *b, Lisp_Object val) @@ -302,52 +302,52 @@ bset_pt_marker (struct buffer *b, Lisp_Object val) static void bset_right_fringe_width (struct buffer *b, Lisp_Object val) { - b->right_fringe_width_ = val; + b->BVAR_DEFAULTED_FIELD(right_fringe_width) = val; } static void bset_scroll_bar_width (struct buffer *b, Lisp_Object val) { - b->scroll_bar_width_ = val; + b->BVAR_DEFAULTED_FIELD(scroll_bar_width) = val; } static void bset_scroll_bar_height (struct buffer *b, Lisp_Object val) { - b->scroll_bar_height_ = val; + b->BVAR_DEFAULTED_FIELD(scroll_bar_height) = val; } static void bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val) { - b->scroll_down_aggressively_ = val; + b->BVAR_DEFAULTED_FIELD(scroll_down_aggressively) = val; } static void bset_scroll_up_aggressively (struct buffer *b, Lisp_Object val) { - b->scroll_up_aggressively_ = val; + b->BVAR_DEFAULTED_FIELD(scroll_up_aggressively) = val; } static void bset_selective_display (struct buffer *b, Lisp_Object val) { - b->selective_display_ = val; + b->BVAR_DEFAULTED_FIELD(selective_display) = val; } static void bset_selective_display_ellipses (struct buffer *b, Lisp_Object val) { - b->selective_display_ellipses_ = val; + b->BVAR_DEFAULTED_FIELD(selective_display_ellipses) = val; } static void bset_vertical_scroll_bar_type (struct buffer *b, Lisp_Object val) { - b->vertical_scroll_bar_type_ = val; + b->BVAR_DEFAULTED_FIELD(vertical_scroll_bar_type) = val; } static void bset_horizontal_scroll_bar_type (struct buffer *b, Lisp_Object val) { - b->horizontal_scroll_bar_type_ = val; + b->BVAR_DEFAULTED_FIELD(horizontal_scroll_bar_type) = val; } static void bset_word_wrap (struct buffer *b, Lisp_Object val) { - b->word_wrap_ = val; + b->BVAR_DEFAULTED_FIELD(word_wrap) = val; } static void bset_zv_marker (struct buffer *b, Lisp_Object val) @@ -1062,9 +1062,9 @@ reset_buffer_local_variables (struct buffer *b, bool permanent_too) /* Special case these two for backwards-compat; they're flagged as permanent-locals in bindings.el, even though they do have default values. */ - || (offset != PER_BUFFER_VAR_OFFSET (truncate_lines) + || (offset != PER_BUFFER_VAR_DEFAULTED_OFFSET (truncate_lines) && offset != - PER_BUFFER_VAR_OFFSET (buffer_file_coding_system))))) + PER_BUFFER_VAR_DEFAULTED_OFFSET (buffer_file_coding_system))))) KILL_PER_BUFFER_VALUE (b, offset); } } @@ -5098,8 +5098,8 @@ init_buffer_once (void) FOR_EACH_PER_BUFFER_OBJECT_AT (offset) { /* These are initialized before us. */ - if (!(offset == PER_BUFFER_VAR_OFFSET (syntax_table) - || offset == PER_BUFFER_VAR_OFFSET (category_table))) + if (!(offset == PER_BUFFER_VAR_DEFAULTED_OFFSET (syntax_table) + || offset == PER_BUFFER_VAR_DEFAULTED_OFFSET (category_table))) set_per_buffer_default (offset, Qunbound); } set_per_buffer_default (PER_BUFFER_VAR_OFFSET (undo_list), Qunbound); @@ -5117,7 +5117,7 @@ init_buffer_once (void) bset_abbrev_table (&buffer_defaults, Qnil); bset_display_table (&buffer_defaults, Qnil); - XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8); + XSETFASTINT (BVAR_DEFAULTED (&buffer_defaults, tab_width), 8); bset_truncate_lines (&buffer_defaults, Qnil); bset_word_wrap (&buffer_defaults, Qnil); bset_ctl_arrow (&buffer_defaults, Qt); @@ -5130,11 +5130,11 @@ init_buffer_once (void) bset_cursor_in_non_selected_windows (&buffer_defaults, Qt); bset_buffer_file_coding_system (&buffer_defaults, Qnil); - XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); - XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); + XSETFASTINT (BVAR_DEFAULTED (&buffer_defaults, fill_column), 70); + XSETFASTINT (BVAR_DEFAULTED (&buffer_defaults, left_margin), 0); bset_cache_long_scans (&buffer_defaults, Qt); - XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); - XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0); + XSETFASTINT (BVAR_DEFAULTED (&buffer_defaults, left_margin_cols), 0); + XSETFASTINT (BVAR_DEFAULTED (&buffer_defaults, right_margin_cols), 0); bset_left_fringe_width (&buffer_defaults, Qnil); bset_right_fringe_width (&buffer_defaults, Qnil); bset_fringes_outside_margins (&buffer_defaults, Qnil); @@ -5363,20 +5363,20 @@ syms_of_buffer (void) build_pure_c_string ("Attempt to modify a protected field")); DEFVAR_PER_BUFFER ("tab-line-format", - &BVAR (current_buffer, tab_line_format), + &BVAR_DEFAULTED (current_buffer, tab_line_format), Qnil, doc: /* Analogous to `mode-line-format', but controls the tab line. The tab line appears, optionally, at the top of a window; the mode line appears at the bottom. */); DEFVAR_PER_BUFFER ("header-line-format", - &BVAR (current_buffer, header_line_format), + &BVAR_DEFAULTED (current_buffer, header_line_format), 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", &BVAR (current_buffer, mode_line_format), + DEFVAR_PER_BUFFER ("mode-line-format", &BVAR_DEFAULTED (current_buffer, mode_line_format), Qnil, doc: /* Template for displaying mode line for current buffer. @@ -5462,18 +5462,18 @@ 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", &BVAR (current_buffer, abbrev_table), Qnil, + DEFVAR_PER_BUFFER ("local-abbrev-table", &BVAR_DEFAULTED (current_buffer, abbrev_table), Qnil, doc: /* Local (mode-specific) abbrev table of current buffer. */); - DEFVAR_PER_BUFFER ("abbrev-mode", &BVAR (current_buffer, abbrev_mode), Qnil, + DEFVAR_PER_BUFFER ("abbrev-mode", &BVAR_DEFAULTED (current_buffer, abbrev_mode), Qnil, doc: /* Non-nil if Abbrev mode is enabled. Use the command `abbrev-mode' to change this variable. */); - DEFVAR_PER_BUFFER ("case-fold-search", &BVAR (current_buffer, case_fold_search), + DEFVAR_PER_BUFFER ("case-fold-search", &BVAR_DEFAULTED (current_buffer, case_fold_search), Qnil, doc: /* Non-nil if searches and matches should ignore case. */); - DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column), + DEFVAR_PER_BUFFER ("fill-column", &BVAR_DEFAULTED (current_buffer, fill_column), Qintegerp, doc: /* Column beyond which automatic line-wrapping should happen. It is used by filling commands, such as `fill-region' and `fill-paragraph', @@ -5481,19 +5481,19 @@ and by `auto-fill-mode', which see. See also `current-fill-column'. Interactively, you can set the buffer local value using \\[set-fill-column]. */); - DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin), + DEFVAR_PER_BUFFER ("left-margin", &BVAR_DEFAULTED (current_buffer, left_margin), Qintegerp, 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), + DEFVAR_PER_BUFFER ("tab-width", &BVAR_DEFAULTED (current_buffer, tab_width), Qintegerp, doc: /* Distance between tab stops (for display of tab characters), in columns. NOTE: This controls the display width of a TAB character, and not the size of an indentation step. This should be an integer greater than zero. */); - DEFVAR_PER_BUFFER ("ctl-arrow", &BVAR (current_buffer, ctl_arrow), Qnil, + DEFVAR_PER_BUFFER ("ctl-arrow", &BVAR_DEFAULTED (current_buffer, ctl_arrow), 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 @@ -5514,7 +5514,7 @@ See also Info node `(elisp)Text Representations'. */); make_symbol_constant (intern_c_string ("enable-multibyte-characters")); DEFVAR_PER_BUFFER ("buffer-file-coding-system", - &BVAR (current_buffer, buffer_file_coding_system), Qnil, + &BVAR_DEFAULTED (current_buffer, buffer_file_coding_system), 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'. @@ -5532,7 +5532,7 @@ The variable `coding-system-for-write', if non-nil, overrides this variable. This variable is never applied to a way of decoding a file while reading it. */); DEFVAR_PER_BUFFER ("bidi-display-reordering", - &BVAR (current_buffer, bidi_display_reordering), Qnil, + &BVAR_DEFAULTED (current_buffer, bidi_display_reordering), Qnil, doc: /* Non-nil means reorder bidirectional text for display in the visual order. Setting this to nil is intended for use in debugging the display code. Don't set to nil in normal sessions, as that is not supported. @@ -5540,7 +5540,7 @@ See also `bidi-paragraph-direction'; setting that non-nil might speed up redisplay. */); DEFVAR_PER_BUFFER ("bidi-paragraph-start-re", - &BVAR (current_buffer, bidi_paragraph_start_re), Qnil, + &BVAR_DEFAULTED (current_buffer, bidi_paragraph_start_re), Qnil, doc: /* If non-nil, a regexp matching a line that starts OR separates paragraphs. The value of nil means to use empty lines as lines that start and @@ -5562,7 +5562,7 @@ set both these variables to "^". See also `bidi-paragraph-direction'. */); DEFVAR_PER_BUFFER ("bidi-paragraph-separate-re", - &BVAR (current_buffer, bidi_paragraph_separate_re), Qnil, + &BVAR_DEFAULTED (current_buffer, bidi_paragraph_separate_re), Qnil, doc: /* If non-nil, a regexp matching a line that separates paragraphs. The value of nil means to use empty lines as paragraph separators. @@ -5583,7 +5583,7 @@ set both these variables to "^". See also `bidi-paragraph-direction'. */); DEFVAR_PER_BUFFER ("bidi-paragraph-direction", - &BVAR (current_buffer, bidi_paragraph_direction), Qnil, + &BVAR_DEFAULTED (current_buffer, bidi_paragraph_direction), Qnil, doc: /* If non-nil, forces directionality of text paragraphs in the buffer. If this is nil (the default), the direction of each paragraph is @@ -5594,7 +5594,7 @@ Any other value is treated as nil. This variable has no effect unless the buffer's value of `bidi-display-reordering' is non-nil. */); - DEFVAR_PER_BUFFER ("truncate-lines", &BVAR (current_buffer, truncate_lines), Qnil, + DEFVAR_PER_BUFFER ("truncate-lines", &BVAR_DEFAULTED (current_buffer, truncate_lines), Qnil, doc: /* Non-nil means do not display continuation lines. Instead, give each line of text just one screen line. @@ -5604,7 +5604,7 @@ and this buffer is not full-frame width. Minibuffers set this variable to nil. */); - DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil, + DEFVAR_PER_BUFFER ("word-wrap", &BVAR_DEFAULTED (current_buffer, word_wrap), 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. @@ -5629,7 +5629,7 @@ It should be an absolute directory name; on GNU and Unix systems, these names start with `/' or `~' and end with `/'. To interactively change the default directory, use command `cd'. */); - DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, auto_fill_function), + DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR_DEFAULTED (current_buffer, auto_fill_function), Qnil, doc: /* Function called (if non-nil) to perform auto-fill. It is called after self-inserting any character specified in @@ -5671,7 +5671,7 @@ If you set this to -2, that means don't turn off auto-saving in this buffer if its text size shrinks. If you use `buffer-swap-text' on a buffer, you probably should set this to -2 in that buffer. */); - DEFVAR_PER_BUFFER ("selective-display", &BVAR (current_buffer, selective_display), + DEFVAR_PER_BUFFER ("selective-display", &BVAR_DEFAULTED (current_buffer, selective_display), Qnil, doc: /* Non-nil enables selective display. @@ -5684,11 +5684,11 @@ in a file, save the ^M as a newline. This usage is obsolete; use overlays or text properties instead. */); DEFVAR_PER_BUFFER ("selective-display-ellipses", - &BVAR (current_buffer, selective_display_ellipses), + &BVAR_DEFAULTED (current_buffer, selective_display_ellipses), Qnil, doc: /* Non-nil means display ... on previous line when a line is invisible. */); - DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode), + DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR_DEFAULTED (current_buffer, overwrite_mode), Qoverwrite_mode, doc: /* Non-nil if self-insertion should replace existing text. The value should be one of `overwrite-mode-textual', @@ -5698,7 +5698,7 @@ inserts at the end of a line, and inserts when point is before a tab, until the tab is filled in. If `overwrite-mode-binary', self-insertion replaces newlines and tabs too. */); - DEFVAR_PER_BUFFER ("buffer-display-table", &BVAR (current_buffer, display_table), + DEFVAR_PER_BUFFER ("buffer-display-table", &BVAR_DEFAULTED (current_buffer, display_table), Qnil, doc: /* Display table that controls display of the contents of current buffer. @@ -5735,7 +5735,7 @@ In addition, a char-table has six extra slots to control the display of: See also the functions `display-table-slot' and `set-display-table-slot'. */); - DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols), + DEFVAR_PER_BUFFER ("left-margin-width", &BVAR_DEFAULTED (current_buffer, left_margin_cols), Qintegerp, doc: /* Width in columns of left marginal area for display of a buffer. A value of nil means no marginal area. @@ -5743,7 +5743,7 @@ A value of nil means no marginal area. Setting this variable does not take effect until a new buffer is displayed in a window. To make the change take effect, call `set-window-buffer'. */); - DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols), + DEFVAR_PER_BUFFER ("right-margin-width", &BVAR_DEFAULTED (current_buffer, right_margin_cols), Qintegerp, doc: /* Width in columns of right marginal area for display of a buffer. A value of nil means no marginal area. @@ -5751,7 +5751,7 @@ A value of nil means no marginal area. Setting this variable does not take effect until a new buffer is displayed in a window. To make the change take effect, call `set-window-buffer'. */); - DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width), + DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR_DEFAULTED (current_buffer, left_fringe_width), Qintegerp, 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. @@ -5760,7 +5760,7 @@ A value of nil means to use the left fringe width from the window's frame. Setting this variable does not take effect until a new buffer is displayed in a window. To make the change take effect, call `set-window-buffer'. */); - DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width), + DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR_DEFAULTED (current_buffer, right_fringe_width), Qintegerp, 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. @@ -5769,7 +5769,7 @@ A value of nil means to use the right fringe width from the window's frame. Setting this variable does not take effect until a new buffer is displayed in a window. To make the change take effect, call `set-window-buffer'. */); - DEFVAR_PER_BUFFER ("fringes-outside-margins", &BVAR (current_buffer, fringes_outside_margins), + DEFVAR_PER_BUFFER ("fringes-outside-margins", &BVAR_DEFAULTED (current_buffer, fringes_outside_margins), Qnil, doc: /* Non-nil means to display fringes outside display margins. A value of nil means to display fringes between margins and buffer text. @@ -5777,17 +5777,17 @@ A value of nil means to display fringes between margins and buffer text. Setting this variable does not take effect until a new buffer is displayed in a window. To make the change take effect, call `set-window-buffer'. */); - DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width), + DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR_DEFAULTED (current_buffer, scroll_bar_width), Qintegerp, doc: /* Width of this buffer's vertical scroll bars in pixels. A value of nil means to use the scroll bar width from the window's frame. */); - DEFVAR_PER_BUFFER ("scroll-bar-height", &BVAR (current_buffer, scroll_bar_height), + DEFVAR_PER_BUFFER ("scroll-bar-height", &BVAR_DEFAULTED (current_buffer, scroll_bar_height), Qintegerp, doc: /* Height of this buffer's horizontal scroll bars in pixels. A value of nil means to use the scroll bar height from the window's frame. */); - DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type), + DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR_DEFAULTED (current_buffer, vertical_scroll_bar_type), Qvertical_scroll_bar, doc: /* Position of this buffer's vertical scroll bar. The value takes effect whenever you tell a window to display this buffer; @@ -5797,7 +5797,7 @@ A value of `left' or `right' means put the vertical scroll bar at that side of the window; a value of nil means don't show any vertical scroll bars. A value of t (the default) means do whatever the window's frame specifies. */); - DEFVAR_PER_BUFFER ("horizontal-scroll-bar", &BVAR (current_buffer, horizontal_scroll_bar_type), + DEFVAR_PER_BUFFER ("horizontal-scroll-bar", &BVAR_DEFAULTED (current_buffer, horizontal_scroll_bar_type), Qnil, doc: /* Position of this buffer's horizontal scroll bar. The value takes effect whenever you tell a window to display this buffer; @@ -5809,13 +5809,13 @@ A value of t (the default) means do whatever the window's frame specifies. */); DEFVAR_PER_BUFFER ("indicate-empty-lines", - &BVAR (current_buffer, indicate_empty_lines), Qnil, + &BVAR_DEFAULTED (current_buffer, indicate_empty_lines), 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", - &BVAR (current_buffer, indicate_buffer_boundaries), Qnil, + &BVAR_DEFAULTED (current_buffer, indicate_buffer_boundaries), 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 @@ -5840,7 +5840,7 @@ bitmaps in right fringe. To show just the angle bitmaps in the left fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */); DEFVAR_PER_BUFFER ("fringe-indicator-alist", - &BVAR (current_buffer, fringe_indicator_alist), Qnil, + &BVAR_DEFAULTED (current_buffer, fringe_indicator_alist), 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 @@ -5859,7 +5859,7 @@ last (only) line has no final newline. BITMAPS may also be a single symbol which is used in both left and right fringes. */); DEFVAR_PER_BUFFER ("fringe-cursor-alist", - &BVAR (current_buffer, fringe_cursor_alist), Qnil, + &BVAR_DEFAULTED (current_buffer, fringe_cursor_alist), 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 @@ -5874,7 +5874,7 @@ BITMAP is the corresponding fringe bitmap shown for the logical cursor type. */); DEFVAR_PER_BUFFER ("scroll-up-aggressively", - &BVAR (current_buffer, scroll_up_aggressively), Qfraction, + &BVAR_DEFAULTED (current_buffer, scroll_up_aggressively), Qfraction, 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, @@ -5887,7 +5887,7 @@ window scrolls by a full window height. Meaningful values are between 0.0 and 1.0, inclusive. */); DEFVAR_PER_BUFFER ("scroll-down-aggressively", - &BVAR (current_buffer, scroll_down_aggressively), Qfraction, + &BVAR_DEFAULTED (current_buffer, scroll_down_aggressively), Qfraction, 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, @@ -5987,7 +5987,7 @@ If the value of the variable is t, undo information is not recorded. */); DEFVAR_PER_BUFFER ("mark-active", &BVAR (current_buffer, mark_active), Qnil, doc: /* Non-nil means the mark and region are currently active in this buffer. */); - DEFVAR_PER_BUFFER ("cache-long-scans", &BVAR (current_buffer, cache_long_scans), Qnil, + DEFVAR_PER_BUFFER ("cache-long-scans", &BVAR_DEFAULTED (current_buffer, cache_long_scans), Qnil, doc: /* Non-nil means that Emacs should use caches in attempt to speedup buffer scans. There is no reason to set this to nil except for debugging purposes. @@ -6094,7 +6094,7 @@ member of the list. Any other non-nil value means disregard `buffer-read-only' and all `read-only' text properties. */); Vinhibit_read_only = Qnil; - DEFVAR_PER_BUFFER ("cursor-type", &BVAR (current_buffer, cursor_type), Qnil, + DEFVAR_PER_BUFFER ("cursor-type", &BVAR_DEFAULTED (current_buffer, cursor_type), Qnil, doc: /* Cursor to use when this buffer is in the selected window. Values are interpreted as follows: @@ -6118,7 +6118,7 @@ cursor's appearance is instead controlled by the variable `cursor-in-non-selected-windows'. */); DEFVAR_PER_BUFFER ("line-spacing", - &BVAR (current_buffer, extra_line_spacing), Qnumberp, + &BVAR_DEFAULTED (current_buffer, extra_line_spacing), Qnumberp, 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'. @@ -6126,7 +6126,7 @@ If value is a floating point number, it specifies the spacing relative to the default frame line height. A value of nil means add no extra space. */); DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows", - &BVAR (current_buffer, cursor_in_non_selected_windows), Qnil, + &BVAR_DEFAULTED (current_buffer, cursor_in_non_selected_windows), Qnil, doc: /* Non-nil means show a cursor in non-selected windows. If nil, only shows a cursor in the selected window. If t, displays a cursor related to the usual cursor type diff --git a/src/buffer.h b/src/buffer.h index c765ea4347..e21a6e8767 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -280,13 +280,18 @@ struct buffer_text bool_bf redisplay : 1; }; +#define BVAR_FIELD(field) field ## _ +#define BVAR_DEFAULTED_FIELD(field) field ## _defaulted_ + /* Most code should use this macro to access Lisp fields in struct buffer. */ -#define BVAR(buf, field) ((buf)->field ## _) +#define BVAR(buf, field) ((buf)->BVAR_FIELD(field)) + +#define BVAR_DEFAULTED(buf, field) ((buf)->BVAR_DEFAULTED_FIELD(field)) -#define BVAR_OR_DEFAULT(buf, field) (EQ (BVAR ((buf), field), Qunbound) \ - ? BVAR (&buffer_defaults, field) \ - : BVAR ((buf), field)) +#define BVAR_OR_DEFAULT(buf, field) (EQ (BVAR_DEFAULTED ((buf), field), Qunbound) \ + ? BVAR_DEFAULTED (&buffer_defaults, field) \ + : BVAR_DEFAULTED ((buf), field)) /* Max number of builtin per-buffer variables. */ enum { MAX_PER_BUFFER_VARS = 50 }; @@ -302,17 +307,17 @@ struct buffer union vectorlike_header header; /* The name of this buffer. */ - Lisp_Object name_; + Lisp_Object BVAR_FIELD(name); /* The name of the file visited in this buffer, or nil. */ - Lisp_Object filename_; + Lisp_Object BVAR_FIELD(filename); /* Directory for expanding relative file names. */ - Lisp_Object directory_; + Lisp_Object BVAR_FIELD(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). */ - Lisp_Object backed_up_; + Lisp_Object BVAR_FIELD(backed_up); /* Length of file when last read or saved. -1 means auto saving turned off because buffer shrank a lot. @@ -320,142 +325,142 @@ struct buffer (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 BVAR_FIELD(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 BVAR_FIELD(auto_save_file_name); /* Non-nil if buffer read-only. */ - Lisp_Object read_only_; + Lisp_Object BVAR_FIELD(read_only); /* "The mark". This is a marker which may point into this buffer or may point nowhere. */ - Lisp_Object mark_; + Lisp_Object BVAR_FIELD(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 BVAR_FIELD(local_var_alist); /* Symbol naming major mode (e.g., lisp-mode). */ - Lisp_Object major_mode_; + Lisp_Object BVAR_FIELD(major_mode); /* Symbol listing all currently enabled minor modes. */ - Lisp_Object local_minor_modes_; + Lisp_Object BVAR_FIELD(local_minor_modes); /* Pretty name of major mode (e.g., "Lisp"). */ - Lisp_Object mode_name_; + Lisp_Object BVAR_FIELD(mode_name); /* Mode line element that controls format of mode line. */ - Lisp_Object mode_line_format_; + Lisp_Object BVAR_DEFAULTED_FIELD(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 BVAR_DEFAULTED_FIELD(header_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 tab_line_format_; + Lisp_Object BVAR_DEFAULTED_FIELD(tab_line_format); /* Keys that are bound local to this buffer. */ - Lisp_Object keymap_; + Lisp_Object BVAR_FIELD(keymap); /* This buffer's local abbrev table. */ - Lisp_Object abbrev_table_; + Lisp_Object BVAR_DEFAULTED_FIELD(abbrev_table); /* This buffer's syntax table. */ - Lisp_Object syntax_table_; + Lisp_Object BVAR_DEFAULTED_FIELD(syntax_table); /* This buffer's category table. */ - Lisp_Object category_table_; + Lisp_Object BVAR_DEFAULTED_FIELD(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 BVAR_DEFAULTED_FIELD(case_fold_search); + Lisp_Object BVAR_DEFAULTED_FIELD(tab_width); + Lisp_Object BVAR_DEFAULTED_FIELD(fill_column); + Lisp_Object BVAR_DEFAULTED_FIELD(left_margin); /* Function to call when insert space past fill column. */ - Lisp_Object auto_fill_function_; + Lisp_Object BVAR_DEFAULTED_FIELD(auto_fill_function); /* 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 BVAR_FIELD(downcase_table); /* Char-table mapping each char to its upper-case version. */ - Lisp_Object upcase_table_; + Lisp_Object BVAR_FIELD(upcase_table); /* Char-table for conversion for case-folding search. */ - Lisp_Object case_canon_table_; + Lisp_Object BVAR_FIELD(case_canon_table); /* Char-table of equivalences for case-folding search. */ - Lisp_Object case_eqv_table_; + Lisp_Object BVAR_FIELD(case_eqv_table); /* Non-nil means do not display continuation lines. */ - Lisp_Object truncate_lines_; + Lisp_Object BVAR_DEFAULTED_FIELD(truncate_lines); /* Non-nil means to use word wrapping when displaying continuation lines. */ - Lisp_Object word_wrap_; + Lisp_Object BVAR_DEFAULTED_FIELD(word_wrap); /* Non-nil means display ctl chars with uparrow. */ - Lisp_Object ctl_arrow_; + Lisp_Object BVAR_DEFAULTED_FIELD(ctl_arrow); /* Non-nil means reorder bidirectional text for display in the visual order. */ - Lisp_Object bidi_display_reordering_; + Lisp_Object BVAR_DEFAULTED_FIELD(bidi_display_reordering); /* If non-nil, specifies which direction of text to force in all the paragraphs of the buffer. Nil means determine paragraph direction dynamically for each paragraph. */ - Lisp_Object bidi_paragraph_direction_; + Lisp_Object BVAR_DEFAULTED_FIELD(bidi_paragraph_direction); /* If non-nil, a regular expression for bidi paragraph separator. */ - Lisp_Object bidi_paragraph_separate_re_; + Lisp_Object BVAR_DEFAULTED_FIELD(bidi_paragraph_separate_re); /* If non-nil, a regular expression for bidi paragraph start. */ - Lisp_Object bidi_paragraph_start_re_; + Lisp_Object BVAR_DEFAULTED_FIELD(bidi_paragraph_start_re); /* Non-nil means do selective display; see doc string in syms_of_buffer (buffer.c) for details. */ - Lisp_Object selective_display_; + Lisp_Object BVAR_DEFAULTED_FIELD(selective_display); /* Non-nil means show ... at end of line followed by invisible lines. */ - Lisp_Object selective_display_ellipses_; + Lisp_Object BVAR_DEFAULTED_FIELD(selective_display_ellipses); /* 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 BVAR_DEFAULTED_FIELD(overwrite_mode); /* Non-nil means abbrev mode is on. Expand abbrevs automatically. */ - Lisp_Object abbrev_mode_; + Lisp_Object BVAR_DEFAULTED_FIELD(abbrev_mode); /* Display table to use for text in this buffer. */ - Lisp_Object display_table_; + Lisp_Object BVAR_DEFAULTED_FIELD(display_table); /* t means the mark and region are currently active. */ - Lisp_Object mark_active_; + Lisp_Object BVAR_FIELD(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 BVAR_FIELD(enable_multibyte_characters); /* Coding system to be used for encoding the buffer contents on saving. */ - Lisp_Object buffer_file_coding_system_; + Lisp_Object BVAR_DEFAULTED_FIELD(buffer_file_coding_system); /* List of symbols naming the file format used for visited file. */ - Lisp_Object file_format_; + Lisp_Object BVAR_FIELD(file_format); /* List of symbols naming the file format used for auto-save file. */ - Lisp_Object auto_save_file_format_; + Lisp_Object BVAR_FIELD(auto_save_file_format); /* True if the newline position cache, width run cache and BIDI paragraph cache are enabled. See search.c, indent.c and bidi.c for details. */ - Lisp_Object cache_long_scans_; + Lisp_Object BVAR_DEFAULTED_FIELD(cache_long_scans); /* If the width run cache is enabled, this table contains the character widths width_run_cache (see above) assumes. When we @@ -463,106 +468,106 @@ struct buffer current display table to see whether the display table has affected the widths of any characters. If it has, we invalidate the width run cache, and re-initialize width_table. */ - Lisp_Object width_table_; + Lisp_Object BVAR_FIELD(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 BVAR_FIELD(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 BVAR_FIELD(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 BVAR_FIELD(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 BVAR_FIELD(point_before_scroll); /* Truename of the visited file, or nil. */ - Lisp_Object file_truename_; + Lisp_Object BVAR_FIELD(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 BVAR_FIELD(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 BVAR_FIELD(last_selected_window); /* Incremented each time the buffer is displayed in a window. */ - Lisp_Object display_count_; + Lisp_Object BVAR_FIELD(display_count); /* Widths of left and right marginal areas for windows displaying this buffer. */ - Lisp_Object left_margin_cols_; - Lisp_Object right_margin_cols_; + Lisp_Object BVAR_DEFAULTED_FIELD(left_margin_cols); + Lisp_Object BVAR_DEFAULTED_FIELD(right_margin_cols); /* Widths of left and right fringe areas for windows displaying this buffer. */ - Lisp_Object left_fringe_width_; - Lisp_Object right_fringe_width_; + Lisp_Object BVAR_DEFAULTED_FIELD(left_fringe_width); + Lisp_Object BVAR_DEFAULTED_FIELD(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 BVAR_DEFAULTED_FIELD(fringes_outside_margins); /* Width, height and types of scroll bar areas for windows displaying this buffer. */ - Lisp_Object scroll_bar_width_; - Lisp_Object scroll_bar_height_; - Lisp_Object vertical_scroll_bar_type_; - Lisp_Object horizontal_scroll_bar_type_; + Lisp_Object BVAR_DEFAULTED_FIELD(scroll_bar_width); + Lisp_Object BVAR_DEFAULTED_FIELD(scroll_bar_height); + Lisp_Object BVAR_DEFAULTED_FIELD(vertical_scroll_bar_type); + Lisp_Object BVAR_DEFAULTED_FIELD(horizontal_scroll_bar_type); /* Non-nil means indicate lines not displaying text (in a style like vi). */ - Lisp_Object indicate_empty_lines_; + Lisp_Object BVAR_DEFAULTED_FIELD(indicate_empty_lines); /* Non-nil means indicate buffer boundaries and scrolling. */ - Lisp_Object indicate_buffer_boundaries_; + Lisp_Object BVAR_DEFAULTED_FIELD(indicate_buffer_boundaries); /* Logical to physical fringe bitmap mappings. */ - Lisp_Object fringe_indicator_alist_; + Lisp_Object BVAR_DEFAULTED_FIELD(fringe_indicator_alist); /* Logical to physical cursor bitmap mappings. */ - Lisp_Object fringe_cursor_alist_; + Lisp_Object BVAR_DEFAULTED_FIELD(fringe_cursor_alist); /* Time stamp updated each time this buffer is displayed in a window. */ - Lisp_Object display_time_; + Lisp_Object BVAR_FIELD(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 BVAR_DEFAULTED_FIELD(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 BVAR_DEFAULTED_FIELD(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 BVAR_DEFAULTED_FIELD(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 BVAR_DEFAULTED_FIELD(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 BVAR_DEFAULTED_FIELD(cursor_in_non_selected_windows); - /* No more Lisp_Object beyond cursor_in_non_selected_windows_. + /* No more Lisp_Object beyond cursor_in_non_selected_windows. Except undo_list, which is handled specially in Fgarbage_collect. */ /* This structure holds the coordinates of the buffer contents @@ -714,12 +719,12 @@ XBUFFER (Lisp_Object a) INLINE void bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val) { - b->bidi_paragraph_direction_ = val; + b->BVAR_DEFAULTED_FIELD(bidi_paragraph_direction) = val; } INLINE void bset_cache_long_scans (struct buffer *b, Lisp_Object val) { - b->cache_long_scans_ = val; + b->BVAR_DEFAULTED_FIELD(cache_long_scans) = val; } INLINE void bset_case_canon_table (struct buffer *b, Lisp_Object val) @@ -744,12 +749,12 @@ bset_display_count (struct buffer *b, Lisp_Object val) INLINE void bset_left_margin_cols (struct buffer *b, Lisp_Object val) { - b->left_margin_cols_ = val; + b->BVAR_DEFAULTED_FIELD(left_margin_cols) = val; } INLINE void bset_right_margin_cols (struct buffer *b, Lisp_Object val) { - b->right_margin_cols_ = val; + b->BVAR_DEFAULTED_FIELD(right_margin_cols) = val; } INLINE void bset_display_time (struct buffer *b, Lisp_Object val) @@ -804,7 +809,7 @@ bset_read_only (struct buffer *b, Lisp_Object val) INLINE void bset_truncate_lines (struct buffer *b, Lisp_Object val) { - b->truncate_lines_ = val; + b->BVAR_DEFAULTED_FIELD(truncate_lines) = val; } INLINE void bset_undo_list (struct buffer *b, Lisp_Object val) @@ -1047,7 +1052,7 @@ PTR_BYTE_POS (unsigned char const *ptr) structure, make sure that this is still correct. */ enum { BUFFER_LISP_SIZE = PSEUDOVECSIZE (struct buffer, - cursor_in_non_selected_windows_) }; + BVAR_DEFAULTED_FIELD(cursor_in_non_selected_windows)) }; /* Allocated size of the struct buffer part beyond leading Lisp_Objects, in word_size units. */ @@ -1376,13 +1381,16 @@ OVERLAY_POSITION (Lisp_Object p) #define PER_BUFFER_VAR_OFFSET(VAR) \ offsetof (struct buffer, VAR ## _) +#define PER_BUFFER_VAR_DEFAULTED_OFFSET(VAR) \ + offsetof (struct buffer, BVAR_DEFAULTED_FIELD(VAR)) + /* Used to iterate over normal Lisp_Object fields of struct buffer (all Lisp_Objects except undo_list). If you add, remove, or reorder Lisp_Objects in a struct buffer, make sure that this is still correct. */ #define FOR_EACH_PER_BUFFER_OBJECT_AT(offset) \ for (offset = PER_BUFFER_VAR_OFFSET (name); \ - offset <= PER_BUFFER_VAR_OFFSET (cursor_in_non_selected_windows); \ + offset <= PER_BUFFER_VAR_DEFAULTED_OFFSET (cursor_in_non_selected_windows); \ offset += word_size) /* Functions to get and set default value of the per-buffer diff --git a/src/category.c b/src/category.c index a9f5225df8..44b315d8b3 100644 --- a/src/category.c +++ b/src/category.c @@ -39,7 +39,7 @@ along with GNU Emacs. If not, see . */ static void bset_category_table (struct buffer *b, Lisp_Object val) { - b->category_table_ = val; + b->BVAR_DEFAULTED_FIELD(category_table) = val; } diff --git a/src/category.h b/src/category.h index cc32990478..eae3e121cd 100644 --- a/src/category.h +++ b/src/category.h @@ -94,7 +94,7 @@ CHAR_HAS_CATEGORY (int ch, int category) /* The standard category table is stored where it will automatically be used in all new buffers. */ -#define Vstandard_category_table BVAR (&buffer_defaults, category_table) +#define Vstandard_category_table BVAR_DEFAULTED (&buffer_defaults, category_table) /* Return the doc string of CATEGORY in category table TABLE. */ #define CATEGORY_DOCSTRING(table, category) \ diff --git a/src/syntax.c b/src/syntax.c index 4724b39097..473dd5f553 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -192,7 +192,7 @@ static void parse_sexp_propertize (ptrdiff_t charpos); static void bset_syntax_table (struct buffer *b, Lisp_Object val) { - b->syntax_table_ = val; + b->BVAR_DEFAULTED_FIELD(syntax_table) = val; } /* Whether the syntax of the character C has the prefix flag set. */ diff --git a/src/syntax.h b/src/syntax.h index c89797ea13..ecc0c55d55 100644 --- a/src/syntax.h +++ b/src/syntax.h @@ -31,7 +31,7 @@ extern void update_syntax_table_forward (ptrdiff_t, bool, Lisp_Object); /* The standard syntax table is stored where it will automatically be used in all new buffers. */ -#define Vstandard_syntax_table BVAR (&buffer_defaults, syntax_table) +#define Vstandard_syntax_table BVAR_DEFAULTED (&buffer_defaults, syntax_table) /* A syntax table is a chartable whose elements are cons cells (CODE+FLAGS . MATCHING-CHAR). MATCHING-CHAR can be nil if the char -- 2.31.1