Quick
index
main
eev
eepitch
maths
angg
blogme
dednat6
littlelangs
PURO
(C2,C3,C4,
 λ,ES,
 GA,MD,
 Caepro,
 textos,
 Chapa 1)

emacs
lua
(la)tex
maxima
agda
forth
squeak
icon
tcl
tikz
fvwm
debian
irc
contact

Short hyperlinks to Python docs (eev @ EmacsConf2022)

I submitted two proposals for 5-minute talks to the EmacsConf2022.
This one corresponds to this file: eev-rstdoc.el. Its EmacsConf page is here.
The tutorial is here. The link to the video is at the bottom of the page.
My other submission is here - it corresponds to eev-kla.el.
Links to my older presentations at EmacsConfs: 2021, 2020, 2019.


Title: Short hyperlinks to Python docs
Intended duration: 5 minutes
Abstract:

If we have a local copy of the Python docs installed then it is easy to define the three hyperlink functions in the Python program below,

# (find-pydoc  "tutorial/classes")
# (find-pydocw "tutorial/classes")
# (find-pydocr "tutorial/classes")
class MyVector:
    def __init__(v, x, y):
        v.x = x
        v.y = y

such that each one expands its argument in the right way, and the first one opens the local URL file:///usr/share/doc/python3.9-doc/html/tutorial/classes.html in the browser, the second one opens https://docs.python.org/3/tutorial/classes.html, and the third one opens the RST source of those HTML pages in Emacs: the file /<rstsourcedir>/tutorial/classes.rst.txt.

The docs for Python are designed to be navigated in a browser. Suppose that we start on the page classes.html above, follow a couple of hyperlinks, and then we find this other page that, ahem, is very interesting and important and we need to have hyperlinks to:

https://docs.python.org/3/reference/datamodel.html#object.__init__

The most obvious way to create elisp hyperlinks to that page is to copy its URL to Emacs, edit it by hand to produce a (find-pydoc ...) hyperlink, duplicate that hyperlink twice, and add a "w" and a "r" into the right places... but this is not very practical.

In this presentation I will show a practical way to handle that. It is a new module of eev -- eev-rstdoc.el -- that performs both the expansions needed by find-pydoc{,w,r} and the "shrinkings" that convert URLs and filenames to short hyperlinks. Eev-rstdoc.el comes with three "families" of hyperlinks, expansions, and shrinkings: one for Python docs, one for SymPy, and one for MatPlotLib. It is easy to add new families, and the parameters for expansion and shrinking in each family are easy to configure.

For more info see the comments in eev-rstdoc.el. For a translation of the Python tutorial to a format that has only executable examples and elisp hyperlinks, see this.


To watch the video on youtube, click here. That links points to the copy that is on my channel; the copy at the EmacsConf channel is here. The screenshot below is from the part of the video that explains how to create new "families"; this is explained here.

Note that youtube always converts my videos to a format that is blurry at some points. You can download a local copy of the original video, with subtitles, with the two "wget"s below:

# See:  http://anggtwu.net/eev-videos.html
#       http://anggtwu.net/eev-videos.html#mpv-keys
# Play: (find-eev2022pyvideo "0:00")
# Info: (find-1stclassvideo-links "eev2022py")
# Subs: (find-1stclassvideolsubs  "eev2022py")

wget -nc http://anggtwu.net/eev-videos/emacsconf2022-py.mp4
wget -N  http://anggtwu.net/eev-videos/emacsconf2022-py.vtt
mpv --fs --osd-level=2 emacsconf2022-py.mp4