From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?B?QW5kcmVhcyBSw7ZobGVy?= Newsgroups: gmane.emacs.python-mode,gmane.emacs.help Subject: Re: Evaluating python code blocks in python-mode Date: Sat, 20 Jun 2015 21:09:09 +0200 Message-ID: <5585BA55.8090205@easy-emacs.de> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1434827382 13148 80.91.229.3 (20 Jun 2015 19:09:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Jun 2015 19:09:42 +0000 (UTC) Cc: python-mode@python.org To: help-gnu-emacs@gnu.org Original-X-From: python-mode-bounces+gcpp-python-mode=m.gmane.org@python.org Sat Jun 20 21:09:34 2015 Return-path: Envelope-to: gcpp-python-mode@m.gmane.org Original-Received: from mail.python.org ([82.94.164.166]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z6O8x-0007Xv-96 for gcpp-python-mode@m.gmane.org; Sat, 20 Jun 2015 21:09:31 +0200 Original-Received: from albatross.python.org (localhost [127.0.0.1]) by mail.python.org (Postfix) with ESMTP id 3mDRQ30JvqzNLF for ; Sat, 20 Jun 2015 21:09:31 +0200 (CEST) Original-Received: from albatross.python.org (localhost [127.0.0.1]) by mail.python.org (Postfix) with ESMTP id 3mDRPw3vn9zNKv for ; Sat, 20 Jun 2015 21:09:24 +0200 (CEST) X-Spam-Status: OK 0.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'received:192.168.178': 0.07; 'subject:code': 0.07; '"can\'t': 0.09; 'boundaries.': 0.09; 'chunks': 0.09; 'python': 0.11; 'subject:python': 0.14; 'everyone,': 0.15; 'instead.': 0.15; '12:50': 0.16; 'btw': 0.16; 'sfxlen:0': 0.16; 'debugging': 0.18; 'preferred': 0.20; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'exists.': 0.22; 'cc:no real name:2**0': 0.23; 'code.': 0.23; "i've": 0.24; 'header:In-Reply- To:1': 0.24; 'header:User-Agent:1': 0.26; 'question': 0.26; 'defining': 0.27; 'heading': 0.27; 'opposed': 0.27; "i'm": 0.29; 'interface': 0.29; 'block,': 0.29; 'boundaries': 0.29; 'selecting': 0.29; "i'd": 0.31; 'code': 0.31; 'especially': 0.32; 'skip:p 30': 0.32; 'choices': 0.33; 'advice': 0.35; 'could': 0.35; 'something': 0.35; 'comment': 0.35; 'but': 0.36; '(and': 0.36; 'others.': 0.36; "didn't": 0.37; 'subject:: ': 0.37; 'ok,': 0. Original-Received: from localhost (HELO mail.python.org) (127.0.0.1) by albatross.python.org with SMTP; 20 Jun 2015 21:09:24 +0200 Original-Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.python.org (Postfix) with ESMTPS for ; Sat, 20 Jun 2015 21:09:24 +0200 (CEST) Original-Received: from [192.168.178.31] ([77.12.172.134]) by mrelayeu.kundenserver.de (mreue103) with ESMTPSA (Nemesis) id 0Meu09-1ZUM6M3Gg5-00OYaw; Sat, 20 Jun 2015 21:09:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 In-Reply-To: X-Provags-ID: V03:K0:RIG5cyqfxfW9Wtl3NRPvvZQbkhXQNhFOAN5+fi92mGrwJaMmpSC 86B/ajUpXMu9hPDKvnw/laHntwBFmC4GjoXyRagv7xhxb9Y8PaTQewo9PnoASL8UnVRhj7R kq3IlST1eVHIY4phXiKBqFVFtHuCumWmEmJq9UYQbTtufnOFrQiWxLLw+BkEVPb7JRmQTSY TqJdLgk98cSGFklyhkOrA== X-UI-Out-Filterresults: notjunk:1;V01:K0:ZGS2Po5y2DY=:m24vKHME77Kct7zzvbmL3W eWu14T5xB7d2qaXUZrZdsCOIbp54QK04xpekLJMEWfxrIlHzkrNEHEQfUBl4kzBj5ALvD4vXA a6/UuIrUaLYIo8xWeW9kpnxUGNfNlLfvAJI4/wNaEt30AUYAZOXOd2Wt6P59mZM0Z8MzNFEgX mC3mV4+5L3fzgiaeucbYjFszJ4zEIHH8Oo/SkNvxtwM6pvddpb6alrqWe8FlIrYtToxQGgCcH slDGBJTRM0PMka7ac4ym5/SFtZC3xsZH7hvIb5h1VK3rkqnBxEpjt1PEBYntIIcomK8ZNwZ53 AXKlSI/UU3XY3FEu/dkVl4BQk+z+Ad607Xdn+C5TXcmXzbd0lZlwkUacjPRXFvQdktQDX86Zc 4wcE/5dCzuiQgcEZo4PE+sS2+dtkgdH7uVKAM5l6kqu1XQUjRD8itNf6G63SZ/MCrxO7eg+0S RvLHJOmrcwL6QeqsFE4mf1cA7JYEY9cSDLMTJKJjXxkq+PXxr0i3VEzNz5v3p6y51f+NgMyrM ONKTtplnxGGExgJrusp72JAKVm8MeoTebSX9D6LB1GP7acBQq5E1oO2QnNph19RaCjP9ENrBn fzfrSL+DAAAmBjgMXQutUdLgldrsNqlLwXs+LUKv6GW2klL2EWqN+2MOakJWZ87yAOzYxFHYN Y2ZvAhwQfOJeM0EI/62N/P6Opotko/pw1LOsZfr+4ru7vGw== X-BeenThere: python-mode@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: For issues concerning python-mode for X/Emacs List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: python-mode-bounces+gcpp-python-mode=m.gmane.org@python.org Original-Sender: "Python-mode" Xref: news.gmane.org gmane.emacs.python-mode:1303 gmane.emacs.help:105054 Archived-At: Am 20.06.2015 um 12:50 schrieb Yuri D'Elia: > Hi everyone, > > I'd like some advice about using python-mode with a python subprocess. > I always preferred to use emacs+file+external process as opposed to use > an ipython's notebook-like interface: it's just more convenient, > especially when debugging existing code. > > I often use the same setup when doing some analysis, and this is when an > inotebook-like interface is more convenient for evaluation: I'd like to > evaluate code not line-by-line, or by defun, but by my custom-defined > blocks. I realized I was continuously selecting a region, and using > py-send-region over and over. > > Right now I narrow to the region I'm editing, and use py-send-buffer > instead. It's ok-eish, but narrow/widen narrow/widen, while less common, > is still inconvenient. > > I've seen people using org-mode for this kind of setup instead. Which > might be ok, but I'd like to know what other choices I could have as well. > > I was thinking of defining a custom region using comments, and defining > my own py-send-custom-block using comment markers as boundaries. Surely, > something like this must already exists. > > IIUC in question are arbitrary chunks of code. What about something like that: ;;;; (defvar py-section-start "# {{") (defvar py-section-end "# }}") (defun py-send-section () (interactive) (save-excursion (unless (looking-at py-section-start) (search-backward py-section-start) (set-mark (point)) (if (and (looking-at py-section-start)(search-forward py-section-end)) (py-execute-region (region-beginning) (region-end)) (error "Can't see boundaries of py-section"))))) ;;;; BTW didn't call it block, as this is already used by forms heading others.