From 04a38da312fd660f505afac3412ddd842966dc0d Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 4 Jun 2014 19:15:16 +0000 Subject: [PATCH] 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 --- ChangeLog | 7 +++++++ doc/man/nanorc.5 | 3 +++ doc/texinfo/nano.texi | 3 +++ src/files.c | 2 +- src/global.c | 13 +++++++++---- src/proto.h | 2 +- 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 29af1582..779df4de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2014-06-04 Benno Schulenberg + * 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 * 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 761b2c21..b677ff9e 100644 --- a/doc/man/nanorc.5 +++ b/doc/man/nanorc.5 @@ -520,6 +520,9 @@ Shows the next history entry in the prompt menus (e.g. search). .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 62d146ed..c72d4223 100644 --- a/doc/texinfo/nano.texi +++ b/doc/texinfo/nano.texi @@ -1048,6 +1048,9 @@ Shows the next history entry in the prompt menus (e.g. search). @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 557678f3..e18c0257 100644 --- a/src/files.c +++ b/src/files.c @@ -1084,7 +1084,7 @@ void do_insertfile( 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 007fd030..a45983c1 100644 --- a/src/global.c +++ b/src/global.c @@ -274,7 +274,7 @@ void new_buffer_void(void) void no_replace_void(void) { } -void ext_cmd_void(void) +void flip_execute_void(void) { } @@ -936,10 +936,10 @@ void shortcut_init(void) /* 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 @@ void shortcut_init(void) #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 @@ sc *strtosc(char *input) } 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 13165a72..cb0c095c 100644 --- a/src/proto.h +++ b/src/proto.h @@ -837,6 +837,6 @@ void new_buffer_void(void); 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 */ -- 2.39.5