From 67f0f1c500091db27a69cb3a05fffd20c137d6e4 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Fri, 30 Sep 2022 15:59:56 -0400 Subject: Add 2022 talks --- 2022/talks/python.md | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 2022/talks/python.md (limited to '2022/talks/python.md') diff --git a/2022/talks/python.md b/2022/talks/python.md new file mode 100644 index 00000000..410b1368 --- /dev/null +++ b/2022/talks/python.md @@ -0,0 +1,69 @@ +[[!meta title="Short hyperlinks to Python docs"]] +[[!meta copyright="Copyright © 2022 Eduardo Ochs"]] +[[!inline pages="internal(2022/info/python-nav)" raw="yes"]] + + + + + +# Short hyperlinks to Python docs +Eduardo Ochs + +[[!inline pages="internal(2022/info/python-before)" raw="yes"]] + +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 + in +the browser, the +second one opens , and +the third one opens the RST source of those HTML pages in Emacs: the +file `//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](https://docs.python.org/3/tutorial/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: + + + +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](http://angg.twu.net/eev-current/eev-rstdoc.el.html) +– 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](http://angg.twu.net/emacsconf2022-py.html). For a translation of the Python tutorial +to a format that has only executable examples and elisp hyperlinks, +see [this](http://angg.twu.net/e/python.e.html#tut-numbers). + + + +[[!inline pages="internal(2022/info/python-after)" raw="yes"]] + +[[!inline pages="internal(2022/info/python-nav)" raw="yes"]] + +[[!taglink CategoryPython]] -- cgit v1.2.3