From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Robert Thorpe Newsgroups: gmane.emacs.help Subject: Re: Abbrevs for the most frequent elisp symbols Date: Thu, 01 Jan 2015 00:16:38 +0000 Message-ID: <87d26zqrrt.fsf@robertthorpeconsulting.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1420071424 23689 80.91.229.3 (1 Jan 2015 00:17:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 1 Jan 2015 00:17:04 +0000 (UTC) To: bruce.connor.am@gmail.com, adatgyujto@gmail.com, help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 01 01:16:58 2015 Return-path: Envelope-to: geh-help-gnu-emacs@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 1Y6TRg-0000RB-TX for geh-help-gnu-emacs@m.gmane.org; Thu, 01 Jan 2015 01:16:57 +0100 Original-Received: from localhost ([::1]:41691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6TRg-0006JF-4f for geh-help-gnu-emacs@m.gmane.org; Wed, 31 Dec 2014 19:16:56 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6TRV-0006J4-26 for help-gnu-emacs@gnu.org; Wed, 31 Dec 2014 19:16:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y6TRR-0000PU-QE for help-gnu-emacs@gnu.org; Wed, 31 Dec 2014 19:16:45 -0500 Original-Received: from outbound-smtp01.blacknight.com ([81.17.249.7]:38370) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6TRR-0000OU-HT for help-gnu-emacs@gnu.org; Wed, 31 Dec 2014 19:16:41 -0500 Original-Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp01.blacknight.com (Postfix) with ESMTPS id C9366C0080 for ; Thu, 1 Jan 2015 00:16:39 +0000 (UTC) Original-Received: (qmail 20491 invoked from network); 1 Jan 2015 00:16:39 -0000 Original-Received: from unknown (HELO RTLaptop) (rt@robertthorpeconsulting.com@[86.185.23.72]) by 81.17.254.9 with ESMTPSA (DHE-RSA-AES128-SHA encrypted, authenticated); 1 Jan 2015 00:16:39 -0000 In-Reply-To: (message from Artur Malabarba on Wed, 31 Dec 2014 19:46:49 -0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 81.17.249.7 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:101815 Archived-At: There are lots of types of completion in Emacs. It's interesting to think about them all together. For minibuffer selections there's Emacs' default completion with TAB. Then there are all the relations: Ido, Helm, Icomplete, Iswitchb and probably many more I don't know. Those use TAB or RET to complete or do it automatically. The completion candidates are generally automatically generated from available options. For normal buffers there's abbrev which works automatically as the user types. That's from a manually choosen set of candidates, unless the user generates one with elisp as the OP did. Most of the other systems use a keybinding. There's dynamic abbrevs (M-/) which use candidates generated from open buffers. There's dynamic-completion-mode (C-RET) which uses the history of the user's typing (thanks Drew). Then there's M-TAB (or M-C-i) which uses knowledge of the language; e.g. parsed data from Semantic, a tags table or, for text, a spelling database. Then there's Company. I've never used that, but I've been meaning to for ages. I understand it's a half-way-house, it puts completion candidates on screen but a key is required to choose one, like the minibuffer completion systems. It can use nearly anything to provide the completion. Company provides a particular "front-end" and many "back-ends". The other systems I mention are both front-end and back-end. Ideally, for completion in normal buffers, it would be possible to plug any back-end into Abbrev. So, abbrevs could be built from dabbrev's text from other buffers, Semantic's data from the parse-tree or something else. (I don't think the same would be useful for the other way around. It's not much of a problem having M-/, C-RET and M-TAB. They could be united with hippie-expand if anyone wanted to.) BR, Robert Thorpe Artur Malabarba writes: > company comes with a backend that matches the initials of defined symbols, > the only difference is that you have to type the hyphens, so a modification > of that backend would be a viable approach for this menu that's being > suggested. > That seems like a worthy addition to company-mode for me. > > Still, I think that should be something separate from this system that's > being discussed. When there are collisions, I prefer to use the most common > option than to pop-up a completions menu. That's how my setup works right > now, it's part of what makes it fast and it feels awesome. :-) > Besides, I feel Emacs has enough options when it comes to completions, and > I'd rather this not be Yet Another One. > > Maybe SPC could trigger the most common expansion (a la abbrev) and TAB > could trigger the completions menu (a la company). > > > 2014-12-31 7:50 GMT-02:00 Tom : > >> Stefan Monnier iro.umontreal.ca> writes: >> > >> > If you use the `initials' completion style, "wcb" will match >> > "with-current-buffer" (along with various others), so if we add a good >> > sorting based on known usage frequency (as suggested by the OP), the >> > cycling completion will behave very similarly to his abbrevs. >> >> I wonder if it is possible to combine abbrevs with completion. >> >> I feel the most convenient completion is abbrevs, because then you >> don't have to press anything to complete, it just happens. But >> if we use initials then there can be collisions. >> >> What if we could use initial-abbrevs to type lisp symbols, but when >> there is more possible completions for the abbrev (e.g. if there is an >> other completion for wcb than with-current-buffer) then at >> abbrev expansion it would pop up a completion menu like company, etc. >> so right below the line) with the possible completions sorted by >> frequency with the most frequent at the top. >> >> This would be the most convenient solution, because then you could >> just type initials and completions would pop up without pressing >> anything, or if there is no collision then it would expand >> immediately like any other abbrev. >> >> >>