From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: Short to long form expansion? Date: Thu, 23 Feb 2006 15:07:38 -0700 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1140860863 20568 80.91.229.2 (25 Feb 2006 09:47:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 25 Feb 2006 09:47:43 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Feb 25 10:47:43 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FCw1X-0008Tf-9m for geh-help-gnu-emacs@m.gmane.org; Sat, 25 Feb 2006 10:47:35 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FCvnP-0003sf-Dh for geh-help-gnu-emacs@m.gmane.org; Sat, 25 Feb 2006 04:32:59 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FCslJ-00060V-R3 for help-gnu-emacs@gnu.org; Sat, 25 Feb 2006 01:18:39 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FCQ5B-0004SG-Tn for help-gnu-emacs@gnu.org; Thu, 23 Feb 2006 18:41:15 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FCOd9-0000mg-HG for help-gnu-emacs@gnu.org; Thu, 23 Feb 2006 17:08:11 -0500 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FCOjw-0000pA-MF for help-gnu-emacs@gnu.org; Thu, 23 Feb 2006 17:15:13 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FCOcy-0000bt-DU for help-gnu-emacs@gnu.org; Thu, 23 Feb 2006 23:08:00 +0100 Original-Received: from 207.167.42.60 ([207.167.42.60]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Feb 2006 23:08:00 +0100 Original-Received: from ihs_4664 by 207.167.42.60 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Feb 2006 23:08:00 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 73 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 207.167.42.60 User-Agent: Mozilla Thunderbird 0.9 (X11/20041105) X-Accept-Language: en-us, en In-Reply-To: X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:33408 Archived-At: Christopher Campbell wrote: > Is there a mode that allows completion of words by taking a short form, > and comparing it with text in the buffer to deduce a longer form? e.g. > > in a buffer with > > complete_text > some-variable-name > > c_t M-RET -> complete_text > s-v-n M-RET -> some-variable-name > > Anything like that? I use pabbrev-mode which helps alot with code > editing, but this little extra would be icing on the cake. I don't know -- what is pabbrev-mode? It sounds to me like what you want is a combination of Dynamic Abbrev mode and Partial Completion mode. What happens if you turn on both? ,---- | The abbrev facility described above operates automatically as you | insert text, but all abbrevs must be defined explicitly. By contrast, | "dynamic abbrevs" allow the meanings of abbrevs to be determined | automatically from the contents of the buffer, but dynamic abbrev | expansion happens only when you request it explicitly. | | `M-/' | Expand the word in the buffer before point as a "dynamic abbrev", | by searching in the buffer for words starting with that | abbreviation (`dabbrev-expand'). | | `C-M-/' | Complete the word before point as a dynamic abbrev | (`dabbrev-completion'). | | For example, if the buffer contains `does this follow ' and you type | `f o M-/', the effect is to insert `follow' because that is the last | word in the buffer that starts with `fo'. A numeric argument to `M-/' | says to take the second, third, etc. distinct expansion found looking | backward from point. Repeating `M-/' searches for an alternative | expansion by looking farther back. After scanning all the text before | point, it searches the text after point. The variable `dabbrev-limit', | if non-`nil', specifies how far in the buffer to search for an | expansion. | ... | The command `C-M-/' (`dabbrev-completion') performs completion of a | dynamic abbreviation. Instead of trying the possible expansions one by | one, it finds all of them, then inserts the text that they have in | common. If they have nothing in common, `C-M-/' displays a list of | completions, from which you can select a choice in the usual manner. | *Note Completion::. `---- ,---- | Partial Completion mode implements a more powerful kind of | completion that can complete multiple words in parallel. For example, | it can complete the command name abbreviation `p-b' into | `print-buffer', because no other command starts with two words whose | initials are `p' and `b'. | | Partial completion of directories in file names uses `*' to indicate | the places for completion; thus, `/u*/b*/f*' might complete to | `/usr/bin/foo'. | | To enable this mode, use the command `M-x partial-completion-mode', | or customize the option `partial-completion-mode'. This binds the | partial completion commands to , , , and `?'. The usual | completion commands are available on `M-', `M-', `M-' | and `M-?'. `---- -- Kevin Rodgers