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.devel Subject: [PATCH v2 06/16] Use bset_* functions instead of BVAR Date: Sat, 21 Nov 2020 21:34:35 -0500 Message-ID: <9b43dc231149dc6f272d39d966698b770efb276a.1606009917.git.sbaugh@catern.com> References: <20201119153814.17541-1-sbaugh@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="24511"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Spencer Baugh , Arnold Noronha , Stefan Monnier , Dmitry Gutov To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 22 03:38:38 2020 Return-path: Envelope-to: ged-emacs-devel@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 1kgfGw-0006GT-BG for ged-emacs-devel@m.gmane-mx.org; Sun, 22 Nov 2020 03:38:38 +0100 Original-Received: from localhost ([::1]:50562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kgfGv-0005RZ-Au for ged-emacs-devel@m.gmane-mx.org; Sat, 21 Nov 2020 21:38:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgfDK-0000LC-L3 for emacs-devel@gnu.org; Sat, 21 Nov 2020 21:34:54 -0500 Original-Received: from venus.catern.com ([68.183.49.163]:60142) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgfDI-0007Iu-5z for emacs-devel@gnu.org; Sat, 21 Nov 2020 21:34:54 -0500 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=1606012491; bh=2IuSrT5zb4z6prwhYwlWi8vw5ftAIFSY5hWIYNo60q4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dI/3gfhobH2W3/cEL8hf8fILMjyVRsX5pRLlaHIOkYe4z5FZkUhUzLjCA8SV6P+L3 45quiHAz7gxrTP2XyYaeqL3yIM9sXrQBnNQugHpCiqE6LpdXd57VI3zdehSZEIJj6Y KW0uXRLsGzjf9uMvp/HrT6AnTSqj+iHQDjb37URo= 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 93BF12DDB43; Sun, 22 Nov 2020 02:34:51 +0000 (UTC) X-Mailer: git-send-email 2.28.0 In-Reply-To: Received-SPF: pass client-ip=68.183.49.163; envelope-from=sbaugh@catern.com; helo=venus.catern.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:259579 Archived-At: We move bset_save_length to buffer.h, and expand usage of the pre-existing bset_last_selected_window and bset_enable_multibyte_characters functions. This removes some usage of BVAR as an lvalue, necessary for changing BVAR into a function call. --- src/buffer.c | 13 ++++--------- src/buffer.h | 5 +++++ src/fileio.c | 12 ++++++------ src/window.c | 5 ++--- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index defc4ac746..aa951ca78f 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -327,11 +327,6 @@ bset_right_fringe_width (struct buffer *b, Lisp_Object val) b->right_fringe_width_ = val; } static void -bset_save_length (struct buffer *b, Lisp_Object val) -{ - b->save_length_ = val; -} -static void bset_scroll_bar_width (struct buffer *b, Lisp_Object val) { b->scroll_bar_width_ = val; @@ -951,7 +946,7 @@ reset_buffer (register struct buffer *b) bset_directory (b, current_buffer ? BVAR (current_buffer, directory) : Qnil); b->modtime = make_timespec (0, UNKNOWN_MODTIME_NSECS); b->modtime_size = -1; - XSETFASTINT (BVAR (b, save_length), 0); + bset_save_length (b, make_fixed_natnum (0)); b->last_window_start = 1; /* It is more conservative to start out "changed" than "unchanged". */ b->clip_changed = 0; @@ -2275,7 +2270,7 @@ so the buffer is truly empty after this. */) /* 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 (BVAR (current_buffer, save_length), 0); + bset_save_length (current_buffer, make_fixed_natnum (0)); return Qnil; } @@ -2763,8 +2758,8 @@ current buffer is cleared. */) struct buffer *o = XBUFFER (other); if (o->base_buffer == current_buffer && BUFFER_LIVE_P (o)) { - BVAR (o, enable_multibyte_characters) - = BVAR (current_buffer, enable_multibyte_characters); + bset_enable_multibyte_characters (o, + BVAR (current_buffer, enable_multibyte_characters)); o->prevent_redisplay_optimizations_p = true; } } diff --git a/src/buffer.h b/src/buffer.h index 2999036300..770a5d03e6 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -824,6 +824,11 @@ bset_width_table (struct buffer *b, Lisp_Object val) { b->width_table_ = val; } +INLINE void +bset_save_length (struct buffer *b, Lisp_Object val) +{ + b->save_length_ = val; +} /* BUFFER_CEILING_OF (resp. BUFFER_FLOOR_OF), when applied to n, return the max (resp. min) p such that diff --git a/src/fileio.c b/src/fileio.c index 283813ff89..ba094a5705 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4697,7 +4697,7 @@ by calling `format-decode', which see. */) SAVE_MODIFF = MODIFF; BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; - XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); + bset_save_length (current_buffer, make_fixed_natnum (Z - BEG)); if (NILP (handler)) { if (!NILP (BVAR (current_buffer, file_truename))) @@ -5110,7 +5110,7 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename, if (visiting) { SAVE_MODIFF = MODIFF; - XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); + bset_save_length (current_buffer, make_fixed_natnum (Z - BEG)); bset_filename (current_buffer, visit_file); } @@ -5361,7 +5361,7 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename, if (visiting) { SAVE_MODIFF = MODIFF; - XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); + bset_save_length (current_buffer, make_fixed_natnum (Z - BEG)); bset_filename (current_buffer, visit_file); update_mode_lines = 14; if (auto_saving_into_visited_file) @@ -5979,7 +5979,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) minibuffer_auto_raise = 0; /* Turn off auto-saving until there's a real save, and prevent any more warnings. */ - XSETINT (BVAR (b, save_length), -1); + bset_save_length (current_buffer, make_fixed_natnum (-1)); Fsleep_for (make_fixnum (1), Qnil); continue; } @@ -5988,7 +5988,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) internal_condition_case (auto_save_1, Qt, auto_save_error); auto_saved = 1; BUF_AUTOSAVE_MODIFF (b) = BUF_MODIFF (b); - XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); + bset_save_length (current_buffer, make_fixed_natnum (Z - BEG)); set_buffer_internal (old); after_time = current_timespec (); @@ -6034,7 +6034,7 @@ No auto-save file will be written until the buffer changes again. */) /* FIXME: This should not be called in indirect buffers, since they're not autosaved. */ BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; - XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); + bset_save_length (current_buffer, make_fixed_natnum (Z - BEG)); current_buffer->auto_save_failure_time = 0; return Qnil; } diff --git a/src/window.c b/src/window.c index 6cd3122b43..ee435e395e 100644 --- a/src/window.c +++ b/src/window.c @@ -7117,9 +7117,8 @@ the return value is nil. Otherwise the value is t. */) Do not record the buffer here. We do that in a separate call to select_window below. See also Bug#16207. */ select_window (data->current_window, Qt, true); - BVAR (XBUFFER (XWINDOW (selected_window)->contents), - last_selected_window) - = selected_window; + bset_last_selected_window (XBUFFER (XWINDOW (selected_window)->contents), + selected_window); if (NILP (data->focus_frame) || (FRAMEP (data->focus_frame) -- 2.28.0