purcell / ac-slime

Emacs auto-complete plugin for Slime symbols
109 stars 10 forks source link

bug: always type mismatch when simple completions #2

Closed nakrakiiya closed 13 years ago

nakrakiiya commented 13 years ago

I'm using the latest ac-slime ( purcell-ac-slime-890f530 ) and the latest release of ac-slime and the latest slime. The auto-completion may crash while I'm typing, and the error message is like below.

The following is one example of this bug: value "ccl::function-form" is not of the expected type CHARACTER. [Condition of type TYPE-ERROR]

Restarts: 0: [*ABORT] Return to SLIME's top level. 1: [ABORT-BREAK] Reset this thread 2: [ABORT] Kill this thread

Backtrace: 0: (CHAR-EQUAL "ccl::function-form" #\S) 1: (MISMATCH #("ccl::function-form" 0 18 ..))) "SYM" :FROM-END NIL :TEST #<Compiled-function CHAR-EQUAL #x4119DC6> :TEST-NOT NIL :KEY #<Compiled-function IDENTITY #x410BF9E> :START1 0 :START2 0 :END1 4 :.. 2: (SWANK::PREFIX-MATCH-P #("ccl::function-form" 0 18 ..))) "SYM") 3: (#<Anonymous Function #xC63309E> SYM) 4: (CCL::APPLY-TO-HTAB-SYMS #<COMPILED-LEXICAL-CLOSURE #x1D9F9CE> #(SYM 0 VAR ACCESSOR 0 PREFIXES ...)) 5: (CCL::ITERATE-OVER-ACCESSABLE-SYMBOLS #<Package "COMMON-LISP-USER"> #<COMPILED-LEXICAL-CLOSURE #x1D9F9CE>) 6: (SWANK::MATCHING-SYMBOLS #<Package "COMMON-LISP-USER"> NIL #<COMPILED-LEXICAL-CLOSURE (:INTERNAL SWANK::ALL-COMPLETIONS) #xCC6528E>) 7: (SWANK::ALL-COMPLETIONS #("ccl::function-form" 0 18 ..))) "COMMON-LISP-USER") 8: (SWANK:SIMPLE-COMPLETIONS #("ccl::function-form" 0 18 ..))) "COMMON-LISP-USER") 9: (CCL::CALL-CHECK-REGS SWANK:SIMPLE-COMPLETIONS #("ccl::function-form" 0 18 ..))) "COMMON-LISP-USER") 10: (CCL::CHEAP-EVAL (SWANK:SIMPLE-COMPLETIONS ..)))) 11: (SWANK:EVAL-FOR-EMACS (SWANK:SIMPLE-COMPLETIONS ..))) "COMMON-LISP-USER" 567) 12: ((:INTERNAL SWANK::SPAWN-WORKER-THREAD)) 13: (SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK #<Compiled-function SWANK:SWANK-DEBUGGER-HOOK #xC6149A6> #<Compiled-function (:INTERNAL SWANK::SPAWN-WORKER-THREAD) (Non-Global) #xC5DABF6>) 14: (SWANK::CALL-WITH-BINDINGS ((STANDARD-OUTPUT . #<SWANK-BACKEND::SLIME-OUTPUT-STREAM #xC71D576>) (STANDARD-INPUT . #<SWANK-BACKEND::SLIME-INPUT-STREAM #xC71D7AE>) ..))) #<COMPILED-LEXICAL-CLOSURE (.. 15: ((:INTERNAL SWANK::SPAWN-WORKER-THREAD)) 16: (CCL::RUN-PROCESS-INITIAL-FORM #<PROCESS worker(1082) [Active] #xCC5E756> (#<COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::%PROCESS-RUN-FUNCTION) #xCC5E616>)) 17: ((:INTERNAL (CCL::%PROCESS-PRESET-INTERNAL (PROCESS))) #<PROCESS worker(1082) [Active] #xCC5E756> (#<COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::%PROCESS-RUN-FUNCTION) #xCC5E616>)) 18: ((:INTERNAL CCL::THREAD-MAKE-STARTUP-FUNCTION))


I've made a patch to solve this problem (the Chinese characters you can't see are the time): --- H:/emacs-23.1/home/elisp/ac-slime.el.orig 星期二 七月 26 06:09:00 2011 +++ H:/emacs-23.1/home/elisp/ac-slime.el 星期二 八月 30 09:57:34 2011 @@ -22,7 +22,10 @@ (defun ac-source-slime-simple-candidates () "Return a possibly-empty list of completions for the symbol at point." (if (slime-connected-p)

purcell commented 13 years ago

Cool, thanks. Any idea what causes this? I want to try and understand the slime (or auto-complete?) changes that have caused this breakage so that I can patch it in a way that's compatible with all versions.

-Steve

nakrakiiya commented 13 years ago

I don't know exactly when it can always happens. But when it happens, the sense mostly like this: First, I type some characters like: (conc Second, auto-complete completes like this: (concatenate ^^^^^^^ <-- the rest characters are underlined And then I continue my operations, the bug may occurs.

Sometimes this bug can occurs like this: First, I type few characters, this cause the completions are many many and it paused my editing and made me a long waiting. If I were typing while the waiting, it may crashed with the bug.

And sometimes it occurs randomly ;-)

The above senses seems may cause this crash but not always. It seems randomly for me. And this bug can occurs in common lisp implementations.

I think this bug occurs when the completion not provide a character but a whole prefix for the hook. This may the idea that how to fix this bug.

 Best regards,

Ṇakṛakīya Yang, 杨晓峰

2011/8/31 purcell < reply@reply.github.com>

Cool, thanks. Any idea what causes this? I want to try and understand the slime (or auto-complete?) changes that have caused this breakage so that I can patch it in a way that's compatible with all versions.

-Steve

Reply to this email directly or view it on GitHub: https://github.com/purcell/ac-slime/issues/2#issuecomment-1946018

nakrakiiya commented 13 years ago

It's possible to make this issue appear. Just download the latest version and reinstall emacs 23.1, auto-complete, slime, and ac-slime. Then use it in your daily life. You can see it in minutes (maybe few minutes). ;-)

 Best regards,

Ṇakṛakīya Yang, 杨晓峰

2011/8/31 purcell < reply@reply.github.com>

Cool, thanks. Any idea what causes this? I want to try and understand the slime (or auto-complete?) changes that have caused this breakage so that I can patch it in a way that's compatible with all versions.

-Steve

Reply to this email directly or view it on GitHub: https://github.com/purcell/ac-slime/issues/2#issuecomment-1946018

purcell commented 13 years ago

Thanks -- I'll take a look, probably at the weekend.

-Steve

On 31 Aug 2011, at 07:16, nakrakiiya wrote:

It's possible to make this issue appear. Just download the latest version and reinstall emacs 23.1, auto-complete, slime, and ac-slime. Then use it in your daily life. You can see it in minutes (maybe few minutes). ;-)

Best regards,

Ṇakṛakīya Yang, 杨晓峰

2011/8/31 purcell < reply@reply.github.com>

Cool, thanks. Any idea what causes this? I want to try and understand the slime (or auto-complete?) changes that have caused this breakage so that I can patch it in a way that's compatible with all versions.

-Steve

Reply to this email directly or view it on GitHub: https://github.com/purcell/ac-slime/issues/2#issuecomment-1946018

Reply to this email directly or view it on GitHub: https://github.com/purcell/ac-slime/issues/2#issuecomment-1953223

nakrakiiya commented 13 years ago

Now I don't think the patch can work always. Because the bug occurs again here. I'm thinking how to fix it. ;-P

Just type and edit the following two lines randomly and then you can see how the bug works: (lisp-implementation-type) (lisp-implementation-type)

I'm now using it to make the bug appear again. It always appears.

nakrakiiya commented 13 years ago

1 -> ac-source-slime-simple-candidates: | 2 -> slime-simple-completions: prefix="li" ; <-- in normal times | 2 <- slime-simple-completions: (("line" "link" "lisp-function" "lisp-heap-gc-threshold" "lisp-implementation-" "lisp-implementation-type" "lisp-implementation-version" "list" "list*" "list-all-packages" "list-form" "list-length" "listen" "listp") "li")

1 <- ac-source-slime-simple-candidates: ("line" "link" "lisp-function" "lisp-heap-gc-threshold" "lisp-implementation-" "lisp-implementation-type" "lisp-implementation-version" "list" "list*" "list-all-packages" "list-form" "list-length" "listen" "listp")

1 -> ac-source-slime-simple-candidates: | 2 -> slime-simple-completions: prefix=#("line" 0 4 (selection-face ac-slime-selection-face popup-face ac-slime-menu-face document ac-slime-documentation symbol "l")) ^^^^ --- crash here

purcell commented 13 years ago

Does it work if you change the "slime-simple-completions" call to this:

(slime-simple-completions (substring-no-properties ac-prefix))

??

-Steve

On 31 Aug 2011, at 10:16, nakrakiiya wrote:

1 -> ac-source-slime-simple-candidates: | 2 -> slime-simple-completions: prefix="li" ; <-- in normal times | 2 <- slime-simple-completions: (("line" "link" "lisp-function" "lisp-heap-gc-threshold" "lisp-implementation-" "lisp-implementation-type" "lisp-implementation-version" "list" "list*" "list-all-packages" "list-form" "list-length" "listen" "listp") "li")

1 <- ac-source-slime-simple-candidates: ("line" "link" "lisp-function" "lisp-heap-gc-threshold" "lisp-implementation-" "lisp-implementation-type" "lisp-implementation-version" "list" "list*" "list-all-packages" "list-form" "list-length" "listen" "listp")

1 -> ac-source-slime-simple-candidates: | 2 -> slime-simple-completions: prefix=#("line" 0 4 (selection-face ac-slime-selection-face popup-face ac-slime-menu-face document ac-slime-documentation symbol "l")) ^^^^ --- crash here

Reply to this email directly or view it on GitHub: https://github.com/purcell/ac-slime/issues/2#issuecomment-1955522

nakrakiiya commented 13 years ago

Yes, now the bug does not appears. I've traced it.

Now the function is like this:

(defun ac-source-slime-simple-candidates () "Return a possibly-empty list of completions for the symbol at point." (if (slime-connected-p) (car (slime-simple-completions (substring-no-properties ac-prefix)))))

I guess ac-source-slime-fuzzy-candidates has the same problem (though I don't use it now), so, I added substring-no-properties on it, like the following: (defun ac-source-slime-fuzzy-candidates () "Return a possibly-empty list of fuzzy completions for the symbol at point." (if (slime-connected-p) (let ((slime-fuzzy-completion-limit 50)) (mapcar 'car (car (slime-fuzzy-completions (substring-no-properties ac-prefix)))))))

