From 43059fbd1fd6bc7143821b62ebb4dd57b760203a Mon Sep 17 00:00:00 2001
From: Jim Keener <jim@jimkeener.com>
Date: Thu, 16 Feb 2017 18:31:11 -0500
Subject: [PATCH 1/1] Adds documentaiton for \e at the end of a line

---
 doc/src/sgml/ref/psql-ref.sgml | 6 ++++++
 src/bin/psql/help.c            | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index ae58708..13cff48 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -1694,6 +1694,7 @@ testdb=&gt;
 
       <varlistentry>
         <term><literal>\e</literal> or <literal>\edit</> <literal> <optional> <replaceable class="parameter">filename</> </optional> <optional> <replaceable class="parameter">line_number</> </optional> </literal></term>
+        <term><literal><replaceable class="parameter">query</replaceable></literal> <literal>\e</literal> or <literal>\edit</> </literal></term>
 
         <listitem>
         <para>
@@ -1724,6 +1725,11 @@ testdb=&gt;
         not a file name.
         </para>
 
+        <para>
+        If placed at the end of a query, with no trailing semicolon (;),
+        the current line will be placed into the editor.
+        </para>
+
         <tip>
         <para>
         See under <xref linkend="app-psql-environment"
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 3e3cab4..7665f8a 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -190,7 +190,8 @@ slashUsage(unsigned short int pager)
 	fprintf(output, "\n");
 
 	fprintf(output, _("Query Buffer\n"));
-	fprintf(output, _("  \\e [FILE] [LINE]       edit the query buffer (or file) with external editor\n"));
+	fprintf(output, _("  \\e [FILE] [LINE]       edit the query buffer (or file) with an external editor\n"));
+	fprintf(output, _("  QUERY \e              edit the current query with an external editor\n"));
 	fprintf(output, _("  \\ef [FUNCNAME [LINE]]  edit function definition with external editor\n"));
 	fprintf(output, _("  \\ev [VIEWNAME [LINE]]  edit view definition with external editor\n"));
 	fprintf(output, _("  \\p                     show the contents of the query buffer\n"));
-- 
2.7.4

