-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_funcs.el
51 lines (47 loc) · 2.49 KB
/
custom_funcs.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
;;; custom_funcs.el -*- lexical-binding: t; -*-
;; (defun spacemacs/python-toggle-breakpoint ()
;; "Add a break point, highlight it."
;; (interactive)
;; (let ((trace (cond ((spacemacs/pyenv-executable-find "trepan3k") "import trepan.api; trepan.api.debug()")
;; ((spacemacs/pyenv-executable-find "wdb") "import wdb; wdb.set_trace()")
;; ((spacemacs/pyenv-executable-find "ipdb") "import ipdb; ipdb.set_trace()")
;; ((spacemacs/pyenv-executable-find "pudb") "import pudb; pudb.set_trace()")
;; ((spacemacs/pyenv-executable-find "ipdb3") "import ipdb; ipdb.set_trace()")
;; ((spacemacs/pyenv-executable-find "pudb3") "import pudb; pudb.set_trace()")
;; ((spacemacs/pyenv-executable-find "python3.7") "breakpoint()")
;; ((spacemacs/pyenv-executable-find "python3.8") "breakpoint()")
;; (t "import pdb; pdb.set_trace()")))
;; (line (thing-at-point 'line)))
;; (if (and line (string-match trace line))
;; (kill-whole-line)
;; (progn
;; (back-to-indentation)
;; (insert trace)
;; (insert "\n")
;; (python-indent-line)))))
(defun spacemacs/python-toggle-breakpoint ()
"Add a break point, highlight it."
(interactive)
(let ((trace (cond ((pipenv-executable-find "trepan3k") "import trepan.api; trepan.api.debug()")
((pipenv-executable-find "wdb") "import wdb; wdb.set_trace()")
((pipenv-executable-find "ipdb") "import ipdb; ipdb.set_trace()")
((pipenv-executable-find "pudb") "import pudb; pudb.set_trace()")
((pipenv-executable-find "ipdb3") "import ipdb; ipdb.set_trace()")
((pipenv-executable-find "pudb3") "import pudb; pudb.set_trace()")
((pipenv-executable-find "python3.7") "breakpoint()")
((pipenv-executable-find "python3.8") "breakpoint()")
(t "import pdb; pdb.set_trace()")))
(line (thing-at-point 'line)))
(if (and line (string-match trace line))
(kill-whole-line)
(progn
(back-to-indentation)
(insert trace)
(insert "\n")
(python-indent-line)))))
;; key mappings
;; (map! :map python-mode-map
;; :localleader
;; :prefix ("d" . "debug")
;; :desc "Toggle breakpoint"
;; "b" #'spacemacs/python-toggle-breakpoint)