[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Short to long form expansion?
From: |
Kevin Rodgers |
Subject: |
Re: Short to long form expansion? |
Date: |
Thu, 23 Feb 2006 15:07:38 -0700 |
User-agent: |
Mozilla Thunderbird 0.9 (X11/20041105) |
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 <TAB>, <SPC>, <RET>, and `?'. The usual
| completion commands are available on `M-<TAB>', `M-<SPC>', `M-<RET>'
| and `M-?'.
`----
--
Kevin Rodgers