From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) Newsgroups: gmane.emacs.devel Subject: Re: Emacs completion matches selection UI Date: Sat, 28 Dec 2013 15:59:19 +0000 Message-ID: <87r48xge5k.fsf@gmail.com> References: <87fvqtg02v.fsf@flea.lifelogs.com> <874n67n450.fsf@flea.lifelogs.com> <87eh5bkxca.fsf@flea.lifelogs.com> <87d2kuzzqj.fsf@uwakimon.sk.tsukuba.ac.jp> <87a9fylusq.fsf@flea.lifelogs.com> <878uvizrwz.fsf@uwakimon.sk.tsukuba.ac.jp> <8761qmkyn1.fsf@flea.lifelogs.com> <87zjnyxdpb.fsf@uwakimon.sk.tsukuba.ac.jp> <87k3f2j7xv.fsf@flea.lifelogs.com> <2518D79A-B9E4-45DF-A403-8330145DFD17@gmail.com> <87eh58j0x3.fsf@flea.lifelogs.com> <87mwjvfrfy.fsf@flea.lifelogs.com> <877gawbhp0.fsf@flea.lifelogs.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1388247511 21322 80.91.229.3 (28 Dec 2013 16:18:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 28 Dec 2013 16:18:31 +0000 (UTC) Cc: Stefan Monnier , Emacs developers To: John Yates Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 28 17:18:37 2013 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 1VwwKC-0000ia-Kr for ged-emacs-devel@m.gmane.org; Sat, 28 Dec 2013 17:01:16 +0100 Original-Received: from localhost ([::1]:52584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwwKC-0005Go-2m for ged-emacs-devel@m.gmane.org; Sat, 28 Dec 2013 11:01:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwwK4-0005Gh-Ux for emacs-devel@gnu.org; Sat, 28 Dec 2013 11:01:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VwwK0-0007Mi-HI for emacs-devel@gnu.org; Sat, 28 Dec 2013 11:01:08 -0500 Original-Received: from mail-wg0-x236.google.com ([2a00:1450:400c:c00::236]:62496) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwwK0-0007Md-61 for emacs-devel@gnu.org; Sat, 28 Dec 2013 11:01:04 -0500 Original-Received: by mail-wg0-f54.google.com with SMTP id n12so8844651wgh.21 for ; Sat, 28 Dec 2013 08:01:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=ths0VuVFeiFAKjaUnuqo80ifoiNhJB4u0woJ3rynvZo=; b=wH3LXFbqK9ao1pBIUXzHeopYvMuvy8Mb10BsXWF3xBSWci2U1SOtvn3hOO4i3sSvU+ 50TcCVthsxIkDXGHSmNakmLowM1NTAGqw6b69kwczDsvrGLNIgbHXCJVC7wsSiE2r7hE FQgG6/u5UVbpSszdq14asdCiE63kbBlwjkRNP3Yl7E0qcPhtzwwewU0dDgZv6lUWDXVR jKtW4/69RB1tnqiCTu5dKoMyGlWWFuTLVa+l+4w5JDeSvl+ed4savgOlNoB0cUzuEs8L pYm8NdAdiThqeqLIR2jA5z7o3EfdG1KEtJ5L6/ziAslQVDowAmQtytRh7HKWYPbuQY5M c9Tg== X-Received: by 10.180.23.99 with SMTP id l3mr10047573wif.26.1388246463197; Sat, 28 Dec 2013 08:01:03 -0800 (PST) Original-Received: from kitaj.yourcompany.com (66.207.108.93.rev.vodafone.pt. [93.108.207.66]) by mx.google.com with ESMTPSA id v7sm38659901wix.5.2013.12.28.08.01.01 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 28 Dec 2013 08:01:02 -0800 (PST) In-Reply-To: (John Yates's message of "Mon, 23 Dec 2013 21:47:40 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::236 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:166952 Archived-At: John Yates writes: > Try a google search for "yasnippet autocomplete". Many folk seem to > want to use them together. Not sure why the attempt so often leads to > a plea for help. Many of the search results will land you in yasnippet's issue tracker, where I handled many such issues and admittedly never provided a bullet-proof solution. But I would say that 70% of the cases stem from a misunderstanding about yasnippet. It is a abbrev expansion mechanism and not a completion mechanism. The fact that the key that attempts expansion is bound to TAB is a detail. The fact that it sometimes prompts you when many expansions are possible from a single abbreviation, and that that minibuffer prompting *is* subject to usual emacs completion routines is also a different issue, IMO. So, those 70% are frequently caused by the fact that auto-complete itself comes with a "yasnippet source", i.e. a plugin to auto-complete that gathers possible snippets to expand at point and offers these expansions as completion "targets". In this (completely different) use case, auto-complete "drives" yasnippet (and yasnippet's TAB binding should be disabled by the user). This use case is frequently broken by reasons completely unrelated to this thread (i.e. API brea). Anyway, the other 30% are probably legitimate cases where the user that activated both yas-minor-mode and auto-complete-mode in a buffer probably wants something like the following to happen: 1. Press TAB 2. If theres an active snippet key preceding point, expand it and leave 3. Else attempt autocompletion at point, bring up a menu, whatever it does 4. Else do whatever TAB is bound to I wrote "probably" because I don't think I ever got a precise description that clarified the desired interaction. That is, maybe some users want 2 and 3 reversed. Now, I'm not familiar with auto-complete to say if 3. can ever "fail" and fall through to 4. To do that, it would probably need a fallback mechanism similar to yasnippet's. IIUC, it is this "attempt-command-but-maybe-fallback" mechanism that I believe could be considered for inclusion in emacs, provided it's designed sensibly, of course. > Perhaps the wrinkle is yasnippet's completion model. Based on context > preceding point yasnippet decides either that a match exists (leading > to template expansion and return) or that no match exists causing > responsibility to be passed to a fallback completion handler. This is very close to the truth, but instead of "fallback completion handler" yasnippet interactively calls whatever TAB was bound to before, which normally is some indentation command, but can also be org-cycle as in org-mode. Not sure what it does if you enable yas-minor-mode in a completion-aware minibuffer, for instance. C-h k TAB in any buffer where yas-minor-mode is enabled should always give you that info, btw. (I say "should" because it appears to currently be buggy and always report "forward-button" as the fallback command). Finally, note that autopair.el does something similar, but always runs the fallback binding and installs its bindings in `emulation-mode-map-alist' something that I found that is usually "on top of everything else". Yasnippet installs its TAB binding in a conventional minor mode map, where IIRC it will conflict with other TAB bindings in other minor mode maps. This used to be a common source of problems, but can be averted with hacks like the ones described in yasnippet's faq (though these might be out-of-date). Hope I have helped and not unhelped with this input, Jo=C3=A3o