From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:aacc::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id kKIaNUDpu2AFdwAAsNZ9tg (envelope-from ); Sat, 05 Jun 2021 21:14:40 +0000 Received: from out2.migadu.com ([2001:41d0:2:aacc::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id aJ0VNTzpu2DbSQAAbx9fmQ (envelope-from ); Sat, 05 Jun 2021 21:14:36 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1622927676; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3k6Xyv51yeH8nRPGfBJKvcyi67RoPOPkZdb3qArLt7A=; b=bO3t00AzsVqby5JTERqt6vjvaUpwFjJFwm75rczNLpqZ1hEOa7yV9CPGNeEzU3wCMkbBdp I+6xVrIq+vV9zUDTUpDOWIeOgJ8zgcms0yH5namCxZUGylj0+ljaiCNdE2XeXYpQCqURCM bQJcCaATx17g2RJ10kSRAMy9Lblr0Y2esCJOhD6xW7evQMbz0PTXf5sf5Vnckx7K/M1SFB uREQmw32rDXo2y13KndxIHae3YabbeTvLqCC8bJAnlJT3PQ6Du1n4cX2gLbWAYhHc4bVGm VEP+WGGVFFK+a+fAMGVHj26gvDyLJcgfggaqrD7JzvHxyYF2NZtiVR16ySmcKQ== From: Kyle Meyer To: piem@inbox.kyleam.com Subject: [PATCH 09/18] piem-lei-query-thread: Drop repeated subjects Date: Sat, 5 Jun 2021 17:13:53 -0400 Message-Id: <20210605211402.20304-10-kyle@kyleam.com> In-Reply-To: <20210605211402.20304-1-kyle@kyleam.com> References: <20210605211402.20304-1-kyle@kyleam.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com X-TUID: WALPy/UMKzx9 public-inbox's web interface suppresses a message's subject when it matches the previous lines [*]. Teach piem-lei-query-thread to do the same to make it easier to spot subject shifts and identify subthreads. [*] notmuch-tree-mode does similar, displaying "..." instead. --- piem-lei.el | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/piem-lei.el b/piem-lei.el index 74bf357e..43ab01ee 100644 --- a/piem-lei.el +++ b/piem-lei.el @@ -370,7 +370,7 @@ (defun piem-lei-query-thread (mid) (let* ((records (piem-lei-query--slurp (list "--threads" (concat "m:" mid)))) (msgs (piem-lei-query--thread records)) - depths pt-final) + depths pt-final subject-prev) (with-current-buffer (get-buffer-create "*lei-thread*") (let ((inhibit-read-only t)) (erase-buffer) @@ -384,25 +384,34 @@ (defun piem-lei-query-thread (mid) (setq msgs (append children msgs))) (push (cons msg depth) depths) (if (not (piem-lei-msg-ghost msg)) - (let ((data (cdr (assoc mid-msg records)))) + (let* ((data (cdr (assoc mid-msg records))) + (subject (let ((case-fold-search t)) + (replace-regexp-in-string + (rx string-start "re:" (one-or-more space)) + "" + (string-trim (cdr (assq 's data))))))) (insert (piem-lei-query--format-date data) " " (piem-lei-query--format-thread-marker depth) (let ((from (car (cdr (assq 'f data))))) (propertize (or (car from) (cadr from)) 'font-lock-face 'piem-lei-query-from)) - (concat " " - (propertize (cdr (assq 's data)) - 'font-lock-face - 'piem-lei-query-subject))) + (if (equal subject subject-prev) + "" + (concat " " + (propertize subject + 'font-lock-face + 'piem-lei-query-subject)))) (add-text-properties (line-beginning-position) (line-end-position) - (list 'piem-lei-query-result data))) + (list 'piem-lei-query-result data)) + (setq subject-prev subject)) (insert (make-string 17 ?\s) ; Date alignment. (piem-lei-query--format-thread-marker depth) (propertize (concat " <" mid-msg ">") 'font-lock-face - 'piem-lei-query-thread-ghost))) + 'piem-lei-query-thread-ghost)) + (setq subject-prev nil)) (when (equal mid-msg mid) (setq pt-final (line-beginning-position))) (insert ?\n))) -- 2.31.1