summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2017-05-31 15:49:51 +0300
committerSergey Poznyakoff <gray@gnu.org>2017-05-31 15:49:51 +0300
commit383272e0d513559fbda73ebc9a485718e4184018 (patch)
tree31d4942302c99b46015c92fbed90a1e19905e0fe
parent82c5c521e859246cc12c5f8d63fabd5b013d3487 (diff)
downloadmailutils-383272e0d513559fbda73ebc9a485718e4184018.tar.gz
mailutils-383272e0d513559fbda73ebc9a485718e4184018.tar.bz2
Fix whatnow edit command
In whatnow shell, edit [program [parameters]] now calls program with supplied parameters plus the name of the file to edit. * mh/mh.h (mh_whatnow_env) <reedit>: New member. * mh/mh_whatnow.c (edit): Rewrite. * mh/whatnow.c (main): Properly handle argv[1] * NEWS: Update.
-rw-r--r--NEWS8
-rw-r--r--mh/mh.h1
-rw-r--r--mh/mh_whatnow.c49
-rw-r--r--mh/whatnow.c2
4 files changed, 54 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index a108d094f..99e8b35bb 100644
--- a/NEWS
+++ b/NEWS
@@ -149,6 +149,14 @@ Added support for priority and regex functions.
Debugging considerably improved.
+* MH suite
+
+** Added support for Local-Mailbox profile setting
+
+** Fix whatnow edit command
+
+** Fix bug in comp, forw, and repl: Draft-Folder setting was ignored
+
Version 3.2 - 2017-03-11
diff --git a/mh/mh.h b/mh/mh.h
index 65921e37d..9190ae919 100644
--- a/mh/mh.h
+++ b/mh/mh.h
@@ -216,6 +216,7 @@ struct mh_whatnow_env /* whatnow shell environment */
mu_list_t anno_list; /* List of messages (mu_message_t) to annotate */
mu_mailbox_t mbox;
int nowhatnowproc;
+ int reedit:1; /* Set if the editor was already invoked */
};
#define DISP_QUIT 0
diff --git a/mh/mh_whatnow.c b/mh/mh_whatnow.c
index c4fbe1cb6..f75df71f3 100644
--- a/mh/mh_whatnow.c
+++ b/mh/mh_whatnow.c
@@ -380,13 +380,52 @@ display (struct mh_whatnow_env *wh, int argc, char **argv, int *status)
/* Edit action */
static int
-edit (struct mh_whatnow_env *wh, int argc, char **argv, int *status)
+edit (struct mh_whatnow_env *wh, int argc, char **argv, int *whs)
{
- char *name;
+ char const *ed;
+ int i, rc, status;
+ char **xargv;
+
+ if (wh->reedit)
+ {
+ if (argc > 1)
+ ed = argv[1];
+ else
+ {
+ char *name;
+ char const *newed;
+ mu_asprintf (&name, "%s-next", wh->editor);
+ newed = mh_global_profile_get (name, NULL);
+ free (name);
+ if (newed)
+ ed = newed;
+ }
+ }
+ else if (argc > 1)
+ ed = argv[1];
+ else
+ ed = wh->editor;
+
+ xargv = mu_calloc (argc+2, sizeof (*xargv));
+ xargv[0] = (char *)ed;
+ for (i = 1; i + 1 < argc; i++)
+ xargv[i] = argv[i+1];
+ xargv[i++] = wh->file;
+ xargv[i] = NULL;
+
+ rc = mu_spawnvp (xargv[0], xargv, &status);
+ free (xargv);
+
+ if (rc || check_exit_status (ed, status))
+ {
+ if (wh->file)
+ mu_error (_("problems with edit--%s preserved"), wh->file);
+ else
+ mu_error (_("problems with edit"));
+ }
- mu_asprintf (&name, "%s-next", wh->editor);
- invoke (name, wh->editor, argc, argv, wh->file, NULL);
- free (name);
+ wh->editor = ed;
+ wh->reedit = 1;
return 0;
}
diff --git a/mh/whatnow.c b/mh/whatnow.c
index 32b619835..7a0596c4d 100644
--- a/mh/whatnow.c
+++ b/mh/whatnow.c
@@ -57,7 +57,7 @@ main (int argc, char **argv)
mh_whatnow_env_from_environ_late (&wh_env);
if (argc)
- wh_env.draftfile = argv[0];
+ wh_env.file = argv[0];
else if (draftfolder)
{
if (mh_draft_message (draftfolder, draftmessage, &wh_env.file))

Return to:

Send suggestions and report system problems to the System administrator.