This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/contrib/lang/python/funcs.el
2014-11-14 22:41:45 -05:00

21 lines
734 B
EmacsLisp

;; from http://pedrokroger.net/2010/07/configuring-emacs-as-a-python-ide-2/
(defun annotate-pdb ()
"Highlight break point lines."
(interactive)
(highlight-lines-matching-regexp "import i?pdb")
(highlight-lines-matching-regexp "i?pdb.set_trace()"))
(defun python-toggle-breakpoint ()
"Add a break point, highlight it."
(interactive)
(let ((trace (if (executable-find "ipdb")
"import ipdb; ipdb.set_trace()"
"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-string trace)
(insert-string "\n")
(python-indent-line)))))