Thanks for your advise.

 Best regards,

Xiaofeng Yang, 杨晓峰

2011/8/31 purcell < reply@reply.github.com>

Does it work if you change the "slime-simple-completions" call to this:

(slime-simple-completions (substring-no-properties ac-prefix))

??

-Steve

On 31 Aug 2011, at 10:16, nakrakiiya wrote:

1 -> ac-source-slime-simple-candidates: | 2 -> slime-simple-completions: prefix="li" ; <-- in normal times | 2 <- slime-simple-completions: (("line" "link" "lisp-function" "lisp-heap-gc-threshold" "lisp-implementation-" "lisp-implementation-type" "lisp-implementation-version" "list" "list" "list-all-packages" "list-form" "list-length" "listen" "listp") "li") 1 <- ac-source-slime-simple-candidates: ("line" "link" "lisp-function" "lisp-heap-gc-threshold" "lisp-implementation-" "lisp-implementation-type" "lisp-implementation-version" "list" "list" "list-all-packages" "list-form"

"list-length" "listen" "listp")

1 -> ac-source-slime-simple-candidates: | 2 -> slime-simple-completions: prefix=#("line" 0 4 (selection-face ac-slime-selection-face popup-face ac-slime-menu-face document ac-slime-documentation symbol "l")) ^^^^ --- crash here

