I could not manage to make py-cleanup-temporary work

Asked by Mat

Hello,

I've been using emacs and python-mode for my python programs for several years now.

When I updated my python-mode.el with the latest version, I found it quite inconvenient to have the python shell executed each time I did 'C-c C-c'. Hopefully I found out that the "v5-mode" had been developed and I could reproduce the behaviour I liked :) Thanks very much for this btw :)

But then, I found quite disturbing to have all these temporary files in my "buffer list". With the latest revision of python-mode.el (1149), I found there was a function named py-cleanup-temporary but that does not seem to work ? (I checked that the default value is t). In my "buffer list" I still have all these /tmp/python-3906kfw.py

From revision 1149 I just changed the following lines :

(defcustom python-mode-v5-behavior-p t ...

(defvar python-mode-v5-behavior t)

Is there anything I missed here ?

Also, I'm sorry to point out so many problems with this great tool, but why would we want to change the current directory ? I found the following line :

(unless (string-match "[Jj]ython" pyshellname) (py-insert-execute-directory execute-directory))

I must confess that I changed [Jj] to [PpJj] to disable this.
I personnally find the fact that 'C-c C-c' modifies the python file kind of disturbing ...
Because I'm used to considering 'C-c C-c' as a very convenient shortcut for 'M-x shell; python MY_FILE.py' (so with the cwd being the source file directory)

If you would explain me this new feature that would be very kind :)

Thanks in advance

Mat

Question information

Language:
English Edit question
Status:
Answered
For:
python-mode.el Edit question
Assignee:
Andreas Roehler Edit question
Last query:
Last reply:
Revision history for this message
Mat (mattlke) said :
#1

Hello,

I've been using emacs and python-mode for my python programs for several years now.

When I updated my python-mode.el with the latest version, I found it quite inconvenient to have the python shell executed each time I did 'C-c C-c'. Hopefully I found out that the "v5-mode" had been developed and I could reproduce the behaviour I liked :) Thanks very much for this btw :)

But then, I found quite disturbing to have all these temporary files in my "buffer list". With the latest revision of python-mode.el (1149), I found there was a function named py-cleanup-temporary but that does not seem to work ? (I checked that the default value is t). In my "buffer list" I still have all these /tmp/python-3906kfw.py

From revision 1149 I just changed the following lines :

(defcustom python-mode-v5-behavior-p t ...

(defvar python-mode-v5-behavior t)

Is there anything I missed here ?

Also, I'm sorry to point out so many problems with this great tool, but why would we want to change the current directory ? I found the following line :

(unless (string-match "[Jj]ython" pyshellname) (py-insert-execute-directory execute-directory))

I must confess that I changed [Jj] to [PpJj] to disable this.
I personnally find the fact that 'C-c C-c' modifies the python file kind of disturbing ...
Because I'm used to considering 'C-c C-c' as a very convenient shortcut for 'M-x shell; python MY_FILE.py' (so with the cwd being the source file directory)

If you would explain me this new feature that would be very kind :)

Thanks in advance

Mat

Revision history for this message
Andreas Roehler (a-roehler) said :
#2

Hi, thanks for the report. Filed it as bug again, as that kind of inconvenience should not exist.

Basically recent mode should work as convenient as v5.

v5 way will fail in certain circumstances, see lp:550661 for example.

Detected temporary files left in tmp-directory, which is a bug.
Don't see them in buffers-list however.

Can you help with this problem?

Provide an answer of your own, or ask Mat for more information if necessary.

To post a message you must log in.