From ff6b92cfdd4720f252642b7af6657b4110beefe2 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 28 May 2014 15:35:00 +0000
Subject: [PATCH] Making ^X in the Read-File menu toggle between executing a
 command and inserting a file.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4922 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog    | 5 +++++
 src/global.c | 8 ++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 242517b3..64505bc9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,11 @@
 	* src/browser, src/search.c: There is no need to repeat translator
 	comments for the same string -- once is enough to get them included.
 	Add instead some translator comments for the prompts.
+	* src/global.c (shortcut_init): Make ^X in the Read-File menu toggle
+	between executing a command and inserting a file.  The mechanism in
+	do_insertfile() in files.c is already present -- in the past just
+	the wrong function was used in the relevant function-list item:
+	'do_insertfile_void' instead of the unintuitive 'ext_cmd_void'.
 
 2014-05-27  Chris Allegretta <chrisa@asty.org>
 	* src/winio.c (edit_refresh): wredrawln() is not supported under
diff --git a/src/global.c b/src/global.c
index a0159c79..84072ad4 100644
--- a/src/global.c
+++ b/src/global.c
@@ -488,6 +488,7 @@ void shortcut_init(void)
     const char *gotoline_tag = N_("Go To Line");
     const char *prev_line_tag = N_("Prev Line");
     const char *next_line_tag = N_("Next Line");
+    const char *read_file_tag = N_("Read File");
 #ifndef DISABLE_JUSTIFY
     const char *fulljustify_tag = N_("FullJstify");
 #endif
@@ -683,7 +684,7 @@ void shortcut_init(void)
      * reading from or writing to files not specified on the command
      * line. */
     add_to_funcs(do_insertfile_void,
-	MMAIN, N_("Read File"), IFSCHELP(nano_insert_msg), TRUE,
+	MMAIN, read_file_tag, IFSCHELP(nano_insert_msg), TRUE,
 #ifndef DISABLE_MULTIBUFFER
 	VIEW);
 #else
@@ -947,6 +948,9 @@ void shortcut_init(void)
         add_to_funcs(ext_cmd_void, MINSERTFILE,
 	    N_("Execute Command"), IFSCHELP(nano_execute_msg), FALSE, NOVIEW);
 
+        add_to_funcs(ext_cmd_void, MEXTCMD,
+	    read_file_tag, IFSCHELP(nano_insert_msg), FALSE, NOVIEW);
+
 #ifndef DISABLE_MULTIBUFFER
 	add_to_funcs(new_buffer_void, MINSERTFILE|MEXTCMD,
 	    N_("New Buffer"), IFSCHELP(nano_multibuffer_msg), FALSE, NOVIEW);
@@ -1160,7 +1164,7 @@ void shortcut_init(void)
 #ifndef DISABLE_BROWSER
     add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", to_files_void, 0, FALSE);
 #endif
-    add_to_sclist(MINSERTFILE, "^X", ext_cmd_void, 0, FALSE);
+    add_to_sclist(MINSERTFILE|MEXTCMD, "^X", ext_cmd_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);
     add_to_sclist(MHELP, "^G", do_exit, 0, TRUE);
-- 
GitLab