Reply to this email directly or view it on GitHub: https://github.com/purcell/ac-slime/issues/2#issuecomment-1955522

Reply to this email directly or view it on GitHub: https://github.com/purcell/ac-slime/issues/2#issuecomment-1955597

nakrakiiya commented 13 years ago

The modified file can be fetched here: http://sourceforge.net/p/mefcl/code/6/tree/trunk/home/elisp/ac-slime.el?force=True

 Best regards,

Xiaofeng Yang, 杨晓峰

2011/8/31 purcell < reply@reply.github.com>

Does it work if you change the "slime-simple-completions" call to this:

(slime-simple-completions (substring-no-properties ac-prefix))

??

-Steve

On 31 Aug 2011, at 10:16, nakrakiiya wrote:

1 -> ac-source-slime-simple-candidates: | 2 -> slime-simple-completions: prefix="li" ; <-- in normal times | 2 <- slime-simple-completions: (("line" "link" "lisp-function" "lisp-heap-gc-threshold" "lisp-implementation-" "lisp-implementation-type" "lisp-implementation-version" "list" "list" "list-all-packages" "list-form" "list-length" "listen" "listp") "li") 1 <- ac-source-slime-simple-candidates: ("line" "link" "lisp-function" "lisp-heap-gc-threshold" "lisp-implementation-" "lisp-implementation-type" "lisp-implementation-version" "list" "list" "list-all-packages" "list-form"

"list-length" "listen" "listp")

