[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: x-select-utf8-or-ctext is too slow
From: |
Kenichi Handa |
Subject: |
Re: x-select-utf8-or-ctext is too slow |
Date: |
Tue, 10 Feb 2004 11:35:45 +0900 (JST) |
User-agent: |
SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.3 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) |
In article <address@hidden>, Jesper Harder <address@hidden> writes:
> Yanking text from another application to Emacs is extremely slow. It
> took 40 seconds for me to yank just 1000 lines of text from Mozilla to
> Emacs -- all of it spent in `x-select-utf8-or-ctext'
Please try this. If the resulting performance is
reasonable, I'll install it. Otherwise, I'll consider a
faster method.
(defun x-select-utf8-or-ctext (utf8 ctext)
(let ((len-utf8 (length utf8))
(len-ctext (length ctext))
(selected ctext)
(i 0)
char)
(if (/= len-utf8 len-ctext)
(if (> len-utf8 len-ctext) utf8 ctext)
(let ((result (compare-strings utf8 0 len-utf8 ctext 0 len-ctext)))
(if (or (eq result t)
(>= (aref ctext (1- (abs result))) 128))
ctext
utf8)))))
---
Ken'ichi HANDA
address@hidden