From 35871c47c9c3d174ec34c3aabe5f240288cb99e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= <georges.duperon@gmail.com>
Date: Mon, 15 May 2017 22:05:06 +0200
Subject: [PATCH] Correctly handle added / kept elements within removed
 elements, for @hlite.

---
 diff1.rkt | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/diff1.rkt b/diff1.rkt
index cf28a781..ee081489 100644
--- a/diff1.rkt
+++ b/diff1.rkt
@@ -233,9 +233,18 @@
                      (loop2 #f
                             (cdr guide)
                             (cdr body)
-                            (if (eq? mode '-)
-                                acc
-                                (cons (loop mode (car guide) (car body)) acc)))]
+                            (cond
+                              [(and (eq? mode '-)
+                                    (or (pair? (car body))
+                                        (and (syntax (car body))
+                                             (pair? (syntax-e (car body))))))
+                               (let ([r (loop mode (car guide) (car body))])
+                                 (append (if (syntax? r) (syntax->list r) r)
+                                         acc))]
+                              [(eq? mode '-)
+                               acc]
+                              [else
+                               (cons (loop mode (car guide) (car body)) acc)]))]
                     ;; If body is not a pair, then we will treat it as an
                     ;; "improper tail" element, unless it is null?
                     [(null? body)