From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id eAhmCkLDbmNB5gAAbAwnHQ (envelope-from ) for ; Fri, 11 Nov 2022 22:48:50 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id uJusCULDbmOOEQEAG6o9tA (envelope-from ) for ; Fri, 11 Nov 2022 22:48:50 +0100 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B58F112BE7 for ; Fri, 11 Nov 2022 22:48:49 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 060A95FA27; Fri, 11 Nov 2022 21:48:46 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 6DFFD5F963 for ; Fri, 11 Nov 2022 21:48:43 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 8FA435FBC0; Fri, 11 Nov 2022 16:48:42 -0500 (EST) Received: (nullmailer pid 46736 invoked by uid 1000); Fri, 11 Nov 2022 21:48:37 -0000 From: David Bremner To: Tomi Ollila , David Bremner , notmuch@notmuchmail.org Subject: [PATCH 1/3] emacs/show: use plist to pass message info to n-s-insert-headerline Date: Fri, 11 Nov 2022 16:48:29 -0500 Message-Id: <20221111214831.46716-1-david@tethera.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Message-ID-Hash: EZUMIZ4HU2T4JVD3IDORABYQHUQSOCPY X-Message-ID-Hash: EZUMIZ4HU2T4JVD3IDORABYQHUQSOCPY X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1668203329; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=Ma3ZDv2t/jwaD544kwEsLABNmI+mDWWsSX4Z1VDJqaQ=; b=mZQZ2cW8ekX8D+1twEVj7J4VF/z8995L+cMLzYGP5E6hSJd54vSMLlucqkErxi2NO6iCQM LDFfudzl6RMOzJb7GDpJFpf6GVUGTE7yDFE/eGE3q6euK8aw8RktiyU3ti7r0wj3mmikQV 9GROGP6GoJxn15W2KoDV1x0Zs23Z/HPnRyhOB/JZxhnXWQYvx05WstmylpV4ZQEkrDrmcV YNEXQkQ6qO5Km07AWCXlZX4LSy+9Tx4RZE+SqqAF6U/5Wy60SGzM0Hduu1DjIj0OxO7bx1 wJNZSN2bxuR1ZhjkZb48V4FGt4+cB78Hw8ZJESJMBwBTSMnjKMOvhQv7vGI75g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1668203329; a=rsa-sha256; cv=none; b=UmDaJYG0DkWo2lGuUFgu9HkoeqggxK0EtCKKl0y1l5XLtO0PkDY/xcnPN3yvnC5NA12iwf Xi/czSSxTTVCWaKfbK2T8iQL3IXeTugHLLqRyFKiF5SJhe6UpA8rxYC9hcTiwI+u6YNAGn wdB69/R//E2wvhhNHign+ABiLChrpQs5YsuabRsv2BA9OPOZDiwSUBlcck7hgzEmAEz+Ci PiovnXsueCN4uIrq9WIrxiZdceZ6v/mBMfYAaHjLbDDqMGVTtiRyl9KuHv6yBdAnn5NOgm QhObJoVzWlFQkebdWiIO0Xo/FcpZVefWVDqatJ0DZG7UW49zOK75UdBQgAwsjg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.28 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: B58F112BE7 X-Spam-Score: -1.28 X-Migadu-Scanner: scn0.migadu.com X-TUID: oFRhpEpog28Z This should allow calling notmuch-show-insert-headerline from other places without duplicating the set of plist accesses. --- emacs/notmuch-show.el | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index ec998ede..b7a8de6a 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -530,11 +530,18 @@ Return unchanged ADDRESS if parsing fails." (plist-put msg :height height) height)))) -(defun notmuch-show-insert-headerline (headers date tags depth duplicate file-count) +(defun notmuch-show-insert-headerline (msg-plist depth tags) "Insert a notmuch style headerline based on HEADERS for a message at DEPTH in the current thread." - (let ((start (point)) - (from (notmuch-sanitize + (let* ((start (point)) + (headers (plist-get msg-plist :headers)) + (duplicate (or (plist-get msg-plist :duplicate) 0)) + (file-count (length (plist-get msg-plist :filename))) + (date (or (and notmuch-show-relative-dates + (plist-get msg-plist :date_relative)) + (plist-get headers :Date))) + (duplicate (or (plist-get msg-plist :duplicate) 0)) + (from (notmuch-sanitize (notmuch-show-clean-address (plist-get headers :From))))) (when (string-match "\\cR" from) ;; If the From header has a right-to-left character add @@ -1171,8 +1178,6 @@ is out of range." (defun notmuch-show-insert-msg (msg depth) "Insert the message MSG at depth DEPTH in the current thread." (let* ((headers (plist-get msg :headers)) - (duplicate (or (plist-get msg :duplicate) 0)) - (files (length (plist-get msg :filename))) ;; Indentation causes the buffer offset of the start/end ;; points to move, so we must use markers. message-start message-end @@ -1180,11 +1185,7 @@ is out of range." headers-start headers-end (bare-subject (notmuch-show-strip-re (plist-get headers :Subject)))) (setq message-start (point-marker)) - (notmuch-show-insert-headerline headers - (or (and notmuch-show-relative-dates - (plist-get msg :date_relative)) - (plist-get headers :Date)) - (plist-get msg :tags) depth duplicate files) + (notmuch-show-insert-headerline msg depth (plist-get msg :tags)) (setq content-start (point-marker)) ;; Set `headers-start' to point after the 'Subject:' header to be ;; compatible with the existing implementation. This just sets it -- 2.35.1