aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorStefan Monnier2004-04-16 23:36:13 +0000
committerStefan Monnier2004-04-16 23:36:13 +0000
commitc02484a0f2f9a5868c97f372326504342f3e465d (patch)
treeef855863025cf568c607cf6174432a64ef5a9a71 /lisp/progmodes/python.el
parentc78bf5031ee98618230093f54644a191d18d8f2a (diff)
downloademacs-c02484a0f2f9a5868c97f372326504342f3e465d.tar.gz
emacs-c02484a0f2f9a5868c97f372326504342f3e465d.zip
(python-compilation-line-number): Fix braindamage.
(python-load-file): Fix python-orig-start setting.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 000e16013d1..7a7e62d06ee 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -3,6 +3,7 @@
3;; Copyright (C) 2003, 04 Free Software Foundation, Inc. 3;; Copyright (C) 2003, 04 Free Software Foundation, Inc.
4 4
5;; Author: Dave Love <fx@gnu.org> 5;; Author: Dave Love <fx@gnu.org>
6;; Maintainer: FSF
6;; Created: Nov 2003 7;; Created: Nov 2003
7;; Keywords: languages 8;; Keywords: languages
8 9
@@ -1045,11 +1046,15 @@ Used as line-number hook function in `python-compilation-regexp-alist'."
1045 (cons (point-marker) 1046 (cons (point-marker)
1046 (if (and (markerp python-orig-start) 1047 (if (and (markerp python-orig-start)
1047 (marker-buffer python-orig-start)) 1048 (marker-buffer python-orig-start))
1048 (with-current-buffer (marker-buffer python-orig-start) 1049 (let ((start python-orig-start))
1049 (goto-char python-orig-start) 1050 (with-current-buffer (marker-buffer python-orig-start)
1050 (forward-line (1- line))) 1051 (goto-char start)
1051 (list (if (stringp python-orig-start) python-orig-start file) 1052 (forward-line (1- line))
1052 line nil))))) 1053 (point-marker)))
1054 (list (if (stringp python-orig-start)
1055 (list python-orig-start default-directory)
1056 file)
1057 line col)))))
1053 1058
1054(defvar python-preoutput-result nil 1059(defvar python-preoutput-result nil
1055 "Data from output line last `_emacs_out' line seen by the preoutput filter.") 1060 "Data from output line last `_emacs_out' line seen by the preoutput filter.")
@@ -1242,17 +1247,17 @@ module-qualified names."
1242 ;; (set (make-local-variable 'compilation-old-error-list) nil) 1247 ;; (set (make-local-variable 'compilation-old-error-list) nil)
1243 (let ((comint-input-filter-functions 1248 (let ((comint-input-filter-functions
1244 (delete 'python-input-filter comint-input-filter-functions))) 1249 (delete 'python-input-filter comint-input-filter-functions)))
1250 (set (make-local-variable 'python-orig-start) nil)
1251 ;; Fixme: I'm not convinced by this logic from python-mode.el.
1245 (python-send-string 1252 (python-send-string
1246 (if (string-match "\\.py\\'" file-name) 1253 (if (string-match "\\.py\\'" file-name)
1247 ;; Fixme: make sure the directory is in the path list 1254 ;; Fixme: make sure the directory is in the path list
1248 (let ((module (file-name-sans-extension 1255 (let ((module (file-name-sans-extension
1249 (file-name-nondirectory file-name)))) 1256 (file-name-nondirectory file-name))))
1250 (set (make-local-variable 'python-orig-start) nil)
1251 (format "\ 1257 (format "\
1252if globals().has_key(%S): reload(%s) 1258if globals().has_key(%S): reload(%s)
1253else: import %s 1259else: import %s
1254" module module module)) 1260" module module module))
1255 (set (make-local-variable 'python-orig-start) file-name)
1256 (format "execfile('%s')" file-name)))) 1261 (format "execfile('%s')" file-name))))
1257 (set-marker compilation-parsing-end end) 1262 (set-marker compilation-parsing-end end)
1258 (setq compilation-last-buffer (current-buffer)))))) 1263 (setq compilation-last-buffer (current-buffer))))))