Subject: bug#17125: Acknowledgement (24.4.50; daemon mode: closing X client frame exits entire emacs)

From: Dmitry Antipov <[email-masked]>
Date: Tue, 01 Apr 2014 19:08:40 +0400

On 04/01/2014 06:09 PM, Peder O. Klingenberg wrote:

> I will do the breakpoint thing, but I'm out of time at the moment.  I'll
> get to it either later today or tomorrow.

Don't; please try this patch instead (hopefully it fixes a bug
in font_matching_entity).

Dmitry

=== modified file 'src/composite.c'
--- src/composite.c	2014-02-13 12:16:42 +0000
+++ src/composite.c	2014-04-01 14:06:38 +0000
@@ -223,7 +223,7 @@
   if (INTEGERP (components))
     key = Fmake_vector (make_number (1), components);
   else if (STRINGP (components) || CONSP (components))
-    key = Fvconcat (1, &components);
+    key = vector1 (components);
   else if (VECTORP (components))
     key = components;
   else if (NILP (components))

=== modified file 'src/font.c'
--- src/font.c	2014-03-03 19:58:20 +0000
+++ src/font.c	2014-04-01 14:32:00 +0000
@@ -2701,7 +2701,7 @@
       if (prop < FONT_SPEC_MAX)
 	val = Fcons (entity, val);
     }
-  return (Fvconcat (1, &val));
+  return vector1 (val);
 }

@@ -2756,10 +2756,7 @@
 	    Lisp_Object copy;
 
 	    val = driver_list->driver->list (f, scratch_font_spec);
-	    if (NILP (val))
-	      val = zero_vector;
-	    else
-	      val = Fvconcat (1, &val);
+	    val = NILP (val) ? zero_vector : vector1 (val);
 	    copy = copy_font_spec (scratch_font_spec);
 	    ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
 	    XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache)));
@@ -2815,7 +2812,7 @@
 	    entity = driver_list->driver->match (f, work);
 	    copy = copy_font_spec (work);
 	    ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
-	    XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache)));
+	    XSETCDR (cache, Fcons (Fcons (copy, vector1 (entity)), XCDR (cache)));
 	  }
 	if (! NILP (entity))
 	  break;

=== modified file 'src/lisp.h'
--- src/lisp.h	2014-03-27 22:52:14 +0000
+++ src/lisp.h	2014-04-01 14:07:02 +0000
@@ -3709,6 +3709,16 @@
   return v;
 }
 
+/* Fast path to avoid Fvconcat (1, &obj).  */
+
+INLINE Lisp_Object
+vector1 (Lisp_Object obj)
+{
+  Lisp_Object v = make_uninit_vector (1);
+  ASET (v, 0, obj);
+  return v;
+}
+
 extern struct Lisp_Vector *allocate_pseudovector (int, int, enum pvec_type);
 #define ALLOCATE_PSEUDOVECTOR(typ,field,tag)				\
   ((typ*)								\