mirror of
https://github.com/profanity-im/profanity.git
synced 2024-09-22 19:45:54 -04:00
Merge pull request #1801 from alexandre1985/editor-with-arguments
Editor executable support flags
This commit is contained in:
commit
f2c83fa8ce
@ -2523,6 +2523,7 @@ static const struct cmd_t command_defs[] = {
|
|||||||
"/executable urlopen default",
|
"/executable urlopen default",
|
||||||
"/executable urlsave set <cmdtemplate>",
|
"/executable urlsave set <cmdtemplate>",
|
||||||
"/executable urlsave default",
|
"/executable urlsave default",
|
||||||
|
"/executable editor set <cmdtemplate>",
|
||||||
"/executable vcard_photo set <cmdtemplate>",
|
"/executable vcard_photo set <cmdtemplate>",
|
||||||
"/executable vcard_photo default")
|
"/executable vcard_photo default")
|
||||||
CMD_DESC(
|
CMD_DESC(
|
||||||
@ -2545,7 +2546,7 @@ static const struct cmd_t command_defs[] = {
|
|||||||
"/executable urlsave set \"curl %u -o %p\"",
|
"/executable urlsave set \"curl %u -o %p\"",
|
||||||
"/executable urlsave default",
|
"/executable urlsave default",
|
||||||
"/executable vcard_photo set \"feh %p\"",
|
"/executable vcard_photo set \"feh %p\"",
|
||||||
"/executable editor set vim")
|
"/executable editor set \"emacsclient -t\"")
|
||||||
},
|
},
|
||||||
|
|
||||||
{ CMD_PREAMBLE("/url",
|
{ CMD_PREAMBLE("/url",
|
||||||
|
@ -88,11 +88,16 @@ get_message_from_editor(gchar* message, gchar** returned_message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char* editor = prefs_get_string(PREF_COMPOSE_EDITOR);
|
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
|
// Fork / exec
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
if (pid == 0) {
|
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) {
|
if (x == -1) {
|
||||||
log_error("[Editor] Failed to exec %s", editor);
|
log_error("[Editor] Failed to exec %s", editor);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user