all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Automatic Python self completion
@ 2008-04-10 22:06 Jake Eakle
  2008-04-11 13:14 ` Nikolaj Schumacher
  0 siblings, 1 reply; 3+ messages in thread
From: Jake Eakle @ 2008-04-10 22:06 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 314 bytes --]

Hello,
I'm relatively new to emacs lisping, and I'm wondering how to go about
adding a but of functionality to python-mode. I want emacs to, whenever I
type '[tab]def <function name>(', automatically append the text 'self,
'.Thanks!

Jake Eakle

-- 
A warb degombs the brangy. Your gitch zanks and leils the warb.

[-- Attachment #2: Type: text/html, Size: 376 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Automatic Python self completion
       [not found] <mailman.10249.1207865543.18990.help-gnu-emacs@gnu.org>
@ 2008-04-10 23:17 ` weber
  0 siblings, 0 replies; 3+ messages in thread
From: weber @ 2008-04-10 23:17 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 10, 7:06 pm, "Jake Eakle" <jsea...@gmail.com> wrote:
> Hello,
> I'm relatively new to emacs lisping, and I'm wondering how to go about
> adding a but of functionality to python-mode. I want emacs to, whenever I
> type '[tab]def <function name>(', automatically append the text 'self,
> '.Thanks!
>
> Jake Eakle
>
> --
> A warb degombs the brangy. Your gitch zanks and leils the warb.

Instead of giving you a specific solution, I guess you'd benefit more
from installing yasnippet so you can define your own snippets that
expand with tab or whatever.
There are also several snippets for python included.

http://code.google.com/p/yasnippet/

HTH,
Hugo


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Automatic Python self completion
  2008-04-10 22:06 Jake Eakle
@ 2008-04-11 13:14 ` Nikolaj Schumacher
  0 siblings, 0 replies; 3+ messages in thread
From: Nikolaj Schumacher @ 2008-04-11 13:14 UTC (permalink / raw)
  To: jseakle; +Cc: help-gnu-emacs

"Jake Eakle" <jseakle@gmail.com> wrote:

> I'm relatively new to emacs lisping, and I'm wondering how to go about
> adding a but of functionality to python-mode. I want emacs to, whenever I
> type '[tab]def <function name>(', automatically append the text 'self,
> '.Thanks!
>
> Jake Eakle

Here are the steps, you'll need to do:

- Define an interactive function with `defun'.
- Test for surrounding text with `looking-at'.
- Insert text with `insert'.
- Optionally do `indent-according-to-mode' otherwise.
- Bind function to tab.

Good luck.


regards,
Nikolaj Schumacher




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-04-11 13:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.10249.1207865543.18990.help-gnu-emacs@gnu.org>
2008-04-10 23:17 ` Automatic Python self completion weber
2008-04-10 22:06 Jake Eakle
2008-04-11 13:14 ` Nikolaj Schumacher

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.