Github messages for mblaze
 help / color / mirror / Atom feed
From: thyssentishman <thyssentishman@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] mcolor: Add coloring support for diffs
Date: Thu, 05 Oct 2023 15:59:51 +0200	[thread overview]
Message-ID: <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-249@inbox.vuxu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 701 bytes --]

There is a new pull request by thyssentishman against master on the mblaze repository

https://github.com/thyssentishman/mblaze master
https://github.com/leahneukirchen/mblaze/pull/249

mcolor: Add coloring support for diffs
Add coloring for diffs sent as part of the email body. This adds support for the following three ENV variables:

- **MCOLOR_DIFF_I**: For (I)nserted lines.
- **MCOLOR_DIFF_D**: For (D)eleted lines
- **MCOLOR_DIFF_R**: For file (R)anges

Since the default theme is quite bright, these default to bright colors as well (Green1, Red1 and Yellow1 from the 256 XTerm colors respectively).

A patch file from https://github.com/leahneukirchen/mblaze/pull/249.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-249.patch --]
[-- Type: text/x-diff, Size: 1256 bytes --]

From 8dca80032e6fab9d2e656d8980a805c9e44abbeb Mon Sep 17 00:00:00 2001
From: Johannes Thyssen Tishman <johannes@thyssentishman.com>
Date: Thu, 5 Oct 2023 15:39:46 +0200
Subject: [PATCH] mcolor: Add coloring support for diffs

---
 mcolor | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mcolor b/mcolor
index ba2c42c..9fff0c0 100755
--- a/mcolor
+++ b/mcolor
@@ -10,12 +10,16 @@ no_color { print; next }
 /^\014$/ { nextmail = 1; print(fg(co("FF",232), $0)); next }
 /^$/ { hdr = 0 }
 /^-- $/ { ftr = 1 }
-/^--- .* ---/ { print fg(co("SEP",242), $0); ftr = 0; sig = 0; next }
+/^diff -/ { diff = 1 }
+/^--- .* ---/ { print fg(co("SEP",242), $0); ftr = 0; diff = 0; sig = 0; next }
 /^-----BEGIN .* SIGNATURE-----/ { sig = 1 }
 nextmail && /^From:/ { hdr = 1 }
 hdr && /^From:/ { print so(fg(co("FROM",119), $0)); next }
 hdr { print fg(co("HEADER",120), $0); next }
 ftr { print fg(co("FOOTER",244), $0); next }
+diff && /^-/ { print fg(co("DIFF_D",196), $0); next }
+diff && /^\+/ { print fg(co("DIFF_I",46), $0); next }
+diff && /^@/ { print fg(co("DIFF_R",226), $0); next }
 /^-----BEGIN .* MESSAGE-----/ ||
 /^-----END .* SIGNATURE-----/ { print fg(co("SIG",244), $0); sig = 0; next }
 sig { print fg(co("SIG",244), $0); next }

             reply	other threads:[~2023-10-05 13:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05 13:59 thyssentishman [this message]
2023-10-05 14:33 ` leahneukirchen
2023-10-05 14:36 ` leahneukirchen
2023-10-05 14:38 ` leahneukirchen
2023-10-05 15:24 ` [PR PATCH] [Updated] " thyssentishman
2023-10-05 15:24 ` thyssentishman
2023-10-05 15:34 ` leahneukirchen
2023-10-05 15:40 ` [PR PATCH] [Updated] " thyssentishman
2023-10-05 15:43 ` thyssentishman
2023-10-05 15:43 ` [PR PATCH] [Closed]: " leahneukirchen
2023-10-05 15:44 ` thyssentishman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-249@inbox.vuxu.org \
    --to=thyssentishman@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).