unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Spencer Baugh <sbaugh@catern.com>
To: emacs-devel@gnu.org
Cc: Spencer Baugh <sbaugh@catern.com>, Eli Zaretskii <eliz@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Subject: [PATCH 3/7] Stop checking the constant default for enable_multibyte_characters
Date: Tue, 23 Mar 2021 23:11:53 -0400	[thread overview]
Message-ID: <19631b9178f5a540ae3908b695d3e70a6212371f.1616554376.git.sbaugh@catern.com> (raw)
In-Reply-To: <cover.1616554376.git.sbaugh@catern.com>

The default is a constant "t", and can't be changed. So we don't need
to check it.

* src/buffer.c (reset_buffer, init_buffer):
* src/print.c (print_string, temp_output_buffer_setup):
* src/process.c (Fmake_pipe_process, Fmake_serial_process)
(set_network_socket_coding_system):
Don't check buffer_defaults for enable_multibyte_characters
---
 src/buffer.c  |  7 ++-----
 src/print.c   |  6 ++----
 src/process.c | 15 ++++-----------
 3 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/src/buffer.c b/src/buffer.c
index 8e33162989..9d87803cc6 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -988,8 +988,7 @@ reset_buffer (register struct buffer *b)
   bset_last_selected_window (b, Qnil);
   bset_display_count (b, make_fixnum (0));
   bset_display_time (b, Qnil);
-  bset_enable_multibyte_characters
-    (b, BVAR (&buffer_defaults, enable_multibyte_characters));
+  bset_enable_multibyte_characters (b, Qt);
   bset_cursor_type (b, BVAR (&buffer_defaults, cursor_type));
   bset_extra_line_spacing (b, BVAR (&buffer_defaults, extra_line_spacing));
 
@@ -5405,9 +5404,7 @@ init_buffer (void)
 #endif /* USE_MMAP_FOR_BUFFERS */
 
   AUTO_STRING (scratch, "*scratch*");
-  Fset_buffer (Fget_buffer_create (scratch, Qnil));
-  if (NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))
-    Fset_buffer_multibyte (Qnil);
+  Fset_buffer (Fget_buffer_create (scratch));
 
   char const *pwd = emacs_wd;
 
diff --git a/src/print.c b/src/print.c
index 14af919547..0f1987c405 100644
--- a/src/print.c
+++ b/src/print.c
@@ -453,8 +453,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
 	chars = SCHARS (string);
       else if (! print_escape_nonascii
 	       && (EQ (printcharfun, Qt)
-		   ? ! NILP (BVAR (&buffer_defaults, enable_multibyte_characters))
-		   : ! NILP (BVAR (current_buffer, enable_multibyte_characters))))
+		   || ! NILP (BVAR (current_buffer, enable_multibyte_characters))))
 	{
 	  /* If unibyte string STRING contains 8-bit codes, we must
 	     convert STRING to a multibyte string containing the same
@@ -572,8 +571,7 @@ temp_output_buffer_setup (const char *bufname)
   bset_undo_list (current_buffer, Qt);
   eassert (current_buffer->overlays_before == NULL);
   eassert (current_buffer->overlays_after == NULL);
-  bset_enable_multibyte_characters
-    (current_buffer, BVAR (&buffer_defaults, enable_multibyte_characters));
+  bset_enable_multibyte_characters (current_buffer, Qt);
   specbind (Qinhibit_read_only, Qt);
   specbind (Qinhibit_modification_hooks, Qt);
   Ferase_buffer ();
diff --git a/src/process.c b/src/process.c
index b98bc297a3..c084dca4d0 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2399,8 +2399,7 @@ usage:  (make-pipe-process &rest ARGS)  */)
       }
     else if (!NILP (Vcoding_system_for_read))
       val = Vcoding_system_for_read;
-    else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
-	     || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
+    else if (!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
       /* We dare not decode end-of-line format by setting VAL to
 	 Qraw_text, because the existing Emacs Lisp libraries
 	 assume that they receive bare code including a sequence of
@@ -2425,8 +2424,6 @@ usage:  (make-pipe-process &rest ARGS)  */)
       }
     else if (!NILP (Vcoding_system_for_write))
       val = Vcoding_system_for_write;
-    else if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
-      val = Qnil;
     else
       {
 	if (CONSP (coding_systems))
@@ -3124,8 +3121,7 @@ usage:  (make-serial-process &rest ARGS)  */)
     }
   else if (!NILP (Vcoding_system_for_read))
     val = Vcoding_system_for_read;
-  else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
-	   || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
+  else if (!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
     val = Qnil;
   pset_decode_coding_system (p, val);
 
@@ -3138,8 +3134,7 @@ usage:  (make-serial-process &rest ARGS)  */)
     }
   else if (!NILP (Vcoding_system_for_write))
     val = Vcoding_system_for_write;
-  else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
-	   || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
+  else if (!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
     val = Qnil;
   pset_encode_coding_system (p, val);
 
@@ -3181,9 +3176,7 @@ set_network_socket_coding_system (Lisp_Object proc, Lisp_Object host,
   else if (!NILP (Vcoding_system_for_read))
     val = Vcoding_system_for_read;
   else if ((!NILP (p->buffer)
-	    && NILP (BVAR (XBUFFER (p->buffer), enable_multibyte_characters)))
-	   || (NILP (p->buffer)
-	       && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
+	    && NILP (BVAR (XBUFFER (p->buffer), enable_multibyte_characters))))
     /* We dare not decode end-of-line format by setting VAL to
        Qraw_text, because the existing Emacs Lisp libraries
        assume that they receive bare code including a sequence of
-- 
2.28.0




  parent reply	other threads:[~2021-03-24  3:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24  3:11 [PATCH 0/7] Cleanups and tests for DEFVAR_PER_BUFFER variables Spencer Baugh
2021-03-24  3:11 ` [PATCH 1/7] Add a test for let-binding unwinding Spencer Baugh
2021-03-24  3:11 ` [PATCH 2/7] Assert not local-variable-p after setq in let_default binding Spencer Baugh
2021-03-24  3:11 ` Spencer Baugh [this message]
2021-03-24  3:11 ` [PATCH 4/7] Take buffer field name in DEFVAR_PER_BUFFER Spencer Baugh
2021-03-24  3:11 ` [PATCH 5/7] Combine unnecessarily separate loops in buffer.c Spencer Baugh
2021-03-24  3:11 ` [PATCH 6/7] Assert that PER_BUFFER_IDX for Lisp variables is not 0 Spencer Baugh
2021-03-24  3:11 ` [PATCH 7/7] Remove unnecessary Qunbound check Spencer Baugh
2021-03-25 16:46   ` Stefan Monnier
2021-03-24  5:36 ` [PATCH 0/7] Cleanups and tests for DEFVAR_PER_BUFFER variables Eli Zaretskii
2021-03-25 16:48   ` Stefan Monnier
2021-03-25 17:00     ` Eli Zaretskii
2021-04-01 18:13   ` Spencer Baugh
2021-04-01 18:51     ` Eli Zaretskii
2021-04-03 20:53       ` Spencer Baugh
2021-04-04  7:15         ` Eli Zaretskii
2021-04-01 21:42     ` Stefan Monnier
2021-04-01 23:39       ` Spencer Baugh
2021-04-02  2:55         ` Stefan Monnier
2021-04-02  5:36       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19631b9178f5a540ae3908b695d3e70a6212371f.1616554376.git.sbaugh@catern.com \
    --to=sbaugh@catern.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).