Re: [Python-mode] form inserting print

2010-03-12 Thread Georg Brandl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Am 12.03.2010 10:51, schrieb Andreas Roehler:
 Hi python-mode folks,
 
 form below should speed up writing print-statements in Python a
 little bit.
 
 (defun druck (optional arg)
   Inserts a print statement out of current `(car kill-ring)' by default, 
 inserts ARG instead if delivered. 
   (interactive *)
   (lexical-let* ((name (or arg (car kill-ring)))
 (form (cond ((eq major-mode 'python-mode)
 (concat print \ name : %s \ %  name)
 (insert form)))
 
 Opinions?

Wouldn't that be the job of one of the numerous snippet packages that are
floating around?  I'm using yasnippet myself, and it works very well.
(I know that python.el has some definitions for skeleton mode, but
python-mode.el doesn't, and I'm not sure it should.)

Georg
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (GNU/Linux)

iEYEARECAAYFAkuaFbAACgkQN9GcIYhpnLDOGgCgsLnSpHSv000OzmCvrxwZDXzx
cwQAni9nFX3hIeZ3Di3bCtVHaCAClnlm
=Syty
-END PGP SIGNATURE-
___
Python-mode mailing list
Python-mode@python.org
http://mail.python.org/mailman/listinfo/python-mode


Re: [Python-mode] form inserting print

2010-03-12 Thread Barry Warsaw
On Mar 12, 2010, at 11:21 AM, Georg Brandl wrote:

Wouldn't that be the job of one of the numerous snippet packages that are
floating around?  I'm using yasnippet myself, and it works very well.
(I know that python.el has some definitions for skeleton mode, but
python-mode.el doesn't, and I'm not sure it should.)

I'm not sure either.  python-mode.el does contain some hooks for imenu so
there's some precedence.  I guess if we're going to support such
functionality, it should be via standard available hooks.

I don't use stuff like that much though, so I don't have a strong opinion
either way.

-Barry


signature.asc
Description: PGP signature
___
Python-mode mailing list
Python-mode@python.org
http://mail.python.org/mailman/listinfo/python-mode


Re: [Python-mode] form inserting print

2010-03-12 Thread Andreas Roehler
Georg Brandl wrote:
 Am 12.03.2010 10:51, schrieb Andreas Roehler:
 Hi python-mode folks,
 
 form below should speed up writing print-statements in Python a
 little bit.
 
 (defun druck (optional arg)
   Inserts a print statement out of current `(car kill-ring)' by default, 
 inserts ARG instead if delivered. 
   (interactive *)
   (lexical-let* ((name (or arg (car kill-ring)))
 (form (cond ((eq major-mode 'python-mode)
 (concat print \ name : %s \ %  name)
 (insert form)))
 
 Opinions?
 
 Wouldn't that be the job of one of the numerous snippet packages that are
 floating around? 

Probably.

 I'm using yasnippet myself, and it works very well.

For me too.

 (I know that python.el has some definitions for skeleton mode, but
 python-mode.el doesn't, and I'm not sure it should.)

Thanks for the hint.

`python-expand-template' works fine for me. For conditionals starting with `if' 
or `try' it
should pay having it.

Andreas

 
 Georg
___
Python-mode mailing list
Python-mode@python.org
http://mail.python.org/mailman/listinfo/python-mode