Here are those patches in the form of a debdiff, in case that’s helpful.

Anders
diff -Nru emacs24-24.3+1/debian/changelog emacs24-24.3+1/debian/changelog
--- emacs24-24.3+1/debian/changelog     2014-05-14 20:30:52.000000000 -0400
+++ emacs24-24.3+1/debian/changelog     2014-08-29 23:06:45.000000000 -0400
@@ -1,3 +1,14 @@
+emacs24 (24.3+1-5) unstable; urgency=medium
+
+  * debian/patches/0015-Work-around-flaky-XIM-modules.patch,
+    debian/patches/0016-Improve-XIC-fix.patch,
+    debian/patches/0017-Further-improve-create_frame_xic-patch.patch,
+    debian/patches/0018-Further-improve-XIM-init.patch:
+    Apply upstream patches to make Emacs work with IBus and UIM.
+    (Closes: #753534) (LP: #493766)
+
+ -- Anders Kaseorg <ande...@mit.edu>  Thu, 28 Aug 2014 06:57:06 -0400
+
 emacs24 (24.3+1-4) unstable; urgency=medium
 
   [ Rob Browning ]
diff -Nru 
emacs24-24.3+1/debian/patches/0015-Work-around-flaky-XIM-modules.patch 
emacs24-24.3+1/debian/patches/0015-Work-around-flaky-XIM-modules.patch
--- emacs24-24.3+1/debian/patches/0015-Work-around-flaky-XIM-modules.patch      
1969-12-31 19:00:00.000000000 -0500
+++ emacs24-24.3+1/debian/patches/0015-Work-around-flaky-XIM-modules.patch      
2014-08-29 23:05:11.000000000 -0400
@@ -0,0 +1,35 @@
+From: Daniel Colascione <dan...@dancol.org>
+Subject: Work around flaky XIM modules
+Origin: upstream, 
http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/116856.1.1
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=753534
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/emacs24/+bug/493766
+Last-Update: 2014-08-29
+Applied-Upstream: 
http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/116856.1.1
+---
+ src/xfns.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/src/xfns.c b/src/xfns.c
+index 656b71f..f1d4a48 100644
+--- a/src/xfns.c
++++ b/src/xfns.c
+@@ -2221,6 +2221,16 @@ create_frame_xic (struct frame *f)
+                      XNStatusAttributes, status_attr,
+                      XNPreeditAttributes, preedit_attr,
+                      NULL);
++
++      /* Some input methods don't support a status pixel.  */
++      if (xic == NULL)
++        xic = XCreateIC (xim,
++                         XNInputStyle, xic_style,
++                         XNClientWindow, FRAME_X_WINDOW (f),
++                         XNFocusWindow, FRAME_X_WINDOW (f),
++                         XNPreeditAttributes, preedit_attr,
++                         NULL);
++
+       XFree (preedit_attr);
+       XFree (status_attr);
+     }
+-- 
+2.0.1
+
diff -Nru emacs24-24.3+1/debian/patches/0016-Improve-XIC-fix.patch 
emacs24-24.3+1/debian/patches/0016-Improve-XIC-fix.patch
--- emacs24-24.3+1/debian/patches/0016-Improve-XIC-fix.patch    1969-12-31 
19:00:00.000000000 -0500
+++ emacs24-24.3+1/debian/patches/0016-Improve-XIC-fix.patch    2014-08-29 
23:05:11.000000000 -0400
@@ -0,0 +1,150 @@
+From: Daniel Colascione <dan...@dancol.org>
+Subject: Improve XIC fix
+Origin: upstream, 
http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/116856.1.2
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=753534
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/emacs24/+bug/493766
+Last-Update: 2014-08-29
+Applied-Upstream: 
http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/116856.1.2
+---
+ src/xfns.c | 102 +++++++++++++++++++++++++++++++++++++------------------------
+ 1 file changed, 62 insertions(+), 40 deletions(-)
+
+diff --git a/src/xfns.c b/src/xfns.c
+index f1d4a48..2fe98c3 100644
+--- a/src/xfns.c
++++ b/src/xfns.c
+@@ -2164,27 +2164,27 @@ create_frame_xic (struct frame *f)
+   XIM xim;
+   XIC xic = NULL;
+   XFontSet xfs = NULL;
++  XVaNestedList status_attr = NULL;
++  XVaNestedList preedit_attr = NULL;
++  XRectangle s_area;
++  XPoint spot;
++  XIMStyles supported_list;
+ 
+   if (FRAME_XIC (f))
+     return;
+ 
+   /* Create X fontset. */
+   xfs = xic_create_xfontset (f);
++  FRAME_XIC_FONTSET (f) = xfs;
++
+   xim = FRAME_X_XIM (f);
+   if (xim)
+     {
+-      XRectangle s_area;
+-      XPoint spot;
+-      XVaNestedList preedit_attr;
+-      XVaNestedList status_attr;
+-
+-      s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1;
+       spot.x = 0; spot.y = 1;
+ 
+       /* Determine XIC style.  */
+       if (xic_style == 0)
+       {
+-        XIMStyles supported_list;
+         supported_list.count_styles = (sizeof supported_xim_styles
+                                        / sizeof supported_xim_styles[0]);
+         supported_list.supported_styles = supported_xim_styles;
+@@ -2203,41 +2203,63 @@ create_frame_xic (struct frame *f)
+                                          : NULL),
+                                         &spot,
+                                         NULL);
+-      status_attr = XVaCreateNestedList (0,
+-                                       XNArea,
+-                                       &s_area,
+-                                       XNFontSet,
+-                                       xfs,
+-                                       XNForeground,
+-                                       FRAME_FOREGROUND_PIXEL (f),
+-                                       XNBackground,
+-                                       FRAME_BACKGROUND_PIXEL (f),
+-                                       NULL);
+-
+-      xic = XCreateIC (xim,
+-                     XNInputStyle, xic_style,
+-                     XNClientWindow, FRAME_X_WINDOW (f),
+-                     XNFocusWindow, FRAME_X_WINDOW (f),
+-                     XNStatusAttributes, status_attr,
+-                     XNPreeditAttributes, preedit_attr,
+-                     NULL);
+-
+-      /* Some input methods don't support a status pixel.  */
+-      if (xic == NULL)
+-        xic = XCreateIC (xim,
+-                         XNInputStyle, xic_style,
+-                         XNClientWindow, FRAME_X_WINDOW (f),
+-                         XNFocusWindow, FRAME_X_WINDOW (f),
+-                         XNPreeditAttributes, preedit_attr,
+-                         NULL);
+-
+-      XFree (preedit_attr);
+-      XFree (status_attr);
++
++      if (!preedit_attr)
++        goto out;
++
++      if (xic_style & XIMStatusArea)
++        {
++          s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1;
++          status_attr = XVaCreateNestedList (0,
++                                             XNArea,
++                                             &s_area,
++                                             XNFontSet,
++                                             xfs,
++                                             XNForeground,
++                                             FRAME_FOREGROUND_PIXEL (f),
++                                             XNBackground,
++                                             FRAME_BACKGROUND_PIXEL (f),
++                                             NULL);
++
++          if (!status_attr)
++            goto out;
++
++          xic = XCreateIC (xim,
++                           XNInputStyle, xic_style,
++                           XNClientWindow, FRAME_X_WINDOW (f),
++                           XNFocusWindow, FRAME_X_WINDOW (f),
++                           XNStatusAttributes, status_attr,
++                           XNPreeditAttributes, preedit_attr,
++                           NULL);
++        }
++      else
++        {
++          xic = XCreateIC (xim,
++                           XNInputStyle, xic_style,
++                           XNClientWindow, FRAME_X_WINDOW (f),
++                           XNFocusWindow, FRAME_X_WINDOW (f),
++                           XNPreeditAttributes, preedit_attr,
++                           NULL);
++        }
++
++      if (!xic)
++        goto out;
++
++      FRAME_XIC (f) = xic;
++      FRAME_XIC_STYLE (f) = xic_style;
++      xfs = NULL; /* Don't free below.  */
+     }
+ 
+-  FRAME_XIC (f) = xic;
+-  FRAME_XIC_STYLE (f) = xic_style;
+-  FRAME_XIC_FONTSET (f) = xfs;
++ out:
++
++  if (xfs)
++    free_frame_xic (f);
++
++  if (preedit_attr)
++    XFree (preedit_attr);
++
++  if (status_attr)
++    XFree (status_attr);
+ }
+ 
+ 
+-- 
+2.0.1
+
diff -Nru 
emacs24-24.3+1/debian/patches/0017-Further-improve-create_frame_xic-patch.patch 
emacs24-24.3+1/debian/patches/0017-Further-improve-create_frame_xic-patch.patch
--- 
emacs24-24.3+1/debian/patches/0017-Further-improve-create_frame_xic-patch.patch 
    1969-12-31 19:00:00.000000000 -0500
