help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Evaluating python code blocks in python-mode


From: Yuri D'Elia
Subject: Re: Evaluating python code blocks in python-mode
Date: Sun, 21 Jun 2015 18:18:06 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]