New submission from Terry J. Reedy:

The General tab of the IDLE Preferences dialog has this section with two 
radiobuttons:

Autosave Preferences
At Start of Run (F5)  () Prompt to Save   () No Prompt

The latter option actually means "No prompt unless the window is a new window 
('Untitled') that has never been saved." In the latter case, there is a prompt 
anyway.

This issue proposes that the current No Prompt option be more truthfully 
labelled and that a true no-prompt option be added. Currently in .cnf 
configuration files, autosave = 0 or 1. The new option would be 2 ('really 
true' ;-).

The motivation is to provide a default scratch file for throwaway code and 
thereby encourage more use of the editor even for single multi-line statements, 
which are harder to edit in the Shell than single-line statements. The behavior 
of Untitled windows would not otherwise change.

----------------
Possible dialog forms

Autosave Preferences
When Running (F5) a window with unsaved changes, prompt to save
() Always   () Only for Untitled    () Never

I find it slightly confusing that Autosave yes is selected in the negative with 
'no prompt'. An alternative:

Autosave Preferences
When Running (F5) a window with unsaved changes,
autosave instead of prompting to save
() Never   () Always except for Untitled    () Always

Another alternative is to retitle the section

Prompt to Save versus Autosave
When Running (F5) a window with unsaved changes, prompt to save
() Always   () Only for Untitled    () Never
--------------

However the dialog is worded, the new option would mean that unsaved new 
windows would be autosaved on Run to .idlerc/untitled.py. (I picked this 
directory because it already contains 4 per-user files, including 
recent-files.lst, and has to be writable.) This would be a common scratch file 
for all Untitled windows.

The particular Untitled window saved should not be 'associated' with that path. 
Its title would not change to 'untitled.py'. Idle allows only one edit window 
per disk file (path) but allows multiple Untitled windows not associated with 
any path.

The 'unsaved' flag on the window would not be cleared, so that closing the 
window would still bring up the 'save this untitled window' message box. (The 
alternative would be to clear it, but unclear it if any other Untitled window 
were saved.)

The full path to untitled.py would be added (or moved) to the top of the Recent 
Files list, just as with any other file. The file could then be retrieved (if 
not overwritten) in a later session. This would be particularly useful if 
running it caused a crash or freeze.
------------------

This proposal is based on Bruce Sherwood's vague description of a feature coded 
by G. Polo. I could not find a tracker issue for it. One apparent difference is 
that I propose adding a third option to the existing set instead of a new 
binary option. I have no idea whether Polo proposed to silently save the file 
(as I propose) or add a mechanism to truly run without saving (which is how a 
user will see it unless they look at Recent Files). In any case, my proposal is 
for a pretty minimal change. I believe it would take extra code to prevent the 
Recent Files listing.

----------
components: IDLE
messages: 197997
nosy: bsherwood, roger.serwy, terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: Idle: add option to autosave 'Untitled' edit window
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19042>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to