forked from syl20bnr/spacemacs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuncs.el
33 lines (31 loc) · 1.04 KB
/
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
;;; funcs.el --- Python Layer functions File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <[email protected]>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;; 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)))))