[slime-devel] fuzzy update with fixes

Attila Lendvai attila.lendvai at gmail.com
Sat Oct 21 21:19:29 UTC 2006


On 10/21/06, Ury Marshak <urym at two-bytes.com> wrote:
>
> Attila Lendvai wrote:
> > +  (add-local-hook 'pre-command-hook 'slime-pre-command-hook)
> >
>
> add-local-hook seems to be missing from GNU emacs.
> Quick googling suggests adding:
>
> (or (fboundp 'add-local-hook)
>     (defun add-local-hook (hook function &optional append)
>       (make-local-hook hook)
>       (add-hook hook function append t)))
>
> (or (fboundp 'remove-local-hook)
>     (defun remove-local-hook (hook function)
>       (if (local-variable-p hook (current-buffer))
>           (remove-hook hook function t))))


thanks, i've added these. i checked the things that i use but this one seems
to slip through. seems like it's time to set up an emacs env, too...

Also, after fixing add-local-hook, when trying
> slime-fuzzy-completion-in-place
> it seems to break it for me even further - without the patch at least the
> arrow
> keys in the target buffer work, with this patch even arrows stop working
> (they
> work as in normal buffer, but do not move selection in the completion
> buffer)
>
> This is on CVS HEAD GNU Emacs


hm, if it is still broken with this patch then it would be very helpful if
you could take a look at slime-target-buffer-fuzzy-completions-map and
slime-fuzzy-completions-map and check if the bindings themselves are broken
(which is probably the case, because that's changed in that previous patch).

there's some new heuristic in this patch that it first tries to look up the
operation's binding in the global-map and only use the default (arrow keys)
when nothing was found. this may turn out to be a bad idea, but for now i
made it a bit smarter to mimic all bound keys of the operations from
global-map. i hope this will help, or if not, the bug can be fixed. some
people don't use the arrow keys on laptops, etc... it's a big help for them
(when working :)

and finally there's another speedup with large set of symbols (there was a
costly remove-duplicates call):

CL-USER> (progn
        (sb-ext:gc :full t)
        (length (time (swank::fuzzy-find-matching-symbols "" "SB-PCL"
nil))))
Evaluation took:
  1.41 seconds of real time
  1.166823 seconds of user run time
  0.0 seconds of system run time
  0 calls to %EVAL
  0 page faults and
  323,088 bytes consed.
4923

CL-USER> (progn
        (sb-ext:gc :full t)
        (length (time (swank::fuzzy-find-matching-symbols "" "SB-PCL"
nil))))
Evaluation took:
  0.037 seconds of real time
  0.028996 seconds of user run time
  0.001 seconds of system run time
  0 calls to %EVAL
  0 page faults and
  772,240 bytes consed.
4931

the speedup is only this radical when we are processing the entire package
without any input, though. the small difference in the length is coming from
the new method comparing the symbols with 'eq as opposed to the old one
comparing strings with 'equal at the very end. so there may be a few
duplicates in rare situations.


2006-10-21  Attila Lendvai  <attila.lendvai at gmail.com>

    * slime.el (slime-setup-command-hooks): Use make-local-hook.
    (slime-repl-mode): Ditto.
    (slime-fuzzy-choices-buffer): Ditto.
    (sldb-mode): Ditto.
    (slime-fuzzy-completion-limit): New variable.
    (slime-fuzzy-completion-time-limit-in-msec): New variable.
    (slime-fuzzy-next): Fix when at the end of the buffer.
    (completion-output-symbol-converter): New to handle escaped
    symbols for those who need to mess around with symbols like
    layered-function-definers::|CONTEXTL::SLOT-VALUE-USING-LAYER|.
    When a symbol is escaped then completion is case sensitive.
    (completion-output-package-converter): New.
    (mimic-key-bindings): New to easily define bindings by first
    trying to look up bindings for an operation and only use
    the provided default bindings if nothing was found in the
    source keymap. Use it to set up fuzzy bindings. (Hint:
    if you have keys like previous-line customized,    then only
    load slime after they have been set, and the fuzzy mode
    will mimic them.)
    (slime-temp-buffer-quit): Always close the opened window,
    updated docstring.
    Also made the fuzzy maps smarter, they now try to look up
    keys with 'where-is-internal and map the functions on them.

    * swank-sbcl.lisp
    (make-weak-value-hash-table): New for sbcl.
    (make-weak-key-hash-table): New for sbcl.

    * swank.lisp (fuzzy-completions and friends): Added :limit
    and :time-limit-in-msec keyword params. Used vectors instead
    of lists that nearly doubled its speed (at least on sbcl).
    Also added some declare optimize and type annotations.
    (do-symbols*): New, uses a hash-table to visit only non-seen
    symbols. Replaced various uses of do-symbols where it was
    appropiate.

-- 
- attila

"- The truth is that I've been too considerate, and so became
unintentionally cruel...
- I understand.
- No, you don't understand! We don't speak the same language!"
(Ingmar Bergman - Smultronstället)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/slime-devel/attachments/20061021/1c742a11/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fuzzy-speed-and-fixes2.diff.gz
Type: application/x-gzip
Size: 6653 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/slime-devel/attachments/20061021/1c742a11/attachment.bin>


More information about the slime-devel mailing list