forked from python/mypy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacs.el
22 lines (20 loc) · 774 Bytes
/
macs.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
; Example Emacs integration; shows type of expression in region.
(defun mypy-show-region ()
"Show type of variable at point."
(interactive)
(let ((here (region-beginning))
(there (region-end))
(filename (buffer-file-name)))
(let ((hereline (line-number-at-pos here))
(herecol (save-excursion (goto-char here) (current-column)))
(thereline (line-number-at-pos there))
(therecol (save-excursion (goto-char there) (current-column))))
(shell-command
(format "cd ~/src/mypy; python3 ./scripts/find_type.py %s %s %s %s %s python3 -m mypy -i mypy"
filename hereline herecol thereline therecol)
)
)
)
)
; I like to bind this to ^X-t.
(global-set-key "\C-xt" 'mypy-show-region)