From: Eric Ludlam <eric@siege-engine.com>
To: Emacs Development <emacs-devel@gnu.org>
Subject: completion-at-point + semantic : erroneous error
Date: Wed, 9 Oct 2019 22:33:44 -0400 [thread overview]
Message-ID: <957ad127-0d84-69e3-49b6-9799975bd724@siege-engine.com> (raw)
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))
next reply other threads:[~2019-10-10 2:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-10 2:33 Eric Ludlam [this message]
2019-10-11 17:04 ` completion-at-point + semantic : erroneous error 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=957ad127-0d84-69e3-49b6-9799975bd724@siege-engine.com \
--to=eric@siege-engine.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).