[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
completion-at-point + semantic : erroneous error
From: |
Eric Ludlam |
Subject: |
completion-at-point + semantic : erroneous error |
Date: |
Wed, 9 Oct 2019 22:33:44 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
Hi all,
I'm updating from Emacs 24 w/ CEDET from sourceforge to Emacs from git,
using built-in cedet, and I encountered an unexpected error. A
simplified reproduction step is:
emacs -q
M-x semantic-mode
; visit a file supported by semantic, such as a C file
; put cursor in a blank space
M-x completion-at-point
It will error with: "Nothing to complete".
The underlying completion function has always issued this error, but the
way it was brought into completion-at-point causes it to error mid way.
I'm not completely familiar with completion-at-point behavior, but my
assumption is it terminates navigating the list of completion functions.
This also showed up when using company-mode which seems to use the same
underlying function list by default. It is also especially annoying if
'debug-on-error' is on with company mode, as the stack just keeps
popping up when typing innocuous things.
The list of items in the list of completion functions include
`semantic-analyze-completion-at-point-function' and a couple others. I
believe these functions, specific to completion-at-point, need to wrap
their call the the underlying `semantic-analyze-possible-completions' so
that errors aren't thrown, and it doesn't get in the way when debugging
something completely different.
The below patch solved the problem for me.
Thanks
Eric
diff --git a/lisp/cedet/semantic/analyze.el b/lisp/cedet/semantic/analyze.el
index 6851ad556a..4e2d9d8728 100644
--- a/lisp/cedet/semantic/analyze.el
+++ b/lisp/cedet/semantic/analyze.el
@@ -827,7 +827,9 @@ semantic-analyze-completion-at-point-function
This function can be used by `completion-at-point-functions'."
(when (semantic-active-p)
(let* ((ctxt (semantic-analyze-current-context))
- (possible (semantic-analyze-possible-completions ctxt)))
+ (possible (condition-case nil
+ (semantic-analyze-possible-completions ctxt)
+ (error nil))))
;; The return from this is either:
;; nil - not applicable here.
@@ -846,7 +848,9 @@ semantic-analyze-notc-completion-at-point-function
This function can be used by `completion-at-point-functions'."
(when (semantic-active-p)
(let* ((ctxt (semantic-analyze-current-context))
- (possible (semantic-analyze-possible-completions ctxt 'no-tc)))
+ (possible (condition-case nil
+ (semantic-analyze-possible-completions ctxt
'no-tc)
+ (error nil))))
(when possible
(list (car (oref ctxt bounds))
@@ -862,8 +866,10 @@
semantic-analyze-nolongprefix-completion-at-point-function
This function can be used by `completion-at-point-functions'."
(when (semantic-active-p)
(let* ((ctxt (semantic-analyze-current-context))
- (possible (semantic-analyze-possible-completions
- ctxt 'no-tc 'no-longprefix)))
+ (possible (condition-case nil
+ (semantic-analyze-possible-completions
+ ctxt 'no-tc 'no-longprefix)
+ (error nil))))
(when possible
(list (car (oref ctxt bounds))
- completion-at-point + semantic : erroneous error,
Eric Ludlam <=
- Re: completion-at-point + semantic : erroneous error, Stefan Monnier, 2019/10/11
- Re: completion-at-point + semantic : erroneous error, Stefan Monnier, 2019/10/11
- Re: completion-at-point + semantic : erroneous error, Eric Ludlam, 2019/10/11
- Re: completion-at-point + semantic : erroneous error, Stefan Monnier, 2019/10/24
- Re: completion-at-point + semantic : erroneous error, Eric Ludlam, 2019/10/27
- Re: completion-at-point + semantic : erroneous error, Stefan Monnier, 2019/10/27
- Re: completion-at-point + semantic : erroneous error, Eric Ludlam, 2019/10/27
- Re: completion-at-point + semantic : erroneous error, Eric Ludlam, 2019/10/12
- Re: completion-at-point + semantic : erroneous error, Stefan Monnier, 2019/10/23
- Re: completion-at-point + semantic : erroneous error, Eric Ludlam, 2019/10/27