emacs-devel
[Top][All Lists]
Advanced

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

Re: faster unicode character name completion


From: Stefan Monnier
Subject: Re: faster unicode character name completion
Date: Fri, 04 Dec 2009 10:07:57 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

> The drawback of the new code is that one can see only the
> list of the first words of character names in the completion
> buffer at once by C-x 8 RET TAB, instead of all of the
> unicode character names.

That's a pretty serious drawback as it prevents uses such as
C-x 8 RET *arro TAB.

Maybe another way to speed things up is to precompute the
ucs-completions lazy completion table at compilation time and store it
in a .elc file, so it can be "computed" by reading that file.

This can be done simply by having an autoloaded `ucs-completions'
function in a file where the ucs-completions variable is defined with an
eval-when-compile expression.

> (defun ucs-name-filter (str names)
>   (let (l)
>     (dolist (elt names)
>       (if (eq (string-match str (car elt)) 0)
>         (push elt l)))
>     l))

> (defun ucs-name-completion (str)
>   (when (string-match "^[A-Za-z]*" str)
>     (let ((head (match-string 0 str))
>         slot names)
>       (if (and (= (length head) (length str))
>              (not (assoc-string str ucs-name-head-table)))
>         (ucs-name-filter str ucs-name-head-table)
>       (ucs-name-filter str (ucs-name-expand-table head))))))

I don't understand what ucs-name-filter is trying to do.


        Stefan





reply via email to

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