Re: [CEDET-devel] [bump] semantic-complete-self-insert not working
Brought to you by:
zappo
From: Andrew B. <abu...@br...> - 2012-12-20 13:46:50
|
On 20/12/2012 1:11 PM, Andrew Burgess wrote: > Apologies for replying to such an old thread I just wanted to add... > > On 01/02/2012 1:31 AM, Eric M. Ludlam wrote: >> What is going on is that when there is no common prefix, the special >> Emacs overlay created to manage the inline completion as start==end. It >> goes into the inline completion engine, discovers that the point isn't >> "inside" the bounds of the overlay, and assumes you want to exit, and >> then exits the completion engine. >> >> I'm not sure what may have changed in the newer emacsen that may have >> caused the old code to behave this way. I've been fiddling in >> semantic-complete-post-command-hook to see what is going on and have >> been able to make it get partway through, but it still exits too soon. >> >> Here is a partial patch: >> === modified file 'lisp/cedet/semantic/complete.el' >> *** lisp/cedet/semantic/complete.el 2011-12-07 22:44:28 +0000 >> --- lisp/cedet/semantic/complete.el 2012-02-01 01:22:45 +0000 >> *************** >> *** 686,692 **** >> (cond >> ;; EXIT when we are no longer in a good place. >> ((or (not (eq b (current-buffer))) >> ! (<= (point) s) >> (> (point) e)) >> ;;(message "Exit: %S %S %S" s e (point)) >> (semantic-complete-inline-exit) >> --- 686,692 ---- >> (cond >> ;; EXIT when we are no longer in a good place. >> ((or (not (eq b (current-buffer))) >> ! (and (<= (point) s) (not (= s e))) >> (> (point) e)) >> ;;(message "Exit: %S %S %S" s e (point)) >> (semantic-complete-inline-exit) >> >> >> but it still doesn't work correctly for me. > > > At that point my complete lack of knowledge about the internals of cedet > means I can't offset any better solutions. > Ok, so a quick hack later and I have a patch proposal. There's probably better ways to solve this but at least this is a start. For me: - semantic-complete-self-insert now works even when there's no common prefix. - if I type some characters, then delete them back to a state where I have empty inline completion text, then inline completion exits. Let me know if there's anything else I could do to help with this patch. Thanks Andrew --- complete.el.orig 2012-12-20 13:29:21.787691000 +0000 +++ complete.el 2012-12-20 13:40:40.837095000 +0000 @@ -681,13 +681,15 @@ a reasonable distance." (let ((s (semantic-overlay-start semantic-complete-inline-overlay)) (e (semantic-overlay-end semantic-complete-inline-overlay)) (b (semantic-overlay-buffer semantic-complete-inline-overlay)) + (l (semantic-overlay-get semantic-complete-inline-overlay 'txt-length)) (txt nil) ) (cond ;; EXIT when we are no longer in a good place. ((or (not (eq b (current-buffer))) (< (point) s) - (> (point) e)) + (> (point) e) + (and (= s e) l (> l 0))) ;;(message "Exit: %S %S %S" s e (point)) (semantic-complete-inline-exit) ) @@ -708,7 +710,12 @@ a reasonable distance." nil ) (t - ;; Else, show completions now + ;; Else, + ;; Store the length of the user supplied text + (semantic-overlay-put semantic-complete-inline-overlay + 'txt-length + (length txt)) + ;; Show completions now (semantic-complete-inline-force-display) )))) |