From 257440aa1c368048203a111db15f5a791a07f53f Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Tue, 24 Apr 2012 22:58:29 +0800 Subject: * lisp/progmodes/python.el: Move hideshow setup to the end. --- lisp/progmodes/python.el | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'lisp/progmodes/python.el') diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 2922330e6f9..f88d77d214d 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2468,15 +2468,6 @@ with skeleton expansions for compound statement templates. nil t) (add-hook 'completion-at-point-functions 'python-completion-at-point nil 'local) - ;; Fixme: should be in hideshow. This seems to be of limited use - ;; since it isn't (can't be) indentation-based. Also hide-level - ;; doesn't seem to work properly. - (add-to-list 'hs-special-modes-alist - `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#" - ,(lambda (_arg) - (python-end-of-defun) - (skip-chars-backward " \t\n")) - nil)) (set (make-local-variable 'skeleton-further-elements) '((< '(backward-delete-char-untabify (min python-indent (current-column)))) @@ -2717,6 +2708,17 @@ comint believe the user typed this string so that ;; continue standard unloading nil) +;;;; Finish up +;; Fixme: should be in hideshow. This seems to be of limited use +;; since it isn't (can't be) indentation-based. Also hide-level +;; doesn't seem to work properly. +(add-to-list 'hs-special-modes-alist + `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#" + ,(lambda (_arg) + (python-end-of-defun) + (skip-chars-backward " \t\n")) + nil)) + (provide 'python) (provide 'python-21) -- cgit v1.2.1 From daf75653c2f1301332eb6c8af830050794ae0877 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Wed, 25 Apr 2012 23:23:19 +0800 Subject: * progmodes/python.el (python-send-region): Add suffix .py --- lisp/progmodes/python.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/progmodes/python.el') diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index f88d77d214d..b00e42db4b7 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1601,7 +1601,7 @@ behavior, change `python-remove-cwd-from-path' to nil." ;; Fixme: Write a `coding' header to the temp file if the region is ;; non-ASCII. (interactive "r") - (let* ((f (make-temp-file "py")) + (let* ((f (make-temp-file "py" nil ".py")) (command ;; IPython puts the FakeModule module into __main__ so ;; emacs.eexecfile becomes useless. -- cgit v1.2.1 From 784e7d6eebb4ac47d1f7b4e724b7aa843bc02f81 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Thu, 26 Apr 2012 00:46:01 +0800 Subject: * lisp/progmodes/python.el (python-pdbtrack-get-source-buffer): Use compilation-message if available to find real filename. --- lisp/progmodes/python.el | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'lisp/progmodes/python.el') diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index b00e42db4b7..620ea8cd519 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2606,9 +2606,17 @@ problem." (let* ((filename (match-string 1 block)) (lineno (string-to-number (match-string 2 block))) (funcname (match-string 3 block)) + (msg (get-text-property 0 'compilation-message filename)) + (loc (and msg (compilation--message->loc msg))) funcbuffer) - (cond ((file-exists-p filename) + (cond ((and loc (markerp (compilation--loc->marker loc))) + (setq funcbuffer (marker-buffer (compilation--loc->marker loc))) + (list (with-current-buffer funcbuffer + (line-number-at-pos (compilation--loc->marker loc))) + funcbuffer)) + + ((file-exists-p filename) (list lineno (find-file-noselect filename))) ((setq funcbuffer (python-pdbtrack-grub-for-buffer funcname lineno)) @@ -2626,15 +2634,12 @@ problem." (buffer-substring (point-min) (point-max))) ))))))) - (list lineno funcbuffer)) + (list lineno funcbuffer)) ((= (elt filename 0) ?\<) (format "(Non-file source: '%s')" filename)) - (t (format "Not found: %s(), %s" funcname filename))) - ) - ) - ) + (t (format "Not found: %s(), %s" funcname filename)))))) (defun python-pdbtrack-grub-for-buffer (funcname _lineno) "Find recent Python mode buffer named, or having function named FUNCNAME." -- cgit v1.2.1