all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* completion-at-point + semantic : erroneous error
@ 2019-10-10  2:33 Eric Ludlam
  2019-10-11 17:04 ` Stefan Monnier
  0 siblings, 1 reply; 15+ messages in thread
From: Eric Ludlam @ 2019-10-10  2:33 UTC (permalink / raw)
  To: Emacs Development

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))



^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-10-27 23:36 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-10  2:33 completion-at-point + semantic : erroneous error Eric Ludlam
2019-10-11 17:04 ` Stefan Monnier
2019-10-11 17:34   ` Stefan Monnier
2019-10-12  1:06     ` Eric Ludlam
2019-10-24 20:17       ` Stefan Monnier
2019-10-27 12:35         ` Eric Ludlam
2019-10-27 20:38           ` Stefan Monnier
2019-10-27 23:36             ` Eric Ludlam
2019-10-12 11:56     ` Eric Ludlam
2019-10-23 20:18       ` Stefan Monnier
2019-10-27 11:52         ` Eric Ludlam
2019-10-27 21:54           ` Stefan Monnier
2019-10-27 22:31         ` Eric Ludlam
2019-10-23 20:22       ` Stefan Monnier
2019-10-27 11:53         ` Eric Ludlam

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.