about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command/cmd_defs.c2
-rw-r--r--src/tools/editor.c7
2 files changed, 7 insertions, 2 deletions
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index c9faed96..0a996a44 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -2545,7 +2545,7 @@ static const struct cmd_t command_defs[] = {
               "/executable urlsave set \"curl %u -o %p\"",
               "/executable urlsave default",
               "/executable vcard_photo set \"feh %p\"",
-              "/executable editor set vim")
+              "/executable editor set \"emacsclient -t\"")
     },
 
     { CMD_PREAMBLE("/url",
diff --git a/src/tools/editor.c b/src/tools/editor.c
index 350fb5b1..0efb4d6b 100644
--- a/src/tools/editor.c
+++ b/src/tools/editor.c
@@ -88,11 +88,16 @@ get_message_from_editor(gchar* message, gchar** returned_message)
     }
 
     char* editor = prefs_get_string(PREF_COMPOSE_EDITOR);
+    gchar* editor_with_filename = g_strdup_printf("%s %s", editor, filename);
+    gchar** editor_argv = g_strsplit(editor_with_filename, " ", 0);
+
+    g_free(editor_with_filename);
 
     // Fork / exec
     pid_t pid = fork();
     if (pid == 0) {
-        int x = execlp(editor, editor, filename, (char*)NULL);
+        int x = execvp(editor_argv[0], editor_argv);
+        g_strfreev(editor_argv);
         if (x == -1) {
             log_error("[Editor] Failed to exec %s", editor);
         }
='#n182'>182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229