aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorPaul Eggert2012-05-25 11:19:24 -0700
committerPaul Eggert2012-05-25 11:19:24 -0700
commit42b2a986d9d4b7040fb20c90ec0efeffb78e761a (patch)
treed38e7bf5307837f2f38982757f088100de18a64e /lisp/progmodes/python.el
parente4d81efc58695c19154d5f6733d91172b4c3e5b7 (diff)
parenta8d3cbf75d219d7a249fc0623219511179e959da (diff)
downloademacs-42b2a986d9d4b7040fb20c90ec0efeffb78e761a.tar.gz
emacs-42b2a986d9d4b7040fb20c90ec0efeffb78e761a.zip
Merge from trunk.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el39
1 files changed, 23 insertions, 16 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 2922330e6f9..620ea8cd519 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1601,7 +1601,7 @@ behavior, change `python-remove-cwd-from-path' to nil."
1601 ;; Fixme: Write a `coding' header to the temp file if the region is 1601 ;; Fixme: Write a `coding' header to the temp file if the region is
1602 ;; non-ASCII. 1602 ;; non-ASCII.
1603 (interactive "r") 1603 (interactive "r")
1604 (let* ((f (make-temp-file "py")) 1604 (let* ((f (make-temp-file "py" nil ".py"))
1605 (command 1605 (command
1606 ;; IPython puts the FakeModule module into __main__ so 1606 ;; IPython puts the FakeModule module into __main__ so
1607 ;; emacs.eexecfile becomes useless. 1607 ;; emacs.eexecfile becomes useless.
@@ -2468,15 +2468,6 @@ with skeleton expansions for compound statement templates.
2468 nil t) 2468 nil t)
2469 (add-hook 'completion-at-point-functions 2469 (add-hook 'completion-at-point-functions
2470 'python-completion-at-point nil 'local) 2470 'python-completion-at-point nil 'local)
2471 ;; Fixme: should be in hideshow. This seems to be of limited use
2472 ;; since it isn't (can't be) indentation-based. Also hide-level
2473 ;; doesn't seem to work properly.
2474 (add-to-list 'hs-special-modes-alist
2475 `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#"
2476 ,(lambda (_arg)
2477 (python-end-of-defun)
2478 (skip-chars-backward " \t\n"))
2479 nil))
2480 (set (make-local-variable 'skeleton-further-elements) 2471 (set (make-local-variable 'skeleton-further-elements)
2481 '((< '(backward-delete-char-untabify (min python-indent 2472 '((< '(backward-delete-char-untabify (min python-indent
2482 (current-column)))) 2473 (current-column))))
@@ -2615,9 +2606,17 @@ problem."
2615 (let* ((filename (match-string 1 block)) 2606 (let* ((filename (match-string 1 block))
2616 (lineno (string-to-number (match-string 2 block))) 2607 (lineno (string-to-number (match-string 2 block)))
2617 (funcname (match-string 3 block)) 2608 (funcname (match-string 3 block))
2609 (msg (get-text-property 0 'compilation-message filename))
2610 (loc (and msg (compilation--message->loc msg)))
2618 funcbuffer) 2611 funcbuffer)
2619 2612
2620 (cond ((file-exists-p filename) 2613 (cond ((and loc (markerp (compilation--loc->marker loc)))
2614 (setq funcbuffer (marker-buffer (compilation--loc->marker loc)))
2615 (list (with-current-buffer funcbuffer
2616 (line-number-at-pos (compilation--loc->marker loc)))
2617 funcbuffer))
2618
2619 ((file-exists-p filename)
2621 (list lineno (find-file-noselect filename))) 2620 (list lineno (find-file-noselect filename)))
2622 2621
2623 ((setq funcbuffer (python-pdbtrack-grub-for-buffer funcname lineno)) 2622 ((setq funcbuffer (python-pdbtrack-grub-for-buffer funcname lineno))
@@ -2635,15 +2634,12 @@ problem."
2635 (buffer-substring 2634 (buffer-substring
2636 (point-min) (point-max))) 2635 (point-min) (point-max)))
2637 ))))))) 2636 )))))))
2638 (list lineno funcbuffer)) 2637 (list lineno funcbuffer))
2639 2638
2640 ((= (elt filename 0) ?\<) 2639 ((= (elt filename 0) ?\<)
2641 (format "(Non-file source: '%s')" filename)) 2640 (format "(Non-file source: '%s')" filename))
2642 2641
2643 (t (format "Not found: %s(), %s" funcname filename))) 2642 (t (format "Not found: %s(), %s" funcname filename))))))
2644 )
2645 )
2646 )
2647 2643
2648(defun python-pdbtrack-grub-for-buffer (funcname _lineno) 2644(defun python-pdbtrack-grub-for-buffer (funcname _lineno)
2649 "Find recent Python mode buffer named, or having function named FUNCNAME." 2645 "Find recent Python mode buffer named, or having function named FUNCNAME."
@@ -2717,6 +2713,17 @@ comint believe the user typed this string so that
2717 ;; continue standard unloading 2713 ;; continue standard unloading
2718 nil) 2714 nil)
2719 2715
2716;;;; Finish up
2717;; Fixme: should be in hideshow. This seems to be of limited use
2718;; since it isn't (can't be) indentation-based. Also hide-level
2719;; doesn't seem to work properly.
2720(add-to-list 'hs-special-modes-alist
2721 `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#"
2722 ,(lambda (_arg)
2723 (python-end-of-defun)
2724 (skip-chars-backward " \t\n"))
2725 nil))
2726
2720(provide 'python) 2727(provide 'python)
2721(provide 'python-21) 2728(provide 'python-21)
2722 2729