Can't make IME on after \"

Bug #1228511 reported by Masakazu Takahashi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ibus.el
New
Undecided
Unassigned

Bug Description

## bug description

When I type:

    abc \"def

and make IME on, ibus-el-agent prints excaption:

    eval: Traceback (most recent call last):
      File "/usr/lib/ibus-el/ibus-el-agent", line 555, in __stdin_cb
        exec sys.stdin.readline()
      File "<string>", line 1
        set_surrounding_text(1, "abc \"def", 9, 9)
                                      ^
    SyntaxError: invalid syntax

and IME doesn't made to be on.

## cause of error

In ibus.el, set_surrounding_text() is sent like:

    (ibus-agent-send "set_surrounding_text(%d, \"%s\", %d, %d)"
                     ibus-imcontext-id
                     (ibus-escape-string (car surrounding-text))
    ...

but backslashes doesn't seems tobe escaped by ibus-escape-string.

## patch

$ diff -u /usr/share/emacs/site-lisp/ibus/ibus.el ./ibus.el
--- /usr/share/emacs/site-lisp/ibus/ibus.el 2013-02-08 08:11:58.000000000 +0900
+++ ./ibus.el 2013-09-21 16:13:58.184039165 +0900
@@ -2493,14 +2493,14 @@
   (let* ((tmp (append str nil))
          cur
          (next tmp))
- (while (setq cur (memq ?\" next))
- (setq next (cdr cur))
- (setcar cur ?\\)
- (setcdr cur (cons ?\" next)))
     (while (setq cur (memq ?\\ next))
       (setq next (cdr cur))
       (setcdr cur (cons ?\\ next)))
     (setq next tmp)
+ (while (setq cur (memq ?\" next))
+ (setq next (cdr cur))
+ (setcar cur ?\\)
+ (setcdr cur (cons ?\" next)))
     (concat tmp)))

 (defun ibus-set-surrounding-text ()

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.