Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=5414816
By: tim042849
I'm using pydev with eclipse and aptana also installed on Ubuntu 7.10
I currently use emacs as my programming editor but pydev is in my future.
I am accustomed using elisp to write editing functions and then binding
that function to a key combination.
I have the following python function which I use a lot (simplified):
def dbg(var_spelling,var):
print("%s = %s" % (var_spelling,str(var))
I can implement this in pydev using Window->Preferences->pydev->Code
Completion->Templates
as debug("${cursor}",)
:-)But being a lazy person I like to save as much typing as possible,
and want to avoid typing in the variable name twice.
so in emacs, I write an elisp function which works like this (pseudo-code)
function debug:
cut-previous ## delete the previous word and put it in some clipboard
insert('dbg("",) ## automagically write the following
backward_char(3) ## move cursor back 3 columns
insert_cut_word() ## insert the previous cut word
forward_char(2) ## move cursor forward 2 columns
insert_cut_word() ## again
eol() ## cursor at end of line.
And now bind this elisp function to, say control-; d
The end result is that I can type in
foo
press control-; and then 'd'
and then have dbg("foo",foo)
Now in aptana, I can accomplish this with the {prompt} variable, but
pydev doesn't seem to have it.
A similar functionality for javascript in aptana is a snippet which looks like
this:
/*
category: JS
name: Wrap in alert call
toolTip: Wrap in alert()
toolbar: true
language: text/javascript
prompt(varname): Please enter the function name
*/
alert("${varname}:" + ${varname});
I would welcome Fabio's comments. Really, the pydev way is quite workable,
but I can see more complex needs that I'd like to accomplish.
IOWS: Is it possible to create a new command with a dedicated key sequence?
Regards
Tim
______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=293649
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pydev-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pydev-users