Skip to content

Instantly share code, notes, and snippets.

@nueh
Created May 1, 2016 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nueh/eb301c62388e531be3d3445b0ee9dbc3 to your computer and use it in GitHub Desktop.
Save nueh/eb301c62388e531be3d3445b0ee9dbc3 to your computer and use it in GitHub Desktop.
diff -udprP mutt-1.6.0.orig/handler.c mutt-1.6.0/handler.c
--- mutt-1.6.0.orig/handler.c 2016-04-02 21:12:22.000000000 +0300
+++ mutt-1.6.0/handler.c 2016-04-06 20:24:25.000000000 +0300
@@ -1581,7 +1581,31 @@ static int text_plain_handler (BODY *b,
buf[--l] = 0;
}
if (s->prefix)
- state_puts (s->prefix, s);
+ {
+ int i;
+ char qbuf[2 * LONG_STRING];
+ int j = 0, offset = 0;
+ regmatch_t pmatch[1];
+
+ while (regexec ((regex_t *) QuoteRegexp.rx, &buf[offset], 1, pmatch, 0) == 0)
+ offset += pmatch->rm_eo;
+
+ if (!option (OPTQUOTEEMPTY) && !*buf)
+ strcpy (qbuf, buf);
+ else if (option (OPTQUOTEQUOTED) && offset)
+ {
+ for (i = 0; i < offset; i++)
+ if (buf[i] != ' ')
+ j = i;
+ strncpy (qbuf, buf, j + 1);
+ strcpy (qbuf + j + 1, buf + j);
+ }
+ else
+ snprintf (qbuf, sizeof (qbuf), "%s%s", NONULL(s->prefix), buf);
+
+ state_puts (qbuf, s);
+ }
+ else
state_puts (buf, s);
state_putc ('\n', s);
}
@@ -1737,7 +1761,7 @@ int mutt_body_handler (BODY *b, STATE *s
*/
if ((WithCrypto & APPLICATION_PGP) && mutt_is_application_pgp (b))
handler = crypt_pgp_application_pgp_handler;
- else if (option(OPTREFLOWTEXT) && ascii_strcasecmp ("flowed", mutt_get_parameter ("format", b->parameter)) == 0)
+ else if (option(OPTREFLOWTEXT) && ascii_strcasecmp ("flowed", mutt_get_parameter ("format", b->parameter)) == 0 && !s->prefix)
handler = rfc3676_handler;
else
handler = text_plain_handler;
diff -udprP mutt-1.6.0.orig/init.h mutt-1.6.0/init.h
--- mutt-1.6.0.orig/init.h 2016-04-02 21:12:22.000000000 +0300
+++ mutt-1.6.0/init.h 2016-04-06 20:24:25.000000000 +0300
@@ -2327,6 +2327,19 @@ struct option_t MuttVars[] = {
** have no effect, and if it is set to \fIask-yes\fP or \fIask-no\fP, you are
** prompted for confirmation when you try to quit.
*/
+ { "quote_empty", DT_BOOL, R_NONE, OPTQUOTEEMPTY, 1 },
+ /*
+ ** .pp
+ ** Controls whether or not empty lines will be quoted using
+ ** ``$indent_string''.
+ */
+ { "quote_quoted", DT_BOOL, R_NONE, OPTQUOTEQUOTED, 0 },
+ /*
+ ** .pp
+ ** Controls how quoted lines will be quoted. If set, one quote
+ ** character will be added to the end of existing prefix. Otherwise,
+ ** quoted lines will be prepended by ``$indent_string''.
+ */
{ "quote_regexp", DT_RX, R_PAGER, UL &QuoteRegexp, UL "^([ \t]*[|>:}#])+" },
/*
** .pp
diff -udprP mutt-1.6.0.orig/mutt.h mutt-1.6.0/mutt.h
--- mutt-1.6.0.orig/mutt.h 2016-04-02 21:12:22.000000000 +0300
+++ mutt-1.6.0/mutt.h 2016-04-06 20:24:25.000000000 +0300
@@ -413,6 +413,8 @@ enum
OPTPRINTDECODE,
OPTPRINTSPLIT,
OPTPROMPTAFTER,
+ OPTQUOTEEMPTY,
+ OPTQUOTEQUOTED,
OPTREADONLY,
OPTREFLOWSPACEQUOTES,
OPTREFLOWTEXT,
diff -udprP mutt-1.6.0.orig/PATCHES mutt-1.6.0/PATCHES
--- mutt-1.6.0.orig/PATCHES 2016-04-02 21:12:22.000000000 +0300
+++ mutt-1.6.0/PATCHES 2016-04-06 20:24:25.000000000 +0300
@@ -0,0 +1 @@
+vvv.quote
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment