poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] .editor: Do nothing if not running from the repl


From: John Darrington
Subject: [PATCH] .editor: Do nothing if not running from the repl
Date: Sat, 29 Feb 2020 13:28:16 +0100

---
 ChangeLog       | 5 +++++
 doc/poke.texi   | 1 +
 src/pk-editor.c | 5 +++++
 3 files changed, 11 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index c3d305ef..5ce99a73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-02-29  John Darrington <address@hidden>
+
+       * src/pk-editor.c (pk_cmd_editor): Do nothing if not
+       running interactively.
+
 2020-02-29  John Darrington <address@hidden>
 
        * src/poke.c (parse_args): Move assignment of poke_interactive_p
diff --git a/doc/poke.texi b/doc/poke.texi
index 6951db15..aa50ff28 100644
--- a/doc/poke.texi
+++ b/doc/poke.texi
@@ -590,6 +590,7 @@ invokes an external text editor on a temporary file.  You 
can then
 put contents on that file, save it and exit the editor.  At that point
 poke will read the file contents, turn them into a single line and
 execute them in the repl.
+If poke is not running interactively, then @command{.editor} does nothing.
 
 The editor used is identified by the @code{EDITOR} environment
 variable.
diff --git a/src/pk-editor.c b/src/pk-editor.c
index 79232ae0..fd7664c4 100644
--- a/src/pk-editor.c
+++ b/src/pk-editor.c
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <tmpdir.h>
 
+#include "poke.h"
 #include "pk-cmd.h"
 
 #include "findprog.h"
@@ -35,6 +36,10 @@ pk_cmd_editor (int argc, struct pk_cmd_arg argv[], uint64_t 
uflags)
   int des;
   FILE *f;
 
+  /* Do nothing (succesfully) if not in interactive mode.  */
+  if (!poke_interactive_p)
+    return 1;
+
   /* editor */
   assert (argc == 0);
 
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]