+++ 
emacs24-24.3+1/debian/patches/0017-Further-improve-create_frame_xic-patch.patch 
    2014-08-29 23:05:11.000000000 -0400
@@ -0,0 +1,181 @@
+From: Daniel Colascione <dan...@dancol.org>
+Subject: Further improve create_frame_xic patch
+Origin: upstream, 
http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/116856.1.3
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=753534
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/emacs24/+bug/493766
+Last-Update: 2014-08-29
+Applied-Upstream: 
http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/116856.1.3
+---
+ src/xfns.c | 131 ++++++++++++++++++++++++++++++++++---------------------------
+ 1 file changed, 73 insertions(+), 58 deletions(-)
+
+diff --git a/src/xfns.c b/src/xfns.c
+index 2fe98c3..76036b8 100644
+--- a/src/xfns.c
++++ b/src/xfns.c
+@@ -2156,8 +2156,6 @@ best_xim_style (XIMStyles *user, XIMStyles *xim)
+ 
+ /* Create XIC for frame F. */
+ 
+-static XIMStyle xic_style;
+-
+ void
+ create_frame_xic (struct frame *f)
+ {
+@@ -2169,29 +2167,34 @@ create_frame_xic (struct frame *f)
+   XRectangle s_area;
+   XPoint spot;
+   XIMStyles supported_list;
++  XIMStyle xic_style;
+ 
+   if (FRAME_XIC (f))
+-    return;
+-
+-  /* Create X fontset. */
+-  xfs = xic_create_xfontset (f);
+-  FRAME_XIC_FONTSET (f) = xfs;
++    goto out;
+ 
+   xim = FRAME_X_XIM (f);
+-  if (xim)
++  if (!xim)
++    goto out;
++
++  /* Determine XIC style.  */
++  supported_list.count_styles = (sizeof supported_xim_styles
++                                 / sizeof supported_xim_styles[0]);
++  supported_list.supported_styles = supported_xim_styles;
++  xic_style = best_xim_style (&supported_list, FRAME_X_XIM_STYLES (f));
++
++  /* Create X fontset. */
++  if (xic_style & (XIMPreeditPosition | XIMStatusArea))
+     {
+-      spot.x = 0; spot.y = 1;
++      xfs = xic_create_xfontset (f);
++      if (!xfs)
++        goto out;
+ 
+-      /* Determine XIC style.  */
+-      if (xic_style == 0)
+-      {
+-        supported_list.count_styles = (sizeof supported_xim_styles
+-                                       / sizeof supported_xim_styles[0]);
+-        supported_list.supported_styles = supported_xim_styles;
+-        xic_style = best_xim_style (&supported_list,
+-                                    FRAME_X_XIM_STYLES (f));
+-      }
++      FRAME_XIC_FONTSET (f) = xfs;
++    }
+ 
++  if (xic_style & XIMPreeditPosition)
++    {
++      spot.x = 0; spot.y = 1;
+       preedit_attr = XVaCreateNestedList (0,
+                                         XNFontSet, xfs,
+                                         XNForeground,
+@@ -2206,50 +2209,62 @@ create_frame_xic (struct frame *f)
+ 
+       if (!preedit_attr)
+         goto out;
++    }
+ 
+-      if (xic_style & XIMStatusArea)
+-        {
+-          s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1;
+-          status_attr = XVaCreateNestedList (0,
+-                                             XNArea,
+-                                             &s_area,
+-                                             XNFontSet,
+-                                             xfs,
+-                                             XNForeground,
+-                                             FRAME_FOREGROUND_PIXEL (f),
+-                                             XNBackground,
+-                                             FRAME_BACKGROUND_PIXEL (f),
+-                                             NULL);
+-
+-          if (!status_attr)
+-            goto out;
+-
+-          xic = XCreateIC (xim,
+-                           XNInputStyle, xic_style,
+-                           XNClientWindow, FRAME_X_WINDOW (f),
+-                           XNFocusWindow, FRAME_X_WINDOW (f),
+-                           XNStatusAttributes, status_attr,
+-                           XNPreeditAttributes, preedit_attr,
+-                           NULL);
+-        }
+-      else
+-        {
+-          xic = XCreateIC (xim,
+-                           XNInputStyle, xic_style,
+-                           XNClientWindow, FRAME_X_WINDOW (f),
+-                           XNFocusWindow, FRAME_X_WINDOW (f),
+-                           XNPreeditAttributes, preedit_attr,
+-                           NULL);
+-        }
+-
+-      if (!xic)
++  if (xic_style & XIMStatusArea)
++    {
++      s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1;
++      status_attr = XVaCreateNestedList (0,
++                                         XNArea,
++                                         &s_area,
++                                         XNFontSet,
++                                         xfs,
++                                         XNForeground,
++                                         FRAME_FOREGROUND_PIXEL (f),
++                                         XNBackground,
++                                         FRAME_BACKGROUND_PIXEL (f),
++                                         NULL);
++
++      if (!status_attr)
+         goto out;
+-
+-      FRAME_XIC (f) = xic;
+-      FRAME_XIC_STYLE (f) = xic_style;
+-      xfs = NULL; /* Don't free below.  */
+     }
+ 
++  if (preedit_attr && status_attr)
++    xic = XCreateIC (xim,
++                     XNInputStyle, xic_style,
++                     XNClientWindow, FRAME_X_WINDOW (f),
++                     XNFocusWindow, FRAME_X_WINDOW (f),
++                     XNStatusAttributes, status_attr,
++                     XNPreeditAttributes, preedit_attr,
++                     NULL);
++  else if (preedit_attr)
++    xic = XCreateIC (xim,
++                     XNInputStyle, xic_style,
++                     XNClientWindow, FRAME_X_WINDOW (f),
++                     XNFocusWindow, FRAME_X_WINDOW (f),
++                     XNPreeditAttributes, preedit_attr,
++                     NULL);
++  else if (status_attr)
++    xic = XCreateIC (xim,
++                     XNInputStyle, xic_style,
++                     XNClientWindow, FRAME_X_WINDOW (f),
++                     XNFocusWindow, FRAME_X_WINDOW (f),
++                     XNStatusAttributes, status_attr,
++                     NULL);
++  else
++    xic = XCreateIC (xim,
++                     XNInputStyle, xic_style,
++                     XNClientWindow, FRAME_X_WINDOW (f),
++                     XNFocusWindow, FRAME_X_WINDOW (f),
++                     NULL);
++
++  if (!xic)
++    goto out;
++
++  FRAME_XIC (f) = xic;
++  FRAME_XIC_STYLE (f) = xic_style;
++  xfs = NULL; /* Don't free below.  */
++
+  out:
+ 
+   if (xfs)
+-- 
+2.0.1
+
diff -Nru emacs24-24.3+1/debian/patches/0018-Further-improve-XIM-init.patch 
emacs24-24.3+1/debian/patches/0018-Further-improve-XIM-init.patch
--- emacs24-24.3+1/debian/patches/0018-Further-improve-XIM-init.patch   
1969-12-31 19:00:00.000000000 -0500
+++ emacs24-24.3+1/debian/patches/0018-Further-improve-XIM-init.patch   
2014-08-29 23:05:11.000000000 -0400
@@ -0,0 +1,74 @@
+From: Daniel Colascione <dan...@dancol.org>
+Subject: Further improve XIM init
+Origin: upstream, 
http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/116856.1.4
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=753534
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/emacs24/+bug/493766
+Last-Update: 2014-08-29
+Applied-Upstream: 
http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/116856.1.4
+---
+ src/xfns.c | 20 +++++++++-----------
+ 1 file changed, 9 insertions(+), 11 deletions(-)
+
+diff --git a/src/xfns.c b/src/xfns.c
+index 76036b8..0d649c6 100644
+--- a/src/xfns.c
++++ b/src/xfns.c
+@@ -1838,12 +1838,12 @@ hack_wm_protocols (FRAME_PTR f, Widget widget)
+ #ifdef HAVE_X_I18N
+ 
+ static XFontSet xic_create_xfontset (struct frame *);
+-static XIMStyle best_xim_style (XIMStyles *, XIMStyles *);
++static XIMStyle best_xim_style (XIMStyles *);
+ 
+ 
+ /* Supported XIM styles, ordered by preference.  */
+ 
+-static XIMStyle supported_xim_styles[] =
++static const XIMStyle supported_xim_styles[] =
+ {
+   XIMPreeditPosition | XIMStatusArea,
+   XIMPreeditPosition | XIMStatusNothing,
+@@ -2141,14 +2141,16 @@ xic_free_xfontset (struct frame *f)
+    input method XIM.  */
+ 
+ static XIMStyle
+-best_xim_style (XIMStyles *user, XIMStyles *xim)
++best_xim_style (XIMStyles *xim)
+ {
+   int i, j;
++  int nr_supported =
++    sizeof (supported_xim_styles) / sizeof (supported_xim_styles[0]);
+ 
+-  for (i = 0; i < user->count_styles; ++i)
++  for (i = 0; i < nr_supported; ++i)
+     for (j = 0; j < xim->count_styles; ++j)
+-      if (user->supported_styles[i] == xim->supported_styles[j])
+-      return user->supported_styles[i];
++      if (supported_xim_styles[i] == xim->supported_styles[j])
++      return supported_xim_styles[i];
+ 
+   /* Return the default style.  */
+   return XIMPreeditNothing | XIMStatusNothing;
+@@ -2166,7 +2168,6 @@ create_frame_xic (struct frame *f)
+   XVaNestedList preedit_attr = NULL;
+   XRectangle s_area;
+   XPoint spot;
+-  XIMStyles supported_list;
+   XIMStyle xic_style;
+ 
+   if (FRAME_XIC (f))
+@@ -2177,10 +2178,7 @@ create_frame_xic (struct frame *f)
+     goto out;
+ 
+   /* Determine XIC style.  */
+-  supported_list.count_styles = (sizeof supported_xim_styles
+-                                 / sizeof supported_xim_styles[0]);
+-  supported_list.supported_styles = supported_xim_styles;
+-  xic_style = best_xim_style (&supported_list, FRAME_X_XIM_STYLES (f));
++  xic_style = best_xim_style (FRAME_X_XIM_STYLES (f));
+ 
+   /* Create X fontset. */
+   if (xic_style & (XIMPreeditPosition | XIMStatusArea))
+-- 
+2.0.1
+
diff -Nru emacs24-24.3+1/debian/patches/series 
emacs24-24.3+1/debian/patches/series
--- emacs24-24.3+1/debian/patches/series        2014-05-14 20:30:52.000000000 
-0400
+++ emacs24-24.3+1/debian/patches/series        2014-08-29 23:05:11.000000000 
-0400
@@ -12,3 +12,7 @@
 0012-Security-issues-in-find-gc.el-have-been-fixed-CVE-20.patch
 0013-Security-issues-in-tramp-have-been-fixed-CVE-2014-34.patch
 0014-Insecure-file-handling-in-browse-url-mosaic-has-been.patch
+0015-Work-around-flaky-XIM-modules.patch
+0016-Improve-XIC-fix.patch
+0017-Further-improve-create_frame_xic-patch.patch
+0018-Further-improve-XIM-init.patch

Reply via email to