Skip to content

Instantly share code, notes, and snippets.

View mkoeppe's full-sized avatar

Matthias Köppe mkoeppe

View GitHub Profile
@mkoeppe
mkoeppe / sage-optional.el
Created June 12, 2023 17:46
Emacs macros for SageMath `# optional` maintenance
(defun sage-copy-optional-annotation ()
"In a 'sage: ' line of a docstring, copy '# optional' from a previous line and
advance to the end of the next 'sage: ' line or to the end of the current docstring.
If invoked elsewhere, just advance to the end of the next 'sage: ' line."
(interactive)
(if (save-excursion (beginning-of-line)
(looking-at " *sage:"))
(multiple-value-bind (tab-stop-list text advance)
(save-excursion
(previous-line)
# Adapted from scripts/geocode.py
import certifi
import urllib3
import pprint
from xml.dom.minidom import parseString
http = urllib3.PoolManager(
cert_reqs='CERT_REQUIRED',