RE: Emacs skeletons

Discussion in 'Python' started by George Flaherty, Jul 26, 2005.

  1. 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= [mailto:python-list-bounces+george.flaherty=] On Behalf Of Michael Hoffman
    Sent: Tuesday, July 26, 2005 1:36 PM
    To:
    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
     
    George Flaherty, Jul 26, 2005
    #1
    1. Advertising

  2. 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
     
    Michael Hoffman, Jul 26, 2005
    #2
    1. Advertising

  3. George Flaherty

    Benji York Guest

    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
     
    Benji York, Jul 26, 2005
    #3
  4. > 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
     
    Caleb Hattingh, Jul 26, 2005
    #4
  5. George Flaherty

    Jorgen Grahn Guest

    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!
     
    Jorgen Grahn, Aug 4, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arvind Kumar

    E language mode for Emacs

    Arvind Kumar, Aug 20, 2003, in forum: VHDL
    Replies:
    2
    Views:
    1,775
    Stephen J. Turnbull
    Aug 20, 2003
  2. Rick Jackson

    emacs vhdl-mode

    Rick Jackson, Nov 25, 2005, in forum: VHDL
    Replies:
    10
    Views:
    2,989
    Reto Zimmermann
    Nov 30, 2005
  3. Michael Hoffman

    Emacs skeletons

    Michael Hoffman, Jul 26, 2005, in forum: Python
    Replies:
    3
    Views:
    397
    Florian Diesch
    Jul 27, 2005
  4. Calvin Spealman

    Stand-Alone Python Executable Skeletons

    Calvin Spealman, Feb 15, 2012, in forum: Python
    Replies:
    0
    Views:
    216
    Calvin Spealman
    Feb 15, 2012
  5. Adam Funk
    Replies:
    4
    Views:
    239
    Adam Funk
    Jan 29, 2007
Loading...

Share This Page