From ef16223661a47da32114948c016b9e9c9f522de0 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Mon, 23 Jun 2014 20:03:25 +0000
Subject: [PATCH] Adding the bindable function 'gotodir', documenting it, and
 also documenting 'tofiles' and 'flipnewbuffer', and correcting the
 description of 'gototext' (not being about the file browser).

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5015 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog             |  4 ++++
 doc/man/nanorc.5      | 18 +++++++++++++++---
 doc/texinfo/nano.texi | 18 +++++++++++++++---
 src/global.c          | 16 +++++++++-------
 4 files changed, 43 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b8222ce4..6a42661f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,10 @@
 	* src/proto.h, src/global.c, src/search.c: Rename 'no_replace_void()'
 	to 'flip_replace_void()', to show what it actually does.
 	* doc/man/nanorc.5, doc/texinfo/nano.texi: Update the docs for that.
+	* src/global.c (strtosc): Add the bindable function 'gotodir'.
+	* doc/man/nanorc.5, doc/texinfo/nano.texi: Document the bindable
+	functions 'tofiles','gotodir' and 'flipnewbuffer', and correct
+	the description of 'gototext' (not being about the file browser).
 
 2014-06-22  Benno Schulenberg  <bensberg@justemail.net>
 	* src/browser.c (parse_browser_input), src/help.c (parse_help_input):
diff --git a/doc/man/nanorc.5 b/doc/man/nanorc.5
index 5ba4f731..87b7ea86 100644
--- a/doc/man/nanorc.5
+++ b/doc/man/nanorc.5
@@ -364,7 +364,8 @@ Inserts a file into the current buffer (or into a new buffer when multibuffer
 is enabled).
 .TP
 .B whereis
-Searches for text in the current buffer.
+Searches for text in the current buffer -- or for filenames matching
+a string in the current list in the file browser.
 .TP
 .B searchagain
 Repeats the last search command.
@@ -461,6 +462,9 @@ Goes to the last line of the file.
 .B gotoline
 Goes to a specific line (and column if specified).
 .TP
+.B gototext
+Switches from targetting a line number to searching for text.
+.TP
 .B findbracket
 Moves the cursor to the bracket (brace, parenthesis, etc.) that matches
 (pairs) with the one under the cursor.
@@ -520,8 +524,16 @@ Toggles between searching for something and replacing something.
 .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).
+.B flipnewbuffer
+Toggles between inserting into the current buffer and into a new
+empty buffer.
+.TP
+.B tofiles
+Starts the file browser, allowing to select a file from a list.
+.TP
+.B gotodir
+Goes to a directory to be specified, allowing to browse anywhere
+in the filesystem.
 .TP
 .B dosformat
 When writing a file, switches to writing a DOS format (CR/LF).
diff --git a/doc/texinfo/nano.texi b/doc/texinfo/nano.texi
index 0ee18746..b79098a2 100644
--- a/doc/texinfo/nano.texi
+++ b/doc/texinfo/nano.texi
@@ -890,7 +890,8 @@ Inserts a file into the current buffer (or into a new buffer when multibuffer
 is enabled).
 
 @item whereis
-Searches for text in the current buffer.
+Searches for text in the current buffer -- or for filenames matching
+a string in the current list in the file browser
 
 @item searchagain
 Repeats the last search command.
@@ -987,6 +988,9 @@ Goes to the last line of the file.
 @item gotoline
 Goes to a specific line (and column if specified).
 
+@item gototext
+Switches from targetting a line number to searching for text.
+
 @item findbracket
 Moves the cursor to the bracket (brace, parenthesis, etc.) that matches
 (pairs) with the one under the cursor.
@@ -1046,8 +1050,9 @@ Toggles between searching for something and replacing something.
 @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).
+@item flipnewbuffer
+Toggles between inserting into the current buffer and into a new
+empty buffer.
 
 @item dosformat
 When writing a file, switches to writing a DOS format (CR/LF).
@@ -1064,6 +1069,13 @@ When writing a file, 'prepends' (writes at the beginning) instead of overwriting
 @item backup
 When writing a file, creates a backup of the current file.
 
+@item tofiles
+Starts the file browser, allowing to select a file from a list.
+
+@item gotodir
+Goes to a directory to be specified, allowing to browse anywhere
+in the filesystem.
+
 @item firstfile
 Goes to the first file when using the file browser (reading or writing files).
 
diff --git a/src/global.c b/src/global.c
index 36a2c63f..11c460a5 100644
--- a/src/global.c
+++ b/src/global.c
@@ -1480,12 +1480,6 @@ sc *strtosc(char *input)
     } else if (!strcasecmp(input, "gototext")) {
 	s->scfunc = gototext_void;
 	s->execute = FALSE;
-#ifndef DISABLE_BROWSER
-    } else if (!strcasecmp(input, "browser") ||
-	       !strcasecmp(input, "tofiles")) {
-	s->scfunc = to_files_void;
-	s->execute = FALSE;
-#endif
     } else if (!strcasecmp(input, "dosformat")) {
 	s->scfunc = dos_format_void;
 	s->execute = FALSE;
@@ -1507,11 +1501,19 @@ sc *strtosc(char *input)
 	s->execute = FALSE;
 #endif
 #ifndef DISABLE_MULTIBUFFER
-    } else if (!strcasecmp(input, "newbuffer")) {
+    } else if (!strcasecmp(input, "flipnewbuffer") ||
+	       !strcasecmp(input, "newbuffer")) {
 	s->scfunc = new_buffer_void;
 	s->execute = FALSE;
 #endif
 #ifndef DISABLE_BROWSER
+    } else if (!strcasecmp(input, "tofiles") ||
+	       !strcasecmp(input, "browser")) {
+	s->scfunc = to_files_void;
+	s->execute = FALSE;
+    } else if (!strcasecmp(input, "gotodir")) {
+	s->scfunc = goto_dir_void;
+	s->execute = FALSE;
     } else if (!strcasecmp(input, "firstfile")) {
 	s->scfunc = do_first_file;
 	s->execute = FALSE;
-- 
GitLab