[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: completion-at-point + semantic : erroneous error

From: Stefan Monnier
Subject: Re: completion-at-point + semantic : erroneous error
Date: Fri, 11 Oct 2019 13:04:55 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> 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

The backtrace shows that the error is signaled by

semantic-analyze-possible-completions called from
semantic-analyze-completion-at-point-function.  I'm not sufficiently
familiar with the way define-overloadable-function works to be sure what
to do here, but the patch below might be a start (it seems to fix the
immediate problem you're reporting here, but I see other places where
we signal this error).

Arguably, semantic-analyze-possible-completions should never be called
interactively nowadays (should always go through
completion-at-point-functions), so there are likely some cleanups that
could be done.


PS: It would also be good to replace uses of
define-overloadable-function with cl-defmethod, although the mapping
from one to the other is not immediate.

diff --git a/lisp/cedet/semantic/analyze/complete.el 
index b471c0d1a1..ea9bf9111b 100644
--- a/lisp/cedet/semantic/analyze/complete.el
+++ b/lisp/cedet/semantic/analyze/complete.el
@@ -93,7 +93,8 @@ semantic-analyze-possible-completions
                        (semantic-analyze-current-context context)))
             (ans (if (not context)
-                     (error "Nothing to complete")
+                     (when (called-interactively-p 'any)
+                       (error "Nothing to complete"))
        ;; If interactive, display them.
        (when (called-interactively-p 'any)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]