Subject: Re: bug#75521: scratch/igc: Delete unused macro DEFVAR_LISP_NOPROX

From: Eli Zaretskii <[email-masked]>
Date: Tue, 14 Jan 2025 17:59:37 +0200

> Cc: [email-masked], [email-masked]
> Date: Mon, 13 Jan 2025 22:07:21 +0200
> From: Eli Zaretskii <[email-masked]>
> 
> 
> Anyway, please don't install anything yet.  I want to take a closer
> look at this code and its usage, and I've ran out of time for today.

WDYT about the patch below?  It's supposed to keep the 3 variables in
sync with the corresponding slots in font_style_table, if the slots
are ever modified.

diff --git a/src/font.c b/src/font.c
index 8638226..77fc74b 100644
--- a/src/font.c
+++ b/src/font.c
@@ -418,8 +418,23 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val,
       eassert (len < 255);
       elt = make_vector (2, make_fixnum (100));
       ASET (elt, 1, val);
-      ASET (font_style_table, prop - FONT_WEIGHT_INDEX,
-	    CALLN (Fvconcat, table, make_vector (1, elt)));
+      Lisp_Object new_table = CALLN (Fvconcat, table, make_vector (1, elt));
+      /* Update the corresponding variable with the new value.  */
+      switch (prop)
+	{
+	case FONT_WEIGHT_INDEX:
+	  Vfont_weight_table = new_table;
+	  break;
+	case FONT_SLANT_INDEX:
+	  Vfont_slant_table = new_table;
+	  break;
+	case FONT_WIDTH_INDEX:
+	  Vfont_width_table = new_table;
+	  break;
+	default:
+	  break;
+	}
+      ASET (font_style_table, prop - FONT_WEIGHT_INDEX, new_table);
       return (100 << 8) | (i << 4);
     }
   else