all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: TheFlyingDutchman <zzbbaadd@aol.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Evaluate current line in Python mode?
Date: Sat, 28 Aug 2010 16:49:20 -0700 (PDT)	[thread overview]
Message-ID: <6299fd09-5079-40f0-bfb4-4d4acdeb370d@x18g2000pro.googlegroups.com> (raw)
In-Reply-To: mailman.3.1283024747.17543.help-gnu-emacs@gnu.org

I think this does what you asked for.  You can add this to your .emacs
(or init.el)  file.
It is currently set to work on F7 but that line can be changed move it
to another key.

But it appears from my usage that for a lot of
Python lines, like function definitions and for loops, evaluating just
one line
doesn't work and then that negatively impacts subsequent line
evaluations.


(add-hook 'python-mode-hook
     'my-python-next-statement)


(defun my-python-next-statement ()
   (interactive)
   (local-set-key (kbd "<f7>") 'my-python-next-statement)
   (if (string= mode-name "Python")
     (progn
       (python-next-statement)
       (beginning-of-line)
       (setq lineStart (point))
       (end-of-line)
       (setq lineEnd (point))
       (python-send-region lineStart lineEnd) )
     (message "function only applies to Python mode")
     (beep) ) )



  parent reply	other threads:[~2010-08-28 23:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3.1283024747.17543.help-gnu-emacs@gnu.org>
2010-08-28 20:10 ` Evaluate current line in Python mode? Xah Lee
2010-08-28 23:49 ` TheFlyingDutchman [this message]
2010-08-28 19:45 Michael Hannon
2010-08-29  8:02 ` Andreas Röhler
2010-08-29  8:37   ` Thierry Volpiatto
2010-08-30 10:43     ` Andreas Röhler
2010-08-30 12:36       ` Thierry Volpiatto
2010-08-30 16:17         ` Andreas Röhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6299fd09-5079-40f0-bfb4-4d4acdeb370d@x18g2000pro.googlegroups.com \
    --to=zzbbaadd@aol.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.