The Modernization of Emacs
Lew
lew at lewscanon.nospam
Tue Jun 19 16:20:36 EDT 2007
Ed wrote:
> On 19 Juni, 07:14, Harry George
>> I've used emacs since the 1980's.
> ...
>> --
>> Harry George
>> PLM Engineering Architecture
>
> I've asked this question on an emacs forum and got no response, so I
> presume the answer is no, but I see, Harry, that you're a veteran, so
> maybe you've seen things few others have.
>
> Have you ever seen an, "Extract method," function for emacs? Whereby
> you highlight some lines of code, press a key, and the code is whisked
> into its own method, with the appropriate method invocation left in
> its place. If you could post a link, that'd be just champion.
I googled about a bit and came up with
<http://bicyclerepair.sourceforge.net/>
linked from
<http://en.wikipedia.org/wiki/Refactoring>
I also looked at emacs's own "Info" pages and found this tidbit:
> `M-x c-beginning-of-defun'
> `M-x c-end-of-defun'
> Move point to the beginning or end of the current function or
> top-level definition. These are found by searching for the least
> enclosing braces. (By contrast, `beginning-of-defun' and
> `end-of-defun' search for braces in column zero.) If you are
> editing code where the opening brace of a function isn't placed in
> column zero, you may wish to bind `C-M-a' and `C-M-e' to these
> commands. *Note Moving by Defuns::.
>
> `M-a'
> Move point to the beginning of the innermost C statement
> (`c-beginning-of-statement'). If point is already at the beginning
> of a statement, move to the beginning of the preceding statement.
> With prefix argument N, move back N - 1 statements.
>
> In comments or in strings which span more than one line, this
> command moves by sentences instead of statements.
>
> `M-e'
> Move point to the end of the innermost C statement or sentence;
> like `M-a' except that it moves in the other direction
> (`c-end-of-statement').
You could, and I believe others have, create a macro to encapsulate these
actions with setting the mark and copying the region.
Here is a very promising-looking one that I found for C(**) and Java:
<http://xref-tech.com/speller/main.html>
GWMF.
--
Lew
More information about the Python-list
mailing list