Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: Emacs skeletons

Reply
Thread Tools

RE: Emacs skeletons

 
 
George Flaherty
Guest
Posts: n/a
 
      07-26-2005
Michael,

Since you are on this topic, do you (or anyone else) have any type of "code-completion" mode for python in emacs?

Thanks
-george

-----Original Message-----
From: python-list-bounces+george.flaherty= [mailtoython-list-bounces+george.flaherty=] On Behalf Of Michael Hoffman
Sent: Tuesday, July 26, 2005 1:36 PM
To: python-
Subject: Re: Emacs skeletons

wrote:
> Michael> Does anyone have any Emacs skeletons they find useful for
> Michael> Python?
>
> What's an "Emacs skeleton"?


Somewhat of an elaborate mini-language for inserting boilerplate.

http://www.emacswiki.org/cgi-bin/emacs-en/SkeletonMode
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
 
Reply With Quote
 
 
 
 
Michael Hoffman
Guest
Posts: n/a
 
      07-26-2005
George Flaherty wrote:

> Since you are on this topic, do you (or anyone else) have any
> type of "code-completion" mode for python in emacs?


I have this in my .emacs:

(global-set-key "\M-/" 'hippie-expand)

This means that M-/ will do dumb code completion based on stuff that is
already in an open buffer, which can be helpful, and is certainly better
than nothing. Try it; you'll probably like it.

I also have this in .emacs:

(setq abbrev-file-name "~/etc/emacs/abbrev_defs")
(quietly-read-abbrev-file)

and this in ~/etc/emacs/abbrev_defs:

(define-abbrev-table 'python-mode-abbrev-table '(
("pdb" "import pdb; pdb.set_trace()" nil 0)
))

Together, those mean that if I type pdb, M-/, then I get
import pdb; pdb.set_trace(), which can save me a lot of time while
debugging. To be honest, I usually use pdb from the commandline instead
these days, with 'alias pdb="python -m pdb"' in my .bashrc.
--
Michael Hoffman
 
Reply With Quote
 
 
 
 
Benji York
Guest
Posts: n/a
 
      07-26-2005
Michael Hoffman wrote:
> I have this in my .emacs:
>
> (global-set-key "\M-/" 'hippie-expand)
>
> This means that M-/ will do dumb code completion based on stuff that is
> already in an open buffer


Even though I don't know how to configure Emacs to do it (I'm a
degenerate Vim user), I've found ctags completion very handy. I
currently have my (inferior) editor set up to scan the current buffer,
other buffers, then tags files when doing completion. I'm sure (the
superior) Emacs can do something similar.
--
self-editor-abasing-ly y'rs,
Benji York

 
Reply With Quote
 
Caleb Hattingh
Guest
Posts: n/a
 
      07-26-2005
> Since you are on this topic, do you (or anyone else) have any type of
> "code-completion" mode for python in emacs?
>
> Thanks
> -george


For what its worth, Vim has a generic type of "code-completion" that uses
the file being edited to check for completion options within a word. It's
not true completion (using valid completions for class hierarchies, a la
Delphi/VB), but I get a lot of mileage out of it with my python coding.

I fully expect Emacs has something similar, though I can't tell you how (I
hardly know emacs at all).

rgds
Caleb
 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a
 
      08-04-2005
On Tue, 26 Jul 2005 22:08:25 +0200, Caleb Hattingh <> wrote:
>> Since you are on this topic, do you (or anyone else) have any type of
>> "code-completion" mode for python in emacs?
>>
>> Thanks
>> -george

>
> For what its worth, Vim has a generic type of "code-completion" that uses
> the file being edited to check for completion options within a word. It's
> not true completion (using valid completions for class hierarchies, a la
> Delphi/VB), but I get a lot of mileage out of it with my python coding.
>
> I fully expect Emacs has something similar, though I can't tell you how (I
> hardly know emacs at all).


It's dabbrev-expand, bound to C-TAB by default. I wouldn't dream of typing
any kind of text (source code or otherwise) into an editor without this
feature. It saves a lot of time, typos and wrist pain.

So, it's not surprising that both vim and emacs has it.

/Jorgen

--
// Jorgen Grahn <jgrahn@ Ph'nglui mglw'nafh Cthulhu
\X/ algonet.se> R'lyeh wgah'nagl fhtagn!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stand-Alone Python Executable Skeletons Calvin Spealman Python 0 02-15-2012 10:43 PM
Re: You have skeletons in your closet Dan C Computer Support 2 10-11-2010 03:18 AM
Re: You have skeletons in your closet Tocino8r Computer Support 0 10-11-2010 01:45 AM
Dancing Skeletons marich2@gmail.com Computer Information 3 09-25-2005 05:28 PM
Emacs skeletons Michael Hoffman Python 3 07-27-2005 05:47 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57