From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: enabling company-capf support in cfengine.el Date: Sun, 19 Jan 2014 18:44:21 +0200 Message-ID: <52DC00E5.3020803@yandex.ru> References: <87fvqtg02v.fsf@flea.lifelogs.com> <87eh58j0x3.fsf@flea.lifelogs.com> <878uvg4ul2.fsf@yandex.ru> <87y53ghe94.fsf@flea.lifelogs.com> <87vbyk3497.fsf@yandex.ru> <87haa4gw69.fsf@flea.lifelogs.com> <87txe4usm1.fsf@yandex.ru> <87zjnvg2t2.fsf@flea.lifelogs.com> <87txe364q0.fsf@yandex.ru> <87r497fu0h.fsf@flea.lifelogs.com> <87haa1litl.fsf@yandex.ru> <87y53czx7e.fsf@yandex.ru> <87bo08bivm.fsf_-_@flea.lifelogs.com> <87sitkzahs.fsf@yandex.ru> <52D7DAAB.2070709@yandex.ru> <52D81960.2080408@yandex.ru> <52DA8C17.4080707@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1390149912 24391 80.91.229.3 (19 Jan 2014 16:45:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 19 Jan 2014 16:45:12 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 19 17:45:19 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W4vUr-0004O1-LJ for ged-emacs-devel@m.gmane.org; Sun, 19 Jan 2014 17:45:17 +0100 Original-Received: from localhost ([::1]:46887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4vUr-0008F4-9o for ged-emacs-devel@m.gmane.org; Sun, 19 Jan 2014 11:45:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4vUi-0008DM-FW for emacs-devel@gnu.org; Sun, 19 Jan 2014 11:45:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W4vUc-0000Xp-JG for emacs-devel@gnu.org; Sun, 19 Jan 2014 11:45:08 -0500 Original-Received: from mail-ea0-f169.google.com ([209.85.215.169]:58444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4vUc-0000Wq-AE for emacs-devel@gnu.org; Sun, 19 Jan 2014 11:45:02 -0500 Original-Received: by mail-ea0-f169.google.com with SMTP id l9so2306014eaj.14 for ; Sun, 19 Jan 2014 08:44:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=o46Ln15/nHDLi7rVRqWBfh2vWawu3jOS/7q2SAwS3ZM=; b=RFua9nHwtT/36mawVm7iA2UAWYcNCq6S3UoMioc70h6OR3FP+vUSAryGxdrVyPTzvs j7I6hRApBYjAipTM8ma4I9R+zbjvrJh6wArrr6C/TzqTVgiwLNpFlXnUpmT/iN6aU6Og eLCSAW6/0ZeyUjFgPpta81RYdCxbTu1Sr2uCgaZJD8ZJE2lDRqD4Ct8oN5vjE2SsjJdQ FYNH/hMGsY1PQy1Fhday6aURaXjHXf8bSRrxYCxx9I7wXyNybUM6GEVbspNxLIU8w5km XJYAOiECrbCD+3wAVBvcOyRXbr+oPcKu7WSDkVzvLPh7ckiy6bb6ilUvm7OX+NDZ0R5w L1NA== X-Received: by 10.14.98.129 with SMTP id v1mr13267261eef.5.1390149866456; Sun, 19 Jan 2014 08:44:26 -0800 (PST) Original-Received: from [192.168.10.2] ([93.109.205.233]) by mx.google.com with ESMTPSA id w4sm45024070eef.20.2014.01.19.08.44.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 19 Jan 2014 08:44:25 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.215.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:168747 Archived-At: On 19.01.2014 04:37, Stefan Monnier wrote: > Could you make a bug report listing these (3 so far) problematic > functions, and explaining (as much as you can remember) what kind of > problem they cause? Done: http://debbugs.gnu.org/16496 > Ah, I see in the rest of your answer than this is all about "not > waiting". So, yes, the name should rather be :company-immediate or > something like that. It could also be "integer or t". And indeed, the > integer case is probably not needed. I'll have to think about the name more. Maybe Completion-UI gives some inspiration. >>> That's easy to solve: turn company-clang into its CAPF equivalent, then >>> place it within completion-at-point-functions after the Semantic one. >> Which body of code would contain that clang-completion-function, and perform >> the adding? > > How 'bout company-clang.el at first? > Could later be renamed to capf-clang.el, or cc-clang.el, or ... ? Sometime ago I've been told that RMS dislikes Clang strongly enough to oppose inclusion of any code using it in Emacs. Unless it has changed (or is no longer a major factor), separating the code from Company won't be particularly valuable. Ours isn't a very sophisticated integration anyway, there are other packages doing more, such as spinning up a persistent server to eliminate the latency of launching new process and scanning all project files anew each time. Alas, they're all using auto-complete ATM. >> forcing clang-completion-function to include a major-mode check >> (hitherto unseen behavior in CAPF functions, AFAIK), > > Don't know if it's already seen or not, but I don't see why it'd be > a problem. Yeah, OK. >> Anyway, as I see it, none of the options would provide a smooth transition >> from company-clang being included in company-backends. The users will have >> to install a package, enable a minor mode, or do something equivalent. > > I really don't see why it's hard: > - change company-clang.el so that it supports the "CAPF protocol" rather > than the "company-backend protocol". > - actually make it support both protocols (with the help of > company-capf to translate from the CAPF protocol to the other). This is doable, yes. > - in company.el (add-hook 'completion-at-point-function 'company-capf-clang) > and add company-clang to company-backends if Emacs is too old to use > company-capf. Would it be at the top-level? I.e. whenever you have company.el loaded, the global value of completion-at-point-functions will include company-capf-clag. Sounds invasive. Doing it in global-company-mode is not an option, I believe (define-globalized-minor-mode has no BODY argument), and even if it were, the users don't have to call this function, they can use company-mode directly. If we're doing it inside company-mode function body, we'll have to change the local value instead. Two last options would look weird either way: why would company-mode function concern itself with the value of completion-at-point-functions, and Clang specifically? That's why I suggested another minor mode. >> Guess a simpler solution would be to keep company-clang as-is, but move it >> behind company-capf. > > But moving it to CAPF means that it becomes useful/usable not only for > Company for also for good ol' competion-at-point. Would a Company user benefit from this, really? I'd like to hear from one person that would first. As long as (add-hook 'completion-at-point-function 'company-capf-clang) is only done when company-mode is enabled, there's really not much benefit.