please find the updated patch attached. (the vector serialization part was crappy and pointless so i've dropped it)
there are some other fixes in it, too, like the completion buffer randomly closing when editing the target buffer.
2006-10-21 Attila Lendvai attila.lendvai@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. (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.
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))))
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
Cheers, Ury
On 10/21/06, Ury Marshak urym@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@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 Lendvai wrote:
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
Well, here they are, from evaluating in *scratch* :
(setf slime-fuzzy-completion-in-place t) t
slime-target-buffer-fuzzy-completions-map (keymap (93 . slime-fuzzy-select-and-process-event-in-target-buffer) (91 . slime-fuzzy-select-and-process-event-in-target-buffer) (41 . slime-fuzzy-select-and-process-event-in-target-buffer) (40 . slime-fuzzy-select-and-process-event-in-target-buffer) (space . slime-fuzzy-select-and-process-event-in-target-buffer) (return . slime-fuzzy-select-and-process-event-in-target-buffer) (19 lambda nil (interactive) (select-window (get-buffer-window ...)) (call-interactively (quote isearch-forward))) (down . slime-fuzzy-next) (14 . slime-fuzzy-next) (up . slime-fuzzy-prev) (16 . slime-fuzzy-prev) ...)
slime-fuzzy-completions-map (keymap (space . slime-fuzzy-select) (return . slime-fuzzy-select) (mouse-2 . slime-fuzzy-select/mouse) (tab . slime-fuzzy-select) (127 . scroll-down) (112 . slime-fuzzy-prev) (27 keymap (112 . slime-fuzzy-prev) (110 . slime-fuzzy-next)) (110 . slime-fuzzy-next) (down . slime-fuzzy-next) (14 . slime-fuzzy-next) (up . slime-fuzzy-prev) ...)
With this patch things seem to come back to where they were, that is with completion-in-place arrow keys work, but return, space etc do what they were doing without selecting a completion.
Sorry for the lack of information, but I'm on a really unfamiliar ground with debugging keymaps.
Evaluation took: 0.037 seconds of real time
Wow! This is some serious speedup!
Cheers, Ury
slime-target-buffer-fuzzy-completions-map (keymap (93 . slime-fuzzy-select-and-process-event-in-target-buffer) (91 . slime-fuzzy-select-and-process-event-in-target-buffer) (41 . slime-fuzzy-select-and-process-event-in-target-buffer) (40 . slime-fuzzy-select-and-process-event-in-target-buffer) (space . slime-fuzzy-select-and-process-event-in-target-buffer) (return . slime-fuzzy-select-and-process-event-in-target-buffer) (19 lambda nil (interactive) (select-window (get-buffer-window ...)) (call-interactively (quote isearch-forward))) (down . slime-fuzzy-next) (14 . slime-fuzzy-next) (up . slime-fuzzy-prev) (16 . slime-fuzzy-prev) ...)
slime-fuzzy-completions-map (keymap (space . slime-fuzzy-select) (return . slime-fuzzy-select) (mouse-2 . slime-fuzzy-select/mouse) (tab . slime-fuzzy-select) (127 . scroll-down) (112 . slime-fuzzy-prev) (27 keymap (112 . slime-fuzzy-prev) (110 . slime-fuzzy-next)) (110 . slime-fuzzy-next) (down . slime-fuzzy-next) (14 . slime-fuzzy-next) (up . slime-fuzzy-prev) ...)
not that i have that much experience with keymaps, but these maps look good.
With this patch things seem to come back to where they were, that is
with completion-in-place arrow keys work, but return, space etc do what they were doing without selecting a completion.
from this i suspect that maybe there's something xemacs specific in slime-fuzzy-select-and-process-event-in-target-buffer or in slime-fuzzy-select. can you select a completion in any way at all? i mean by pressing enter/space in the selection buffer?
Sorry for the lack of information, but I'm on a really unfamiliar ground
with debugging keymaps.
no worries, thanks for the help!
hi!
please find my latest diffs attached. contains various goodies and it also contains the proposed new repl behaviour with which i'm satisfied now.
2006-11-01 Attila Lendvai attila.lendvai@gmail.com
* slime.el (sldb-sexp-highlight-mode): New custom. (slime-handle-repl-shortcut): Trigger slime-lookup-shortcut when the point is anywhere before slime-repl-input-start-mark. IOW, you can press "," anywhere before the prompt. (slime-edit-definition): Handle the case when there are only such entries returned from swank that have errors. (slime-read-from-minibuffer): Allow overriding of the keymap. (slime-repl-previous-matching-input): Similar behaviour like isearch-forward. (slime-repl-next-matching-input): Ditto. In more details: You can freely navigate with slime-repl-previous/next-input with M-p and M-n at any time among the history entries. When M-r is pressed, which invokes slime-repl-previous-matching-input, the the minibuffer is activated to read the regexp to search for and the contents will default to the current repl input. Pressing M-r again will start searching with the last pattern used no matter what the content of the minibuffer is. Subsequent invocations of M-r get the next match, and of course the same applies for M-s, which is slime-repl-previous-matching-input.
* swank.lisp (fuzzy-completion-set): Fix on clisp. (convert-fuzzy-completion-result): Fix symbol fbound and other annotations. (slot-value-using-class-for-inspector): New. (slot-boundp-using-class-for-inspector): New. (inspect-for-emacs): Use the special slot access methods so that it's possible to customize the inspecting of complex slots (e.g. computed-class at http://common-lisp.net/project/computed-class/). (all-slots-for-inspector): Converted to generic method.
please find my latest diffs attached. contains various goodies and it also contains the proposed new repl behaviour with which i'm satisfied now.
as usual there was a bug in it for gnu emacs. i've set up an emacs env finally, so please find the fixed patch attached.
the changes are the same:
2006-11-01 Attila Lendvai < attila.lendvai@gmail.com>
* slime.el (sldb-sexp-highlight-mode): New custom. (slime-handle-repl-shortcut): Trigger slime-lookup-shortcut when the point is anywhere before slime-repl-input-start-mark. IOW, you can press "," anywhere before the prompt. (slime-edit-definition): Handle the case when there are only such entries returned from swank that have errors. (slime-read-from-minibuffer): Allow overriding of the keymap. (slime-repl-previous-matching-input): Similar behaviour like isearch-forward. (slime-repl-next-matching-input): Ditto. In more details: You can freely navigate with slime-repl-previous/next-input with M-p and M-n at any time among the history entries. When M-r is pressed, which invokes slime-repl-previous-matching-input, the the minibuffer is activated to read the regexp to search for and the contents will default to the current repl input. Pressing M-r again will start searching with the last pattern used no matter what the content of the minibuffer is. Subsequent invocations of M-r get the next match, and of course the same applies for M-s, which is slime-repl-previous-matching-input. * swank.lisp (fuzzy-completion-set): Fix on clisp. (convert-fuzzy-completion-result): Fix symbol fbound and other annotations. (slot-value-using-class-for-inspector): New. (slot-boundp-using-class-for-inspector): New. (inspect-for-emacs): Use the special slot access methods so that it's possible to customize the inspecting of complex slots (e.g. computed-class at http://common-lisp.net/project/computed-class/). (all-slots-for-inspector): Converted to generic method.
"Attila Lendvai" attila.lendvai@gmail.com writes:
please find my latest diffs attached. contains various goodies and it also contains the proposed new repl behaviour with which i'm satisfied now.
i've been playing with this the last few days. it does change the way the repl works but i like it, so i went and commited it.