* S-RET
@ 2020-11-14 20:15 Juri Linkov
2020-11-14 22:27 ` S-RET John Kitchin
2020-11-16 8:37 ` S-RET Leo
0 siblings, 2 replies; 6+ messages in thread
From: Juri Linkov @ 2020-11-14 20:15 UTC (permalink / raw)
To: emacs-orgmode
I've switched to Org Babel as a replacement of Jupyter Notebook since I already
tired copying Julia program texts back and forth between Jupyter pages
in web browsers and Emacs. Fortunately, Org Babel can do everything that
Jupyter Notebook does. Except that there is a small usability feature
that I miss in Org Babel. Typing 'C-RET' in Jupyter evaluates the current
code block. In Org Babel 'C-RET' inserts a new heading at the end of
the current subtree. To evaluate the code block there is 'C-c C-c'
(org-ctrl-c-ctrl-c). Thus the equivalent of 'C-RET' is 'C-c C-c'.
So far, so good.
What I miss in Org Babel is an equivalent of 'S-RET' that in Jupyter
creates a new code block relative to the current code block.
Actually, in Org Babel such a command already exists and is bound to
the needed key 'S-RET', but currently it works only on tables:
the command is 'org-table-copy-down' and it copies the current field
down to the next row and moves point along with it. This is exactly
what is needed also in context of code blocks.
Maybe like there is already the command named 'org-ctrl-c-ctrl-c',
a new general command bound to e.g. 'org-s-ret' could do this
depending on context.
PS: another similarity is how typing RET in shell buffers
inserts a new prompt where the user can type a new command.
'S-RET' in code blocks could work the same way: type 'S-RET'
and write code in the next code block, and type 'S-RET' again.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: S-RET
2020-11-14 20:15 S-RET Juri Linkov
@ 2020-11-14 22:27 ` John Kitchin
2020-11-15 9:31 ` S-RET Juri Linkov
2020-11-16 8:37 ` S-RET Leo
1 sibling, 1 reply; 6+ messages in thread
From: John Kitchin @ 2020-11-14 22:27 UTC (permalink / raw)
To: Juri Linkov; +Cc: org-mode-email
[-- Attachment #1: Type: text/plain, Size: 2467 bytes --]
you can find a lot of functions like the ones in jupyter at
https://github.com/jkitchin/scimax/blob/master/scimax-ob.el. I setup my
ipython like this:
https://github.com/jkitchin/scimax/blob/master/scimax-org-babel-ipython-upstream.el#L89
although I will note there are several setups in that file, e.g. this hydra:
https://github.com/jkitchin/scimax/blob/master/scimax-org-babel-ipython-upstream.el#L271
and these:
edit:
https://github.com/jkitchin/scimax/blob/master/scimax-org-babel-ipython-upstream.el#L271
command:
https://github.com/jkitchin/scimax/blob/master/scimax-org-babel-ipython-upstream.el#L526
I don't use them all, but leave them to remind me sometimes.
John
-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
On Sat, Nov 14, 2020 at 3:20 PM Juri Linkov <juri@linkov.net> wrote:
> I've switched to Org Babel as a replacement of Jupyter Notebook since I
> already
> tired copying Julia program texts back and forth between Jupyter pages
> in web browsers and Emacs. Fortunately, Org Babel can do everything that
> Jupyter Notebook does. Except that there is a small usability feature
> that I miss in Org Babel. Typing 'C-RET' in Jupyter evaluates the current
> code block. In Org Babel 'C-RET' inserts a new heading at the end of
> the current subtree. To evaluate the code block there is 'C-c C-c'
> (org-ctrl-c-ctrl-c). Thus the equivalent of 'C-RET' is 'C-c C-c'.
> So far, so good.
>
> What I miss in Org Babel is an equivalent of 'S-RET' that in Jupyter
> creates a new code block relative to the current code block.
>
> Actually, in Org Babel such a command already exists and is bound to
> the needed key 'S-RET', but currently it works only on tables:
> the command is 'org-table-copy-down' and it copies the current field
> down to the next row and moves point along with it. This is exactly
> what is needed also in context of code blocks.
>
> Maybe like there is already the command named 'org-ctrl-c-ctrl-c',
> a new general command bound to e.g. 'org-s-ret' could do this
> depending on context.
>
> PS: another similarity is how typing RET in shell buffers
> inserts a new prompt where the user can type a new command.
> 'S-RET' in code blocks could work the same way: type 'S-RET'
> and write code in the next code block, and type 'S-RET' again.
>
>
[-- Attachment #2: Type: text/html, Size: 3828 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: S-RET
2020-11-14 22:27 ` S-RET John Kitchin
@ 2020-11-15 9:31 ` Juri Linkov
2020-11-16 18:37 ` S-RET John Kitchin
0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2020-11-15 9:31 UTC (permalink / raw)
To: John Kitchin; +Cc: org-mode-email
> you can find a lot of functions like the ones in jupyter at
> https://github.com/jkitchin/scimax/blob/master/scimax-ob.el. I setup my
> ipython like this:
> https://github.com/jkitchin/scimax/blob/master/scimax-org-babel-ipython-upstream.el#L89
>
> although I will note there are several setups in that file, e.g. this
> hydra:
> https://github.com/jkitchin/scimax/blob/master/scimax-org-babel-ipython-upstream.el#L271
> …
> I don't use them all, but leave them to remind me sometimes.
Thanks, the number of supported features is impressive!
I see that the file name contains the word 'upstream'. This implies a set
of patches to upstream modules. Are there any plans to submit upstream
at least some of the most often used commands that correspond to
basic Jupyter shortcuts?
For example, it would make sense to bring scimax-execute-and-next-block
under the org-babel namespace as e.g. org-babel-execute-src-block-and-next-block
in the upstream ob-core.el. Then S-RET will be available to other ob backends
(such as ob-ruby.el that I use often too.)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: S-RET
2020-11-15 9:31 ` S-RET Juri Linkov
@ 2020-11-16 18:37 ` John Kitchin
0 siblings, 0 replies; 6+ messages in thread
From: John Kitchin @ 2020-11-16 18:37 UTC (permalink / raw)
To: Juri Linkov; +Cc: org-mode-email
Juri Linkov <juri@linkov.net> writes:
>> you can find a lot of functions like the ones in jupyter at
>> https://github.com/jkitchin/scimax/blob/master/scimax-ob.el. I setup my
>> ipython like this:
>> https://github.com/jkitchin/scimax/blob/master/scimax-org-babel-ipython-upstream.el#L89
>>
>> although I will note there are several setups in that file, e.g. this
>> hydra:
>> https://github.com/jkitchin/scimax/blob/master/scimax-org-babel-ipython-upstream.el#L271
>> …
>> I don't use them all, but leave them to remind me sometimes.
>
> Thanks, the number of supported features is impressive!
>
> I see that the file name contains the word 'upstream'. This implies a set
> of patches to upstream modules. Are there any plans to submit upstream
> at least some of the most often used commands that correspond to
> basic Jupyter shortcuts?
The upstream refers to org-babel-ipython. These libraries build on and
extend that. I don't have any plans to push them upstream, I think the
future will be with emacs-jupyter instead, but I haven't had time to
transition to it.
>
> For example, it would make sense to bring scimax-execute-and-next-block
> under the org-babel namespace as e.g. org-babel-execute-src-block-and-next-block
> in the upstream ob-core.el. Then S-RET will be available to other ob backends
> (such as ob-ruby.el that I use often too.)
I alot of these make sense for general babel use I think. My time for
development work has mostly vanished now, and it is not clear when it
will come back. If anyone wants to push these into ob-core.el, I have no
objections.
--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: S-RET
2020-11-14 20:15 S-RET Juri Linkov
2020-11-14 22:27 ` S-RET John Kitchin
@ 2020-11-16 8:37 ` Leo
2020-11-16 9:49 ` S-RET Juri Linkov
1 sibling, 1 reply; 6+ messages in thread
From: Leo @ 2020-11-16 8:37 UTC (permalink / raw)
To: Juri Linkov, emacs-orgmode
Juri Linkov <juri@linkov.net> writes:
>
> What I miss in Org Babel is an equivalent of 'S-RET' that in Jupyter
> creates a new code block relative to the current code block.
'C-c C-v C-d' (org-babel-demarcate-block) splits current code block into
two with the same settings. It might be what you want. Just bind it to
something easier to access maybe :P
/Leo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: S-RET
2020-11-16 8:37 ` S-RET Leo
@ 2020-11-16 9:49 ` Juri Linkov
0 siblings, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2020-11-16 9:49 UTC (permalink / raw)
To: Leo; +Cc: emacs-orgmode
>> What I miss in Org Babel is an equivalent of 'S-RET' that in Jupyter
>> creates a new code block relative to the current code block.
>
> 'C-c C-v C-d' (org-babel-demarcate-block) splits current code block into
> two with the same settings. It might be what you want. Just bind it to
> something easier to access maybe :P
Thanks, I tried 'C-c C-v C-d', but it's not exactly what is needed,
just an approximation.
When #+RESULTS: already exists after the #+END_SRC line,
'C-c C-v C-d' doesn't add a new #+BEGIN_SRC after #+RESULTS:,
it adds before it (however, this could be mitigated by evaluating
both blocks after splitting.)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-11-16 18:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-14 20:15 S-RET Juri Linkov
2020-11-14 22:27 ` S-RET John Kitchin
2020-11-15 9:31 ` S-RET Juri Linkov
2020-11-16 18:37 ` S-RET John Kitchin
2020-11-16 8:37 ` S-RET Leo
2020-11-16 9:49 ` S-RET Juri Linkov
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.