aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier2004-05-01 21:16:07 +0000
committerStefan Monnier2004-05-01 21:16:07 +0000
commitee99b45b27100adf150f366d112e124d1eebafa7 (patch)
treeec18955e2e61513a22f3a48ceee8b63286c806de /lisp
parent9b7b51a21efc3cd1d5986f709e452d37ca33dd99 (diff)
downloademacs-ee99b45b27100adf150f366d112e124d1eebafa7.tar.gz
emacs-ee99b45b27100adf150f366d112e124d1eebafa7.zip
(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')
-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.")
970 ) 970 )
971 971
972(defconst python-compilation-regexp-alist 972(defconst python-compilation-regexp-alist
973 ;; FIXME: maybe this should be moved to compilation-error-regexp-alist-alist.
973 `((,(rx (and line-start (1+ (any " \t")) "File \"" 974 `((,(rx (and line-start (1+ (any " \t")) "File \""
974 (group (1+ (not (any "\"<")))) ; avoid `<stdin>' &c 975 (group (1+ (not (any "\"<")))) ; avoid `<stdin>' &c
975 "\", line " (group (1+ digit)))) 976 "\", line " (group (1+ digit))))
976 1 python-compilation-line-number)) 977 1 2))
977 "`compilation-error-regexp-alist' for inferior Python.") 978 "`compilation-error-regexp-alist' for inferior Python.")
978 979
979;; Fixme: This should inherit some stuff from python-mode, but I'm not 980;; 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'.
1002 ;; Fixme: Maybe install some python-mode bindings too. 1003 ;; Fixme: Maybe install some python-mode bindings too.
1003 (define-key inferior-python-mode-map "\C-c\C-l" 'python-load-file) 1004 (define-key inferior-python-mode-map "\C-c\C-l" 'python-load-file)
1004 (define-key inferior-python-mode-map "\C-c\C-z" 'python-switch-to-python) 1005 (define-key inferior-python-mode-map "\C-c\C-z" 'python-switch-to-python)
1005 (add-hook 'comint-input-filter-functions 'python-input-filter nil t)
1006 (add-hook 'comint-preoutput-filter-functions #'python-preoutput-filter 1006 (add-hook 'comint-preoutput-filter-functions #'python-preoutput-filter
1007 nil t) 1007 nil t)
1008 ;; Still required by `comint-redirect-send-command', for instance 1008 ;; 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."
1018 :type 'regexp 1018 :type 'regexp
1019 :group 'python) 1019 :group 'python)
1020 1020
1021(defvar python-orig-start nil
1022 "Marker to the start of the region passed to the inferior Python.
1023It can also be a filename.")
1024
1025(defun python-input-filter (str)
1026 "`comint-input-filter' function for inferior Python.
1027Don't save anything for STR matching `inferior-python-filter-regexp'.
1028Also resets variables for adjusting error messages."
1029 (setq python-orig-start nil)
1030 (not (string-match inferior-python-filter-regexp str)))
1031
1032;; Fixme: Loses with quoted whitespace. 1021;; Fixme: Loses with quoted whitespace.
1033(defun python-args-to-list (string) 1022(defun python-args-to-list (string)
1034 (let ((where (string-match "[ \t]" string))) 1023 (let ((where (string-match "[ \t]" string)))
@@ -1039,23 +1028,6 @@ Also resets variables for adjusting error messages."
1039 (t (let ((pos (string-match "[^ \t]" string))) 1028 (t (let ((pos (string-match "[^ \t]" string)))
1040 (if pos (python-args-to-list (substring string pos)))))))) 1029 (if pos (python-args-to-list (substring string pos))))))))
1041 1030
1042(defun python-compilation-line-number (file col)
1043 "Return error descriptor of error found for FILE, column COL.
1044Used as line-number hook function in `python-compilation-regexp-alist'."
1045 (let ((line (string-to-number (match-string 2))))
1046 (cons (point-marker)
1047 (if (and (markerp python-orig-start)
1048 (marker-buffer python-orig-start))
1049 (let ((start python-orig-start))
1050 (with-current-buffer (marker-buffer python-orig-start)
1051 (goto-char start)
1052 (forward-line (1- line))
1053 (point-marker)))
1054 (list (if (stringp python-orig-start)
1055 (list python-orig-start default-directory)
1056 file)
1057 line col)))))
1058
1059(defvar python-preoutput-result nil 1031(defvar python-preoutput-result nil
1060 "Data from output line last `_emacs_out' line seen by the preoutput filter.") 1032 "Data from output line last `_emacs_out' line seen by the preoutput filter.")
1061 1033
@@ -1178,11 +1150,11 @@ print '_emacs_ok'"))
1178 (write-region start end f t 'nomsg) 1150 (write-region start end f t 'nomsg)
1179 (when python-buffer 1151 (when python-buffer
1180 (with-current-buffer python-buffer 1152 (with-current-buffer python-buffer
1181 (set (make-local-variable 'python-orig-start) orig-start) 1153 (python-send-command command)
1182 (let ((comint-input-filter-functions 1154 ;; Tell compile.el to redirect error locations in file `f' to
1183 ;; Don't reset python-orig-start. 1155 ;; positions past marker `orig-start'. It has to be done *after*
1184 (remq 'python-input-filter comint-input-filter-functions))) 1156 ;; python-send-command's call to compilation-forget-errors.
1185 (python-send-command command)))))) 1157 (compilation-fake-loc orig-start f)))))
1186 1158
1187(defun python-send-string (string) 1159(defun python-send-string (string)
1188 "Evaluate STRING in inferior Python process." 1160 "Evaluate STRING in inferior Python process."