* python.el patch: compilation-fake-loc broken
@ 2006-08-28 11:23 Slawomir Nowaczyk
2006-08-28 21:13 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Slawomir Nowaczyk @ 2006-08-28 11:23 UTC (permalink / raw)
Hello,
One of the recent changes to python.el broke the association between
temporary files executed by Python and emacs buffers (basically,
compilation-fake-loc doesn't have any effect).
Try python-send-buffer on a buffer containing "assert False", switch to
Inferior Python buffer, put point on """ File "c:/temp/py4388_sF", line
1, in ?""" line, press RET. The point should be moved to the appropriate
place in a buffer, you should not be asked for a file to visit.
The reason, AFAIU, is that by the time compilation-fake-loc runs, the
error message has already been received by accept-process-output.
The following patch fixes things for me, but I am not entirely sure it
is the right fix.
**********************************************************************
--- m:/EmacsCVS/EmacsCVS/lisp/progmodes/python.el 2006-08-26 21:48:19.180332800 +0200
+++ c:/Emacs/lisp/progmodes/python.el 2006-08-28 13:13:04.022593600 +0200
@@ -1366,13 +1366,18 @@
;; be the place to check it, e.g. we might actually want to send
;; commands having set up such a state.
-(defun python-send-command (command)
+(defun python-send-command (command orig-start f)
"Like `python-send-string' but resets `compilation-shell-minor-mode'.
COMMAND should be a single statement."
(assert (not (string-match "\n" command)))
(let ((end (marker-position (process-mark (python-proc)))))
(with-current-buffer python-buffer (goto-char (point-max)))
(compilation-forget-errors)
+ (with-current-buffer (process-buffer (python-proc))
+ ;; 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))
;; Must wait until this has completed before re-setting variables below.
(python-send-receive (concat command "; print '_emacs_out ()'"))
(with-current-buffer python-buffer
@@ -1407,13 +1412,7 @@
;; Wrong if we had indented code at buffer start.
(set-marker orig-start (line-beginning-position 0)))
(write-region "if True:\n" nil f nil 'nomsg))
- (write-region start end f t 'nomsg)
- (python-send-command command)
- (with-current-buffer (process-buffer (python-proc))
- ;; 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))))
+ (write-region start end f t 'nomsg)))
(defun python-send-string (string)
"Evaluate STRING in inferior Python process."
**********************************************************************
--
Best wishes,
Slawomir Nowaczyk
( slawomir.nowaczyk.847@student.lu.se )
War doesn't determine who's right, war determines who's left.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-08-28 21:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-28 11:23 python.el patch: compilation-fake-loc broken Slawomir Nowaczyk
2006-08-28 21:13 ` Stefan Monnier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).