From: Benno Schulenberg Date: Mon, 7 Dec 2015 17:05:04 +0000 (+0000) Subject: Making ^O always prompt for a filename, also when --tempfile is given. X-Git-Tag: v2.5.1~55 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=cac3c3399fece253b44831aba2f1b95eaa03bb26;p=nano.git Making ^O always prompt for a filename, also when --tempfile is given. Users who want an immediate save, can bind the function 'savefile'. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5489 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 06a981f3..861963d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2015-12-07 Benno Schulenberg * src/winio.c (edit_draw): Quit the loop when there is no end match. + * src/files.c (do_writeout): When --tempfile is given, make ^O not + write out the file rightaway, as otherwise there is no way to discard + the edits. This undoes the core part of r5378 of September 29. See + https://lists.gnu.org/archive/html/help-nano/2015-11/msg00005.html. GNU nano 2.5.0 - 2015.12.05 @@ -206,7 +210,7 @@ GNU nano 2.4.3 - 2015.11.18 do_exit): When option -t is given, make ^O work the same way as under Pico, writing out the file without prompting. And make it work even better than Pico when the current file doesn't have a name yet. This - fixes Savannah bug #45415. + fixes Savannah bug #45415. [Reverted in r5489 on December 7.] 2015-10-28 Benno Schulenberg * src/text.c (do_redo): For an INSERT, 'u->mark_begin_lineno' is not diff --git a/src/files.c b/src/files.c index 0f07f173..01fbc173 100644 --- a/src/files.c +++ b/src/files.c @@ -2236,7 +2236,7 @@ bool do_writeout(bool exiting) #endif bool retval = FALSE; - if (openfile->filename[0] != '\0' && ISSET(TEMP_FILE)) { + if (exiting && openfile->filename[0] != '\0' && ISSET(TEMP_FILE)) { retval = write_file(openfile->filename, NULL, FALSE, OVERWRITE, FALSE); @@ -2275,14 +2275,6 @@ bool do_writeout(bool exiting) (append == APPEND) ? _("File Name to Append to") : _("File Name to Write"); - /* If we're not exiting, and the TEMP_FILE flag is set, and - * the current file doesn't have a name, warn the user before - * prompting for a name. If we are exiting, we've already - * warned the user just before the "Save modified buffer" - * prompt, so we don't need to do it again. */ - if (!exiting && openfile->filename[0] == '\0' && ISSET(TEMP_FILE)) - no_current_file_name_warning(); - /* If we're using restricted mode, the filename isn't blank, * and we're at the "Write File" prompt, disable tab * completion. */