Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#23 C-c C-c moves cursor into Python Output buffer

closed-fixed
None
5
2004-12-08
2004-12-06
Thomas Heller
No

When I edit a Python script with XEmacs, then hit C-c
C-c, the script is executed, the output is shown in a
*Python Output* buffer, and the cursor is moved into
this buffer.

I want the cursor to stay in the buffer displaying the
Python script. According to Skip this is a bug.

Discussion

  • Thomas Heller
    Thomas Heller
    2004-12-07

    Patch against CVS version.

     
    Attachments
  • Thomas Heller
    Thomas Heller
    2004-12-07

    Logged In: YES
    user_id=11105

    The attached patch works for me. But - I'm not an elisp
    hacker, so I have no idea if that's correct.

     
  • Logged In: YES
    user_id=22123

    Hi Thomas Heller,

    the drawback of your patch is, that the output buffer is not
    visible
    after py-execute-buffer. It is only visible if it was before.

     
  • Logged In: YES
    user_id=22123

    Unfortunately it is not possible to upload a file. Here is
    my patch.
    It calls pop-to-buffer after py-execute-region. I am not a
    (e)lisp expert, too.

    @@ -1747,12 +1747,15 @@
    See the `\\[py-execute-region]' docs for an account of some
    subtleties, including the use of the optional ASYNC argument."
    (interactive "P")
    - (if py-master-file
    - (let* ((filename (expand-file-name py-master-file))
    - (buffer (or (get-file-buffer filename)
    - (find-file-noselect filename))))
    - (set-buffer buffer)))
    - (py-execute-region (point-min) (point-max) async))
    + (let ((old-buffer (current-buffer)))
    + (if py-master-file
    + (let* ((filename (expand-file-name py-master-file))
    + (buffer (or (get-file-buffer filename)
    + (find-file-noselect filename))))
    + (set-buffer buffer)))
    + (py-execute-region (point-min) (point-max) async)
    + (pop-to-buffer old-buffer)
    + ))

    (defun py-execute-import-or-reload (&optional async)
    "Import the current buffer's file in a Python interpreter.

     
  • Thomas Heller
    Thomas Heller
    2004-12-08

    Logged In: YES
    user_id=11105

    Yep - this one works much better ;-). Thanks.

     
  • Skip Montanaro
    Skip Montanaro
    2004-12-08

    • assigned_to: nobody --> montanaro
    • status: open --> closed-fixed
     
  • Skip Montanaro
    Skip Montanaro
    2004-12-08

    Logged In: YES
    user_id=44345

    Thanks to both Thomases. Incorporated as python-model.el v
    4.69.

     
  • Thomas Heller
    Thomas Heller
    2004-12-08

    Logged In: YES
    user_id=11105

    Thanks, Skip.

    When byte-compiling the file with XEmacs, I get these (don't
    know if it matters or not):

    Compiling file c:\sf\python-mode\python-mode.el at Wed Dec
    08 22:13:20 2004
    While compiling py-choose-shell-by-shebang:
    ** reference to free variable auto-mode-interpreter-regexp
    While compiling py-submit-bug-report:
    ** variable reporter-prompt-for-summary-p bound but not
    referenced