Mercurial > emacs
comparison lisp/progmodes/python.el @ 54943:07e279030b6f
(python-compilation-line-number): Fix braindamage.
(python-load-file): Fix python-orig-start setting.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 16 Apr 2004 23:36:13 +0000 |
parents | 109b2bf180dd |
children | ee7e5daa7ffd |
comparison
equal
deleted
inserted
replaced
54942:ea5155e2fbe2 | 54943:07e279030b6f |
---|---|
1 ;;; python.el --- silly walks for Python | 1 ;;; python.el --- silly walks for Python |
2 | 2 |
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 |
9 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
10 | 11 |
1043 Used as line-number hook function in `python-compilation-regexp-alist'." | 1044 Used as line-number hook function in `python-compilation-regexp-alist'." |
1044 (let ((line (string-to-number (match-string 2)))) | 1045 (let ((line (string-to-number (match-string 2)))) |
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.") |
1056 | 1061 |
1057 (defvar python-preoutput-continuation nil | 1062 (defvar python-preoutput-continuation nil |
1240 (let ((end (marker-position (process-mark (python-proc))))) | 1245 (let ((end (marker-position (process-mark (python-proc))))) |
1241 (set (make-local-variable 'compilation-error-list) nil) | 1246 (set (make-local-variable 'compilation-error-list) nil) |
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 "\ |
1252 if globals().has_key(%S): reload(%s) | 1258 if globals().has_key(%S): reload(%s) |
1253 else: import %s | 1259 else: 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)))))) |
1259 | 1264 |
1260 ;; Fixme: Should this start a process if there isn't one? (Unlike cmuscheme.) | 1265 ;; Fixme: Should this start a process if there isn't one? (Unlike cmuscheme.) |