From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri D'Elia Newsgroups: gmane.emacs.help Subject: Re: Evaluating python code blocks in python-mode Date: Sun, 21 Jun 2015 18:17:46 +0200 Message-ID: <5586E3AA.9030307@thregr.org> References: <5585BA55.8090205@easy-emacs.de> <558657BE.5090207@easy-emacs.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1434903525 20403 80.91.229.3 (21 Jun 2015 16:18:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 21 Jun 2015 16:18:45 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jun 21 18:18:38 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z6hx4-00053y-2D for geh-help-gnu-emacs@m.gmane.org; Sun, 21 Jun 2015 18:18:34 +0200 Original-Received: from localhost ([::1]:36744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6hx3-0007Q7-Gt for geh-help-gnu-emacs@m.gmane.org; Sun, 21 Jun 2015 12:18:33 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6hwo-0007Po-Rs for help-gnu-emacs@gnu.org; Sun, 21 Jun 2015 12:18:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z6hwh-0005Cv-Cs for help-gnu-emacs@gnu.org; Sun, 21 Jun 2015 12:18:18 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:46488) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6hwh-0005Cn-5p for help-gnu-emacs@gnu.org; Sun, 21 Jun 2015 12:18:11 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Z6hwe-0004mh-15 for help-gnu-emacs@gnu.org; Sun, 21 Jun 2015 18:18:08 +0200 Original-Received: from 193.106.183.18 ([193.106.183.18]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 21 Jun 2015 18:18:08 +0200 Original-Received: from wavexx by 193.106.183.18 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 21 Jun 2015 18:18:08 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 28 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 193.106.183.18 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 In-Reply-To: <558657BE.5090207@easy-emacs.de> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:105061 Archived-At: On 06/21/2015 08:20 AM, Andreas Röhler wrote: >> IIUC in question are arbitrary chunks of code. >> What about something like that: <...> > > (defun py-send-section () > (interactive) > (save-excursion > (let ((start (progn (unless (looking-at py-section-start) > (search-backward py-section-start) > (point))))) > (if (and (looking-at py-section-start)(search-forward > py-section-end)) > (py-execute-region start (point)) > (error "Can't see boundaries of py-section"))))) Yes, this is what I had in mind, however I was hoping there was a more general established approach for this sort of thing. Since I'm also using many other languages with an interpreter (ess-mode, tuareg to mention two that I regularly use), I'd like a general approach. For example, if we change py-section-start/end to use syntax-table, we can define a general approach to defining code "chunks" using delimited comments. I was hoping there was already a global minor mode that does something similar to delimit code chunks.