From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lluis Newsgroups: gmane.emacs.devel Subject: Re: Completions in Semantic Date: Thu, 29 Oct 2009 15:38:11 +0100 Message-ID: <20091029143811.GB25239@ginnungagap.pc.ac.upc.edu> References: <1255990628.6961.1084.camel@projectile.siege-engine.com> <1256070021.6961.1107.camel@projectile.siege-engine.com> <20091021105840.GD2964@ginnungagap.pc.ac.upc.edu> <20091027212118.GA25239@ginnungagap.pc.ac.upc.edu> <1256696707.5333.214.camel@projectile.siege-engine.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1256827301 18028 80.91.229.12 (29 Oct 2009 14:41:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 29 Oct 2009 14:41:41 +0000 (UTC) Cc: emacs-devel@gnu.org, eric@siege-engine.com To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 29 15:41:34 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N3WBN-0008AV-8I for ged-emacs-devel@m.gmane.org; Thu, 29 Oct 2009 15:41:31 +0100 Original-Received: from localhost ([127.0.0.1]:36981 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N3WBB-0007xY-Cs for ged-emacs-devel@m.gmane.org; Thu, 29 Oct 2009 10:40:45 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N3W9E-0007IP-WB for emacs-devel@gnu.org; Thu, 29 Oct 2009 10:38:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N3W99-0007Fa-LY for emacs-devel@gnu.org; Thu, 29 Oct 2009 10:38:43 -0400 Original-Received: from [199.232.76.173] (port=57694 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N3W99-0007FS-BG for emacs-devel@gnu.org; Thu, 29 Oct 2009 10:38:39 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]:54541) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1N3W97-0006ns-VL for emacs-devel@gnu.org; Thu, 29 Oct 2009 10:38:39 -0400 Original-Received: (qmail invoked by alias); 29 Oct 2009 14:38:25 -0000 Original-Received: from dync-30-245.ac.upc.es (EHLO localhost) [147.83.30.245] by mail.gmx.net (mp027) with SMTP; 29 Oct 2009 15:38:25 +0100 X-Authenticated: #12333383 X-Provags-ID: V01U2FsdGVkX18arHZf9MoaLNhWyhIvDFww/IdGsTuWq9xntIjz+Z 0irU9S1WnzXh29 Content-Disposition: inline In-Reply-To: User-Agent: Mutt 1.5.20 (2009-06-14) X-Editor: VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Jul 30 2009 16:00:28) X-Operating-System: Debian GNU/Linux Kernel 2.6.31-trunk-amd64 (x86_64) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.63 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:116450 Archived-At: El Tue, Oct 27, 2009 at 11:23:44PM -0400, Stefan Monnier ens deleità amb les següents paraules: > > Are you looking for examples of hooks that would be needed, or examples > > of behaviors that need hooks to be designed? > > Examples of hooks that could make such things possible. Ok, so here's a high-level shot on a possible completion infrastructure. Note that much of what I describe is oriented towards programming. * Completion candidates ** Information Contains whatever information the system could gather about the symbol. When programming with semantic activated, this could be the semantic tag structure. ** Actions Various actions that can be applied on a candidate. This is basically the interface to view the candidate information. *** get-* Recollect the interesting bits from information, so that the user can easily access it independently of the "information backend" (e.g., semantic tags). **** get-name Candidate name **** get-location Where the candidate has been defined **** get-return Return type of the candidate (only meaningful on programming candidates) **** get-arguments Arguments of the candidate (idem) **** get-short-help Short version of candidate help **** get-long-help Long version of candidate help *** show Shows an arbitrary composition of get-*. E.g., (concat (get-signature candidate) "\n" (get-long-help candidate)) Where that sould be shown, must be user selectable (see below *** insert-* Insert "something" at point (cannot think of use-cases where insertion takes place in other places other than point). **** insert-name Insert the good old completion candidate name. **** insert-template Insert a "template" based on the candidate information. E.g., open(<>, <>) The <<...>> parts are yasnippet-like placeholders for the user to fill. This could be complicated even more, like: * insert a placeholder for the result if compeltion is at first non-blank column. * insert ";" at end if completion is at first non-blank column. * show parameter/return help (e.g., when help follows doxygen style) when moving between placeholders. * UI ** Types The completion-ui package has implementations for some (if not all) of them. The UI *** buffer Is the current *Completions* buffer. *** minibuffer The completion system used by, e.g., predictive-mode. *** overlay That's the one I prefer, see company-mode as an example. *** others There are many others, like menus, etc. ** Operations All action triggered by operations should be possibly be configured on a per-information-backend basis (e.g., completions from yasnippet do not have any meaningful `get-return'). *** start Start the completion process. E.g.: (show current-ui get-return get-name get-arguments) would show the full signature of a function. *** focus Let's the user "highlight" an entry of the possible candidates. It's the good old next/prev in an overlay UI. Focusing an element can trigger other actions. This will mainly be (show ...) The could be any of minibuffer, another buffer, tooltip, etc. *** select Called when the user selects a candidate. This can trigger insert and/or show actions. In fact, triggering only show actions could be used to reuse this very same infrastructure for other purposes other than completion, like a user-configurable tool to show help on symbol at point. *** completion-map Extra actions the user can trigger through keyboard when the completion UI is "active". E.g., i can focus to an interesting symbol and trigger (show some-buffer get-long-help) This probably means a whole lot of coding and I'm neither knowledgeable of current state of functionalities nor proficient in elisp. Just a thought, Lluis -- "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth