From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 93F4C6DE0F98 for ; Tue, 19 Mar 2019 09:42:02 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.321 X-Spam-Level: X-Spam-Status: No, score=0.321 tagged_above=-999 required=5 tests=[AWL=-0.332, DKIMWL_WL_MED=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_NEUTRAL=0.652, UNPARSEABLE_RELAY=0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x1unue8Xhzx2 for ; Tue, 19 Mar 2019 09:42:01 -0700 (PDT) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by arlo.cworth.org (Postfix) with ESMTPS id 2A2AF6DE0F92 for ; Tue, 19 Mar 2019 09:42:01 -0700 (PDT) Received: by mail-wm1-f47.google.com with SMTP id e74so17532905wmg.3 for ; Tue, 19 Mar 2019 09:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dme-org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=DXuL0c/z5bCb1DU8fOx1aXuLZyhn8L8tl/iZNKZg7XM=; b=sj8qq436TTlY5szHiDhyrVAlYSHBhk4e/RLG25uVfRu1LgHdL30Mx5AbeNdqo5fREb Z2trTWq6HhOG5XgDz+yYG5vEd6DLdCkFFZbjCOLsRqvPgpJi0zz03VTF3jEr+ju+tPPf gHUmCrGcz9oVD6hHCT8NH9sPsBYrmgGQ3qdXNY/BydOWwlEst/TltuoZTtFY8t/fcCjf tpm5qXwrvgMe7+DUD2QcihpaGFs7/5VevOJpfbiWQY26XKfb0CAVNuYYNSgD21HTI/0l lX+2pVh4hnX7Hfy0/BgnAQuyZ57gk27j0026dyopoChQ74JahQne++ZX9Ynww77rMSyq BDag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DXuL0c/z5bCb1DU8fOx1aXuLZyhn8L8tl/iZNKZg7XM=; b=jFgXp2HLazv8kKJvFSkrUZYR1JoUUHc2+MAIpZq709YhOa/taXJKUX+AHA+L7ExI+N kKGJ1EGHKFUsMOjkw5vGvlIG2vSVqHYZEJ9P5JYT1qfNaoLxqSg89190aHF8/tS8uZ4w PkIK1VykGIateckUQ76wxqX7zO9621y0jA1ElK2hy+Fe7Z6EkhrpjCJMI86ZraZEB0V+ taR8seoJKciDdCsvAVJX/ajrO8duISXwX/Z8xKVsNQqU0cJPUpIxAznrpD9z0p+ndF4d +EWpjVQ6GXBRSruaKQhhHxCxTkBEgusjUA48DTM80nWgxiSPa0R+q8+93Qi9SWasZLnn G2kQ== X-Gm-Message-State: APjAAAXhV+jth+FTigDo1BbgG0aq7+1oed3kIEKRg442QgAfgfBlcSnp W/hYYgnD3u2Zuq9ueyiDKvVA6u3Kufw= X-Google-Smtp-Source: APXvYqy8Juae64Zz1ry3s9Zsz66hyfPAXwGrDmIQPkcHVNQAkbwgRIBUb+E9Kb0lQu4nQT9eSwHFoA== X-Received: by 2002:a1c:9e89:: with SMTP id h131mr4052543wme.41.1553013717727; Tue, 19 Mar 2019 09:41:57 -0700 (PDT) Received: from disaster-area.hh.sledj.net (disaster-area.hh.sledj.net. [81.149.164.25]) by smtp.gmail.com with ESMTPSA id u134sm4667323wmf.22.2019.03.19.09.41.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Mar 2019 09:41:56 -0700 (PDT) Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 47051fc4 for ; Tue, 19 Mar 2019 16:41:56 +0000 (UTC) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH v1 1/1] emacs: Add `notmuch-wash-cut-here' Date: Tue, 19 Mar 2019 16:41:56 +0000 Message-Id: <20190319164156.68196-1-dme@dme.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <87a7hrb1fl.fsf@bababa.i-did-not-set--mail-host-address--so-tickle-me> References: <87a7hrb1fl.fsf@bababa.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 16:42:02 -0000 Add `notmuch-wash-cut-here' as a washing function that can be added to `notmuch-show-insert-text/plain-hook' to excerpt 'cut here' sections, such as those generated by `message-mark-inserted-region'. --- emacs/notmuch-wash.el | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el index 54108d93..2ca9c108 100644 --- a/emacs/notmuch-wash.el +++ b/emacs/notmuch-wash.el @@ -426,6 +426,37 @@ for error." ;; +(defcustom notmuch-wash-button-cut/here-hidden-format + "[ %d-line cut here. Click/Enter to show. ]" + "String used to construct button text for hidden 'cut here' sections. +Can use up to one integer format parameter, i.e. %d." + :type 'string + :group 'notmuch-wash) + +(defcustom notmuch-wash-button-cut/here-visible-format + "[ %d-line cut here. Click/Enter to hide. ]" + "String used to construct button text for visible 'cut here' sections. +Can use up to one integer format parameter, i.e. %d." + :type 'string + :group 'notmuch-wash) + +(define-button-type 'notmuch-wash-button-cut/here-toggle-type + 'help-echo "mouse-1, RET: Show original message" + :supertype 'notmuch-wash-button-invisibility-toggle-type) + +(defconst notmuch-wash--cut-here-start (concat "^" message-mark-insert-begin)) +(defconst notmuch-wash--cut-here-end (concat "^" message-mark-insert-end)) + +(defun notmuch-wash-cut-here (msg depth) + "Excerpt 'cut here' sections, hiding them by default." + (goto-char (point-min)) + (while (re-search-forward notmuch-wash--cut-here-start nil t) + (let ((start (match-beginning 0))) + (when (re-search-forward notmuch-wash--cut-here-end nil t) + (notmuch-wash-region-to-button msg start (point) "cut/here"))))) + +;; + (provide 'notmuch-wash) ;;; notmuch-wash.el ends here -- 2.21.0