From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jorgen Schaefer Newsgroups: gmane.emacs.devel Subject: Re: Is intellisense features integration in Emacs technically possible? Date: Wed, 22 Jan 2014 19:49:30 +0100 Message-ID: <20140122194930.49ba60be@forcix.kollektiv-hamburg.de> References: <1390269670.2888.14.camel@localhost.localdomain> <83zjmpf80o.fsf@gnu.org> <877g9shqms.fsf@newcastle.ac.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1390416588 11264 80.91.229.3 (22 Jan 2014 18:49:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Jan 2014 18:49:48 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 22 19:49:55 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 1W62s5-00042R-JM for ged-emacs-devel@m.gmane.org; Wed, 22 Jan 2014 19:49:53 +0100 Original-Received: from localhost ([::1]:37049 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W62s5-0007H7-9I for ged-emacs-devel@m.gmane.org; Wed, 22 Jan 2014 13:49:53 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35376) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W62rx-0007GB-DO for emacs-devel@gnu.org; Wed, 22 Jan 2014 13:49:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W62rr-00045J-Rt for emacs-devel@gnu.org; Wed, 22 Jan 2014 13:49:45 -0500 Original-Received: from loki.jorgenschaefer.de ([87.230.15.51]:45752) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W62rr-000454-H6 for emacs-devel@gnu.org; Wed, 22 Jan 2014 13:49:39 -0500 Original-Received: by loki.jorgenschaefer.de (Postfix, from userid 998) id 8E60F201369; Wed, 22 Jan 2014 19:49:37 +0100 (CET) Original-Received: from forcix.kollektiv-hamburg.de (x2f0597c.dyn.telefonica.de [2.240.89.124]) by loki.jorgenschaefer.de (Postfix) with ESMTPSA id ACCA0201367 for ; Wed, 22 Jan 2014 19:49:33 +0100 (CET) In-Reply-To: <877g9shqms.fsf@newcastle.ac.uk> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.22; i486-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 87.230.15.51 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:168914 Archived-At: On Wed, 22 Jan 2014 17:29:15 +0000 phillip.lord@newcastle.ac.uk (Phillip Lord) wrote: > Eli Zaretskii writes: > >> A better way is to build on the hard work of other and interface > >> emacs with an external tool. > > > > Personally, I think implementing such features via external programs > > is a terrible design. It will never be smooth and responsive > > enough, and on top of that you'd need to track development of those > > other tools. And what if they become abandoned some day? > > I think that it depends on the language. Introspecting over, for > example, Java would require an awful of elisp, which would be > difficult to write. Getting Java to do this work is quite a lot less > effort. Hence, the JDEEs use of Java for this (via bsh). Likewise, > Clojure and Scala both of which use their own language to do much of > the work. Or for that matter, common lisp with slime/swank. Or even, > for that matter, English with aspell. I didn't have a problem with > responsiveness with any of these. Yeah, roughly that. "External program" instead of "integrated" means very little these days. I wrote one of the various Emacs modes that provide semantic completion for Python, interfacing with two different Python libraries which do the actual semantic analysis. In this case, Emacs communicates with the external program via a specified protocol, which, from the Emacs side, looks exactly like calling some kind of Emacs Lisp function. (Abstraction is great.) The only problem I have is that keeping state shared between the processes is difficult. Right now, what I'm doing is to re-send the current buffer to the other process, including the position of point, for every completion request. This is highly inefficient, and makes it difficult to create a tighter coupling for better completion or analysis from the Emacs side. To improve on that, there would need to be a way of sharing the current contents of a buffer with a subprocess without writing it to a file. But this is an optimization problem, not a capability problem. The current approach I use is "fast enough", so fast actually that I haven't even implemented a speed-up idea of using temporary files instead of sending the buffer contents as encoded strings to the other process. Considering there already are so many different modes that provide semantic completion for Emacs, the main obstacle for IntelliSense (as far as I understand it) *on the Emacs side* is actually not that big. It's mainly a common interface for such external programs so that we can add more languages more easily. The current effort of unifying the completion interface as well as supporting company mode as a front-end is going a great deal forward in that. The biggest problems are outside of Emacs. Good libraries that provide intelligent completion and code introspection are rare. I know of three for Python, one of which is not maintained anymore, one was mostly-dead for a few years, and all of which have different deficiencies. They also have trouble keeping up with the development of the language. I expect similar problems for other languages. Reimplementing these libraries in Emacs Lisp will just cause more problems keeping them up-to-date. Though if someone wants to do that, do not let that stop you. It's most certainly not "impossible". Regards, Jorgen