Back to the talks Previous by time: Edit live Jupyter notebook cells with Emacs Next by time: Haskell code exploration with Emacs Track: Development

Short hyperlinks to Python docs

Eduardo Ochs

The following image shows where the talk is in the schedule for Sat 2022-12-03. Solid lines show talks with Q&A via BigBlueButton. Dashed lines show talks with Q&A via IRC or Etherpad.

Schedule for Saturday Saturday 9:00- 9:05 Saturday opening remarks sat-open 9:05- 9:25 Emacs journalism (or everything's a nail if you hit it with Emacs) journalism 9:45- 9:55 Back to school with Emacs school 10:05-10:15 How to incorporate handwritten notes into Emacs Orgmode handwritten 10:45-11:05 Writing and organizing literature notes for scientific writing science 11:25-11:35 The Emacs Buddy initiative buddy 1:00- 1:20 Attending and organizing Emacs meetups meetups 1:40- 1:55 Linking personal info with Hyperbole implicit buttons buttons 2:15- 2:40 Real estate and Org table formulas realestate 3:00- 3:25 Health data journaling and visualization with Org Mode and gnuplot health 3:45- 4:05 Edit live Jupyter notebook cells with Emacs jupyter 4:50- 4:55 Saturday closing remarks sat-close 10:00-10:15 Tree-sitter beyond syntax highlighting treesitter 10:25-10:45 lsp-bridge: a smooth-as-butter asynchronous LSP client lspbridge 10:55-11:15 asm-blox: a game based on WebAssembly that no one asked for asmblox 11:25-11:35 Emacs should become a Wayland compositor wayland 1:00- 1:25 Using SQLite as a data source: a framework and an example sqlite 1:50- 2:30 Revisiting the anatomy of Emacs mail user agents mail 2:50- 3:10 Maintaining the Maintainers: Attribution as an Economic Model for Open Source maint 3:35- 3:40 Bidirectional links with eev eev 3:50- 3:55 Short hyperlinks to Python docs python 4:05- 4:35 Haskell code exploration with Emacs haskell 9 AM 10 AM 11 AM 12 PM 1 PM 2 PM 3 PM 4 PM 5 PM

Format: 5-min talk followed by IRC Q&A (#emacsconf-dev)
Etherpad: https://pad.emacsconf.org/2022-python
Discuss on IRC: #emacsconf-dev
Status: Waiting for video from speaker

Times in different timezones:
Saturday, Dec 3 2022, ~3:50 PM - 3:55 PM EST (US/Eastern)
which is the same as:
Saturday, Dec 3 2022, ~2:50 PM - 2:55 PM CST (US/Central)
Saturday, Dec 3 2022, ~1:50 PM - 1:55 PM MST (US/Mountain)
Saturday, Dec 3 2022, ~12:50 PM - 12:55 PM PST (US/Pacific)
Saturday, Dec 3 2022, ~8:50 PM - 8:55 PM UTC
Saturday, Dec 3 2022, ~9:50 PM - 9:55 PM CET (Europe/Paris)
Saturday, Dec 3 2022, ~10:50 PM - 10:55 PM EET (Europe/Athens)
Sunday, Dec 4 2022, ~2:20 AM - 2:25 AM IST (Asia/Kolkata)
Sunday, Dec 4 2022, ~4:50 AM - 4:55 AM +08 (Asia/Singapore)
Sunday, Dec 4 2022, ~5:50 AM - 5:55 AM JST (Asia/Tokyo)
Find out how to watch and participate

Description

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 this page. For a translation of the Python tutorial to a format that has only executable examples and elisp hyperlinks, see this.

Questions or comments? Please e-mail emacsconf-org-private@gnu.org

Back to the talks Previous by time: Edit live Jupyter notebook cells with Emacs Next by time: Haskell code exploration with Emacs Track: Development

CategoryPython