summaryrefslogtreecommitdiff
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2004-05-01 21:16:07 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2004-05-01 21:16:07 +0000
commitee99b45b27100adf150f366d112e124d1eebafa7 (patch)
treeec18955e2e61513a22f3a48ceee8b63286c806de /lisp/progmodes/python.el
parent9b7b51a21efc3cd1d5986f709e452d37ca33dd99 (diff)
downloademacs-ee99b45b27100adf150f366d112e124d1eebafa7.tar.gz
(python-compilation-line-number): Remove.
(python-compilation-regexp-alist): Don't use it any more. (python-orig-start, python-input-filter): Remove. (inferior-python-mode): Don't set up comint-input-filter-functions. (python-send-region): Use compilation-fake-loc.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el42
1 files changed, 7 insertions, 35 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 9eaba9027b8..844bd86174e 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -970,10 +970,11 @@ et al.")
)
(defconst python-compilation-regexp-alist
+ ;; FIXME: maybe this should be moved to compilation-error-regexp-alist-alist.
`((,(rx (and line-start (1+ (any " \t")) "File \""
(group (1+ (not (any "\"<")))) ; avoid `<stdin>' &c
"\", line " (group (1+ digit))))
- 1 python-compilation-line-number))
+ 1 2))
"`compilation-error-regexp-alist' for inferior Python.")
;; Fixme: This should inherit some stuff from python-mode, but I'm not
@@ -1002,7 +1003,6 @@ For running multiple processes in multiple buffers, see `python-buffer'.
;; Fixme: Maybe install some python-mode bindings too.
(define-key inferior-python-mode-map "\C-c\C-l" 'python-load-file)
(define-key inferior-python-mode-map "\C-c\C-z" 'python-switch-to-python)
- (add-hook 'comint-input-filter-functions 'python-input-filter nil t)
(add-hook 'comint-preoutput-filter-functions #'python-preoutput-filter
nil t)
;; Still required by `comint-redirect-send-command', for instance
@@ -1018,17 +1018,6 @@ Default ignores all inputs of 0, 1, or 2 non-blank characters."
:type 'regexp
:group 'python)
-(defvar python-orig-start nil
- "Marker to the start of the region passed to the inferior Python.
-It can also be a filename.")
-
-(defun python-input-filter (str)
- "`comint-input-filter' function for inferior Python.
-Don't save anything for STR matching `inferior-python-filter-regexp'.
-Also resets variables for adjusting error messages."
- (setq python-orig-start nil)
- (not (string-match inferior-python-filter-regexp str)))
-
;; Fixme: Loses with quoted whitespace.
(defun python-args-to-list (string)
(let ((where (string-match "[ \t]" string)))
@@ -1039,23 +1028,6 @@ Also resets variables for adjusting error messages."
(t (let ((pos (string-match "[^ \t]" string)))
(if pos (python-args-to-list (substring string pos))))))))
-(defun python-compilation-line-number (file col)
- "Return error descriptor of error found for FILE, column COL.
-Used as line-number hook function in `python-compilation-regexp-alist'."
- (let ((line (string-to-number (match-string 2))))
- (cons (point-marker)
- (if (and (markerp python-orig-start)
- (marker-buffer python-orig-start))
- (let ((start python-orig-start))
- (with-current-buffer (marker-buffer python-orig-start)
- (goto-char start)
- (forward-line (1- line))
- (point-marker)))
- (list (if (stringp python-orig-start)
- (list python-orig-start default-directory)
- file)
- line col)))))
-
(defvar python-preoutput-result nil
"Data from output line last `_emacs_out' line seen by the preoutput filter.")
@@ -1178,11 +1150,11 @@ print '_emacs_ok'"))
(write-region start end f t 'nomsg)
(when python-buffer
(with-current-buffer python-buffer
- (set (make-local-variable 'python-orig-start) orig-start)
- (let ((comint-input-filter-functions
- ;; Don't reset python-orig-start.
- (remq 'python-input-filter comint-input-filter-functions)))
- (python-send-command command))))))
+ (python-send-command command)
+ ;; Tell compile.el to redirect error locations in file `f' to
+ ;; positions past marker `orig-start'. It has to be done *after*
+ ;; python-send-command's call to compilation-forget-errors.
+ (compilation-fake-loc orig-start f)))))
(defun python-send-string (string)
"Evaluate STRING in inferior Python process."