Allowing the toggle between Read File and Execute Command to be rebound.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4941 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
diff --git a/ChangeLog b/ChangeLog
index 29af158..779df4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-06-04  Benno Schulenberg  <bensberg@justemail.net>
+	* src/global.c (shortcut_init), src/files.c (do_insertfile): Rename
+	'ext_cmd_void' to 'flip_execute_void' to better match what it does.
+	* src/global.c (strtosc), doc/man/nanorc.5, doc/texinfo/nano.texi:
+	Add function name 'flipexecute' to enable rebinding ^X in the menus
+	Read File and Execute Command.
+
 2014-06-04  David Lawrence Ramsey  <pooka109@gmail.com>
 	* src/*.c: Adjustments of whitespace and comments.
 	* doc/nanorc.sample.in: Interpunction tweaks.
diff --git a/doc/man/nanorc.5 b/doc/man/nanorc.5
index 761b2c2..b677ff9 100644
--- a/doc/man/nanorc.5
+++ b/doc/man/nanorc.5
@@ -520,6 +520,9 @@
 .B dontreplace
 Switches back to searching instead of replacing.
 .TP
+.B flipexecute
+Toggles between inserting a file and executing a command.
+.TP
 .B gototext
 Searches for files matching a string in the file browser (reading or writing files).
 .TP
diff --git a/doc/texinfo/nano.texi b/doc/texinfo/nano.texi
index 62d146e..c72d422 100644
--- a/doc/texinfo/nano.texi
+++ b/doc/texinfo/nano.texi
@@ -1048,6 +1048,9 @@
 @item dontreplace
 Switches back to searching instead of replacing.
 
+@item flipexecute
+Toggles between inserting a file and executing a command.
+
 @item gototext
 Searches for files matching a string in the file browser (reading or writing files).
 
diff --git a/src/files.c b/src/files.c
index 557678f..e18c025 100644
--- a/src/files.c
+++ b/src/files.c
@@ -1084,7 +1084,7 @@
 		continue;
 	    } else
 #endif
-	    if (s && s->scfunc == ext_cmd_void) {
+	    if (s && s->scfunc == flip_execute_void) {
 		execute = !execute;
 		continue;
 	    }
diff --git a/src/global.c b/src/global.c
index 007fd03..a45983c 100644
--- a/src/global.c
+++ b/src/global.c
@@ -274,7 +274,7 @@
 void no_replace_void(void)
 {
 }
-void ext_cmd_void(void)
+void flip_execute_void(void)
 {
 }
 
@@ -936,10 +936,10 @@
     /* If we're using restricted mode, file insertion is disabled, and
      * thus command execution and the multibuffer toggle have no place. */
     if (!ISSET(RESTRICTED)) {
-        add_to_funcs(ext_cmd_void, MINSERTFILE,
+        add_to_funcs(flip_execute_void, MINSERTFILE,
 	    N_("Execute Command"), IFSCHELP(nano_execute_msg), FALSE, NOVIEW);
 
-        add_to_funcs(ext_cmd_void, MEXTCMD,
+        add_to_funcs(flip_execute_void, MEXTCMD,
 	    read_file_tag, IFSCHELP(nano_insert_msg), FALSE, NOVIEW);
 
 #ifndef DISABLE_MULTIBUFFER
@@ -1158,7 +1158,7 @@
 #ifndef DISABLE_BROWSER
     add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", to_files_void, 0, FALSE);
 #endif
-    add_to_sclist(MINSERTFILE|MEXTCMD, "^X", ext_cmd_void, 0, FALSE);
+    add_to_sclist(MINSERTFILE|MEXTCMD, "^X", flip_execute_void, 0, FALSE);
     add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", new_buffer_void, 0, FALSE);
     add_to_sclist(MHELP|MBROWSER, "^C", do_exit, 0, TRUE);
 #ifndef DISABLE_HELP
@@ -1506,6 +1506,11 @@
     } else if (!strcasecmp(input, "backup")) {
 	s->scfunc =  backup_file_void;
 	s->execute = FALSE;
+#ifndef ENABLE_TINY
+    } else if (!strcasecmp(input, "flipexecute")) {
+	s->scfunc = flip_execute_void;
+	s->execute = FALSE;
+#endif
 #ifndef DISABLE_MULTIBUFFER
     } else if (!strcasecmp(input, "newbuffer")) {
 	s->scfunc =  new_buffer_void;
diff --git a/src/proto.h b/src/proto.h
index 13165a7..cb0c095 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -837,6 +837,6 @@
 void backwards_void(void);
 void goto_dir_void(void);
 void no_replace_void(void);
-void ext_cmd_void(void);
+void flip_execute_void(void);
 
 #endif /* !PROTO_H */