emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master a4a229dfff 2/2: Fix merging of anonymous faces with an `:extend'


From: Po Lu
Subject: master a4a229dfff 2/2: Fix merging of anonymous faces with an `:extend' property on unexec
Date: Thu, 12 May 2022 02:56:47 -0400 (EDT)

branch: master
commit a4a229dfff3ede3d083ba874a4119db501118063
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix merging of anonymous faces with an `:extend' property on unexec
    
    * src/emacs.c (main): Unconditionally call `init_xfaces'.
    * src/lisp.h: Enable `init_xfaces' on unexec builds too.
    * src/xfaces.c (init_xfaces): Move fix for bug#34226 into
    pdumper-specific section leaving the initialization of
    `face_attr_sym' intact.
---
 src/emacs.c  |  8 ++------
 src/lisp.h   |  2 --
 src/xfaces.c | 43 +++++++++++++++++++++++++------------------
 3 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/src/emacs.c b/src/emacs.c
index ca99a8c787..fe138366f3 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1952,15 +1952,11 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
   init_threads ();
   init_eval ();
 #ifdef HAVE_PGTK
-  init_pgtkterm ();   /* before init_atimer(). */
+  init_pgtkterm (); /* Must come before `init_atimer'.  */
 #endif
   running_asynch_code = 0;
   init_random ();
-
-#ifdef HAVE_PDUMPER
-  if (dumped_with_pdumper_p ())
-    init_xfaces ();
-#endif
+  init_xfaces ();
 
 #if defined HAVE_JSON && !defined WINDOWSNT
   init_json ();
diff --git a/src/lisp.h b/src/lisp.h
index b00f3f7e2e..e76a36d269 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -5093,9 +5093,7 @@ extern void syms_of_w32cygwinx (void);
 extern Lisp_Object Vface_alternative_font_family_alist;
 extern Lisp_Object Vface_alternative_font_registry_alist;
 extern void syms_of_xfaces (void);
-#ifdef HAVE_PDUMPER
 extern void init_xfaces (void);
-#endif
 
 #ifdef HAVE_X_WINDOWS
 /* Defined in xfns.c.  */
diff --git a/src/xfaces.c b/src/xfaces.c
index 05e0df4b7d..7395ce157e 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -6871,7 +6871,6 @@ DEFUN ("show-face-resources", Fshow_face_resources, 
Sshow_face_resources,
                            Initialization
  ***********************************************************************/
 
-#ifdef HAVE_PDUMPER
 /* All the faces defined during loadup are recorded in
    face-new-frame-defaults.  We need to set next_lface_id to the next
    face ID number, so that any new faces defined in this session will
@@ -6881,26 +6880,35 @@ DEFUN ("show-face-resources", Fshow_face_resources, 
Sshow_face_resources,
 void
 init_xfaces (void)
 {
-  int nfaces = XFIXNAT (Fhash_table_count (Vface_new_frame_defaults));
-  if (nfaces > 0)
-    {
-      /* Allocate the lface_id_to_name[] array.  */
-      lface_id_to_name_size = next_lface_id = nfaces;
-      lface_id_to_name = xnmalloc (next_lface_id, sizeof *lface_id_to_name);
+#ifdef HAVE_PDUMPER
+  int nfaces;
 
-      /* Store the faces.  */
-      struct Lisp_Hash_Table* table = XHASH_TABLE (Vface_new_frame_defaults);
-      for (ptrdiff_t idx = 0; idx < nfaces; ++idx)
+  if (dumped_with_pdumper_p ())
+    {
+      nfaces = XFIXNAT (Fhash_table_count (Vface_new_frame_defaults));
+      if (nfaces > 0)
        {
-         Lisp_Object lface = HASH_KEY (table, idx);
-         Lisp_Object face_id = CAR (HASH_VALUE (table, idx));
-          if (FIXNATP (face_id)) {
-              int id = XFIXNAT (face_id);
-              eassert (id >= 0);
-              lface_id_to_name[id] = lface;
-            }
+         /* Allocate the lface_id_to_name[] array.  */
+         lface_id_to_name_size = next_lface_id = nfaces;
+         lface_id_to_name = xnmalloc (next_lface_id, sizeof *lface_id_to_name);
+
+         /* Store the faces.  */
+         struct Lisp_Hash_Table* table = XHASH_TABLE 
(Vface_new_frame_defaults);
+         for (ptrdiff_t idx = 0; idx < nfaces; ++idx)
+           {
+             Lisp_Object lface = HASH_KEY (table, idx);
+             Lisp_Object face_id = CAR (HASH_VALUE (table, idx));
+             if (FIXNATP (face_id))
+               {
+                 int id = XFIXNAT (face_id);
+                 eassert (id >= 0);
+                 lface_id_to_name[id] = lface;
+               }
+           }
        }
     }
+#endif
+
   face_attr_sym[0] = Qface;
   face_attr_sym[LFACE_FOUNDRY_INDEX] = QCfoundry;
   face_attr_sym[LFACE_SWIDTH_INDEX] = QCwidth;
@@ -6921,7 +6929,6 @@ init_xfaces (void)
   face_attr_sym[LFACE_DISTANT_FOREGROUND_INDEX] = QCdistant_foreground;
   face_attr_sym[LFACE_EXTEND_INDEX] = QCextend;
 }
-#endif
 
 void
 syms_of_xfaces (void)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]