summaryrefslogblamecommitdiffstats
path: root/2022/talks/jupyter.md
blob: 1a9304a90e472bf542cbd378b13e476bc271e5c7 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                       








                                                                                                     
                                                                     

























                                                                                                                                                                            
















                                                                      





                                                                                                   


                        
                                                                
                          
                                                                                                                                                                                                                                                                                                                                                                              






                                                                        



                                                                                                                       

                                                                     

                                                                                                                         




                                                                       


                                                                                                                                                
                                    
                                                                                                                                                                                                                               


                                                  
                                                                                                                                                                                     
 





                                                               
[[!sidebar content=""]]
[[!meta title="Edit live Jupyter notebook cells with Emacs"]]
[[!meta copyright="Copyright © 2022 Blaine Mooers"]]
[[!inline pages="internal(2022/info/jupyter-nav)" raw="yes"]]

<!-- Initially generated with emacsconf-generate-talk-page and then left alone for manual editing -->
<!-- You can manually edit this file to update the abstract, add links, etc. --->


# Edit live Jupyter notebook cells with Emacs
Blaine Mooers (Blane Moors, he/him, <mailto:Blaine-Mooers@ouhsc.edu>)

[[!inline pages="internal(2022/info/jupyter-before)" raw="yes"]]

My talk will address a dilemma faced daily by many technical writers and programmers.
Like many academics, I use several web-based platforms for writing prose (e.g., 750words, Overleaf) and interactive computing (Jupyter Notebook, Google Colab Notebooks).
The first group lacks support for snippets.
The second group has support for snippets, but this support does not include tab triggers and tab stops.
The absence of tab stops can increase the number of bugs by overlooking parameter values in the snippet that need to be changed to adapt the snippet to the current problem.
One solution to the absence of full-powered snippets is to apply Emacs with yasnippets to these web-based platforms.

One route to doing so is to use the atomic-chrome package for Emacs and the GhostText Extension for web browsers.
These two software packages enable two-way communication via a web socket between an Emacs buffer and the text area of the web page.
Edits made on the web side of the socket are immediately sent to the Emacs buffer and vice versa.
The Emacs's snippets and other editing tools only work in the Emacs buffer.
The connection can be closed from either side.
This route has enabled me to apply snippets of LaTeX code to my daily writing in 750words.
I have been able to convert 750words into a platform for writing in LaTeX; by default, it uses markdown.
I have also been able to apply code snippets for Julia, Python, R, and so on in Jupyter notebook cells.
In other words, I get to extend my time writing in Emacs.

In my ten-minute talk, I will describe my problems with web-based platforms and their solution with Emacs.
I will describe where to find the required software and how I configured Emacs.
I will present several precautions for using GhostText and describe the limitations of its application.
I will provide links to collections of snippets I found handy daily usage of 750words and Jupyter.


# Discussion

## Notes

-   <https://github.com/alpha22jp/atomic-chrome> atomic chrome is by
    alpha2jp. It is available on MELPA.
-   <https://ghosttext.fregante.com/> Central website for GhostText.
-   <https://www.youtube.com/watch?v=JWW3o104npY&t=190s> Example of
    using GhostText with Moodle to write web papes.
-   <https://github.com/MooersLab/latex-emacs> My configuration
    targeting LaTeX in Gnu Emacs.
-   <https://github.com/MooersLab/BerlinEmacsAugust2022> Slides from a
    90-minute talk in August at the Berlin Emacs Meetup about using
    LaTeX in Emacs.
-   <https://github.com/MooersLab/DSW22ghosttext> Slides to 50-minute
    talk in July about using GhostText with Emacs and other editors.
    Includes slides for friends that use Vim.
- Great talk, thank you!
- Btw, great talk Blaine!
- I've got ghosttext and emacs via atomicchrome working now: very easy and very useful!  Thank you.
- Nice job Blaine!
- Thank you!
- Pretty inspring!

## Questions and answers

-   Q: Kind of a silly question but I'm curious... Do you have a
    favourite color theme?
    -   A: I like several themes and use different ones in different Emacs profiles to distinguish their windows if two are more are open at once. I use the leuven theme in my default config file. It resembles the ef-light theme in the ef-theme.  package by Protesilaos Stavrou. I use the ef-spring theme in my latex-emacs config; it has mint green background color.
-   Q: Really interesting to discover GhostText thanks. I use ein (Emacs
    Ipython Notebooks
    <https://github.com/millejoh/emacs-ipython-notebook>) for running
    notebooks locally, I can clearly see the advantage of using
    GhostText with non-local notebooks/websites but is there anything
    that GhostText provides over EIN when interacting with locally
    running Jupyter Notebooks?
    -   A: Good question. I have used the juptyer package in org files, but I do not have much experience with EIN. 
    EIN  has a long list of commands specific to editing Jupyter Notebooks. 
    I expect that EIN provides the more powerful approach after making the investment in learning the new keybindings. 
    GhostText was not designed specifically to edit Jupyter cells. 
-   Q: To your knowledge are recent/coming security changes in Chrome
    going to impact the browswer exstention?   Thanks !
    -   A: I do not know the answer. 
    If the secuirty changes inhibits GhostText, it should continue to work in the FireFox family of browsers and Safari. 
-   Q:Is this browser-agnostic, or do you have to use Chrome? (answered
    in talk 15:58)
    -   A: Works on different browsers
-   Q: You mentioned a couple other solutions to allow emacs editing of
    text areas.  Pointers?
    -   Two options: (1) A: Emacs Everywhere (https://github.com/tecosaur/emacs-everywhere); however, it requires uses emacs-client.  
    (2) The above-mentioned atomic-chrome package can use the browser extension for chrome called "atomic-chrome" in place of GhostText.
    It is called "atomic" because the extension was orginally designed to work with the text editor Atom. However, I cannot find this extension.
-   Q: Why not save text from emacs?
    -   A: The text in the file will get out of synch with the text in the Emacs buffer and the browser. This can lead to loss of all of the text. Maybe you can set up continuous saving of the text to the file from Emacs. 
-   Q: What was the key binding for Linux/Firefox?
    -   A: Ctrl+Shift+h
-   Q: how long have you been in Emacs?
    -   A: 18 months ago I made the commitment to adopt GNU Emacs as my main text editor. I had several false starts earlier. I was too impatient to master one of the starter kits. 


[[!inline pages="internal(2022/info/jupyter-after)" raw="yes"]]

[[!inline pages="internal(2022/info/jupyter-nav)" raw="yes"]]

[[!taglink CategoryOrgMode]]