From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eric Ludlam Newsgroups: gmane.emacs.devel Subject: Re: completion-at-point + semantic : erroneous error Date: Sun, 27 Oct 2019 18:31:19 -0400 Message-ID: <52e166a2-1ec3-2674-298c-a39923d70860@gmail.com> References: <957ad127-0d84-69e3-49b6-9799975bd724@siege-engine.com> <9cf7e484-9a86-ab1c-b04f-9dc3e7c91974@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------190751B7A9EA01DEA71A44EE" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="39617"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 Cc: Emacs Development , Eric Ludlam To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 27 23:31:40 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iOr4W-000ACd-3a for ged-emacs-devel@m.gmane.org; Sun, 27 Oct 2019 23:31:40 +0100 Original-Received: from localhost ([::1]:49762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iOr4U-0003zZ-Kx for ged-emacs-devel@m.gmane.org; Sun, 27 Oct 2019 18:31:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33911) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iOr4I-0003tF-CC for emacs-devel@gnu.org; Sun, 27 Oct 2019 18:31:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iOr4F-0005Bc-G8 for emacs-devel@gnu.org; Sun, 27 Oct 2019 18:31:25 -0400 Original-Received: from mail-qk1-x730.google.com ([2607:f8b0:4864:20::730]:36857) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iOr4F-0005BQ-Ax for emacs-devel@gnu.org; Sun, 27 Oct 2019 18:31:23 -0400 Original-Received: by mail-qk1-x730.google.com with SMTP id y189so6811089qkc.3 for ; Sun, 27 Oct 2019 15:31:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=RpXfdPyEt56ILV8qLvVH71uwQhRr7wSOF66eUsxLyiQ=; b=naOQBVlTWegf3ff94l8lrPKsr98lLuNv9j4eAH7NDrKNKiE7wqCexDUBIkuLyqz7eI yrZVrogk0OPEhhvN0qS48cP4vVYhtpLejQt7R/C7sJ2MOqipqA3rTzvwYmkKj/zs88gP 8N9tIsO1rd/LlzhlBjPKLgD7tp6EjkmmPvs5y3utcO6kHnhZWjMVV8mZlNlxxLVzSf6b RFImyc19kXveH9yjrWZHBDo7QiA+bsRz4TPtgCidjMbsPtz6lUm2ChMT69CHRX76TnaA RG5d5tLFdrT70faXbUeLwUxaOmbGAX6HPGh5TMlnrjTmS3mOC1bX4OiFUDFYseT/FdZ9 85HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=RpXfdPyEt56ILV8qLvVH71uwQhRr7wSOF66eUsxLyiQ=; b=Kl4Nmsy8pU/F0qMLpJCMaHSDZM5XuCcn7uVVID05ywRrBFwpyRWYItsurmID3lNx0Q nrbQyuU3/nnmlLU427BRDkn3X8gvLlzGQZoCwfQwcZnmYhswpWPZvYhhu8trBiH1vdbs 4Mez/rtAkQ+FHUWl5IIQLFQhiSpJDh4eczBnravochGxcRo2tq9HYp4QOtQTuM3fhuXX +9LWjF+78J3XMv8ph5I6Jzu8K7Vd4koq4BrY3rgFQ83Svo/gf5tQW/jlVzteGEVAABAs ZdxV7qf3eTxnF/iLq5BULBLFiZVRlB8JRknmh3JfQd1KbkYLMs5R5HrU5reBp/j+iROs 5ShA== X-Gm-Message-State: APjAAAVXiz+5EUMNVVAP4LnjmfBF1ALMp7XMLzYhcnoaKKdnhikKFhRp qK2c3Mjs82qpznL7COQMR24hlgl4 X-Google-Smtp-Source: APXvYqzZn5UnFtXenOPgnGRWWb425FM3ihdqo49+5AFTLUH3rHcCWhU574VEfvRW15WLLgaYWict/w== X-Received: by 2002:ae9:c218:: with SMTP id j24mr7940230qkg.60.1572215481900; Sun, 27 Oct 2019 15:31:21 -0700 (PDT) Original-Received: from [192.168.1.202] (pool-108-20-30-136.bstnma.fios.verizon.net. [108.20.30.136]) by smtp.googlemail.com with ESMTPSA id 92sm4544848qte.30.2019.10.27.15.31.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Oct 2019 15:31:20 -0700 (PDT) In-Reply-To: Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::730 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:241533 Archived-At: This is a multi-part message in MIME format. --------------190751B7A9EA01DEA71A44EE Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 10/23/19 4:18 PM, Stefan Monnier wrote: >> As a followup, I started using the shorter version of your patch, and found >> there are additional errors thrown from >> semantic-analyze-possible-completions-default (what will be a method in >> your patch).  I had to eliminate those errors to fully clean up the original >> problem that started this thread. > [ Sorry for taking so long to get back to it. ] > > After fighting for a while with your patch (it was full of NBSP chars > and wrapped lines) and then looking at it some more, I decided to > install the patch below instead which replaces the `catch` with > a `with-demoted-errors` (and places it in the caller instead). > Maybe those errors should indeed all be replaced by silently returning > nil, but the code currently goes through the trouble of building > more precise error messages, so I felt like maybe we should preserve > that info. Hi Stefan, I pulled down the latest, and ran against a more extensive test suite I'm working on.  I found that the new version is always pushing down the optional 'flags input to overrides, which makes sense.  Several override methods don't accommodate this.  The attached patch adds that optional 'flags' input to fix the error and allow the make, texi, and grammar modes run their specialization. > Ah, right. I too have debug-on-error non-nil of course. > The `error`s should be turned into `user-error`s to avoid this problem. > Tho of course, if the corresponding messages are not useful, returning > nil is a better choice, indeed. user-error sounds like the shortest path here.  The original purpose of the error was to provide a fine-grained reason for why something may have failed to complete.  I think most completion engines don't care about that. Thanks Eric --------------190751B7A9EA01DEA71A44EE Content-Type: text/x-patch; name="optflags.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="optflags.patch" diff --git a/lisp/cedet/semantic/bovine/make.el b/lisp/cedet/semantic/bovine/make.el index 3676c6972f..01a15b8232 100644 --- a/lisp/cedet/semantic/bovine/make.el +++ b/lisp/cedet/semantic/bovine/make.el @@ -175,7 +175,7 @@ semantic-format-tag-uml-prototype (semantic-format-tag-prototype tag parent color)) (define-mode-local-override semantic-analyze-possible-completions - makefile-mode (context) + makefile-mode (context &rest flags) "Return a list of possible completions in a Makefile. Uses default implementation, and also gets a list of filenames." (require 'semantic/analyze/complete) diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el index 813580ba6c..e1337b3eb9 100644 --- a/lisp/cedet/semantic/grammar.el +++ b/lisp/cedet/semantic/grammar.el @@ -1915,7 +1915,7 @@ semantic-analyze-current-context context-return))) (define-mode-local-override semantic-analyze-possible-completions - semantic-grammar-mode (context) + semantic-grammar-mode (context &rest flags) "Return a list of possible completions based on CONTEXT." (require 'semantic/analyze/complete) (if (semantic-grammar-in-lisp-p) diff --git a/lisp/cedet/semantic/texi.el b/lisp/cedet/semantic/texi.el index 73f0e734f3..0fdc9ee8bc 100644 --- a/lisp/cedet/semantic/texi.el +++ b/lisp/cedet/semantic/texi.el @@ -413,7 +413,7 @@ semantic-texi-command-completion-list "List of commands that we might bother completing.") (define-mode-local-override semantic-analyze-possible-completions - texinfo-mode (context) + texinfo-mode (context &rest flags) "List smart completions at point. Since texinfo is not a programming language the default version is not useful. Instead, look at the current symbol. If it is a command --------------190751B7A9EA01DEA71A44EE--