1 -> ac-source-slime-simple-candidates: | 2 -> slime-simple-completions: prefix=#("line" 0 4 (selection-face ac-slime-selection-face popup-face ac-slime-menu-face document ac-slime-documentation symbol "l")) ^^^^ --- crash here

Reply to this email directly or view it on GitHub: https://github.com/purcell/ac-slime/issues/2#issuecomment-1955522

Reply to this email directly or view it on GitHub: https://github.com/purcell/ac-slime/issues/2#issuecomment-1955597

purcell commented 13 years ago

Thanks - I've pushed a fix to my repo.

-Steve

On 31 Aug 2011, at 14:02, nakrakiiya wrote:

Yes, now the bug does not appears. I've traced it.

Now the function is like this:

(defun ac-source-slime-simple-candidates () "Return a possibly-empty list of completions for the symbol at point." (if (slime-connected-p) (car (slime-simple-completions (substring-no-properties ac-prefix)))))

I guess ac-source-slime-fuzzy-candidates has the same problem (though I don't use it now), so, I added substring-no-properties on it, like the following: (defun ac-source-slime-fuzzy-candidates () "Return a possibly-empty list of fuzzy completions for the symbol at point." (if (slime-connected-p) (let ((slime-fuzzy-completion-limit 50)) (mapcar 'car (car (slime-fuzzy-completions (substring-no-properties ac-prefix)))))))

Thanks for your advise.

Best regards,

Xiaofeng Yang, 杨晓峰

2011/8/31 purcell < reply@reply.github.com>

Does it work if you change the "slime-simple-completions" call to this:

(slime-simple-completions (substring-no-properties ac-prefix))

??

-Steve

On 31 Aug 2011, at 10:16, nakrakiiya wrote:

1 -> ac-source-slime-simple-candidates: | 2 -> slime-simple-completions: prefix="li" ; <-- in normal times | 2 <- slime-simple-completions: (("line" "link" "lisp-function" "lisp-heap-gc-threshold" "lisp-implementation-" "lisp-implementation-type" "lisp-implementation-version" "list" "list" "list-all-packages" "list-form" "list-length" "listen" "listp") "li") 1 <- ac-source-slime-simple-candidates: ("line" "link" "lisp-function" "lisp-heap-gc-threshold" "lisp-implementation-" "lisp-implementation-type" "lisp-implementation-version" "list" "list" "list-all-packages" "list-form"

"list-length" "listen" "listp")

1 -> ac-source-slime-simple-candidates: | 2 -> slime-simple-completions: prefix=#("line" 0 4 (selection-face ac-slime-selection-face popup-face ac-slime-menu-face document ac-slime-documentation symbol "l")) ^^^^ --- crash here

Reply to this email directly or view it on GitHub: https://github.com/purcell/ac-slime/issues/2#issuecomment-1955522

Reply to this email directly or view it on GitHub: https://github.com/purcell/ac-slime/issues/2#issuecomment-1955597

Reply to this email directly or view it on GitHub: https://github.com/purcell/ac-slime/issues/2#issuecomment-1956964