From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id CD4bA+vxHl9cAQAA0tVLHw (envelope-from ) for ; Mon, 27 Jul 2020 15:25:31 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id +CZvOurxHl9zLwAAbx9fmQ (envelope-from ) for ; Mon, 27 Jul 2020 15:25:30 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 15144940223 for ; Mon, 27 Jul 2020 15:25:30 +0000 (UTC) Received: from [144.217.243.247] (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id C117F27D35; Mon, 27 Jul 2020 11:25:11 -0400 (EDT) Received: from mail.hostpark.net (mail.hostpark.net [212.243.197.30]) by mail.notmuchmail.org (Postfix) with ESMTPS id 9E5A51FA17 for ; Mon, 27 Jul 2020 11:25:07 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 8FE91165CB for ; Mon, 27 Jul 2020 17:25:04 +0200 (CEST) X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10124) with ESMTP id 4VZVcnIXirhQ for ; Mon, 27 Jul 2020 17:25:04 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 6281A165D6 for ; Mon, 27 Jul 2020 17:25:04 +0200 (CEST) From: Jonas Bernoulli To: notmuch@notmuchmail.org Subject: [PATCH v3 3/4] test: Remove misguided emacs testing utilities Date: Mon, 27 Jul 2020 17:25:02 +0200 Message-Id: <20200727152503.15939-4-jonas@bernoul.li> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200727152503.15939-1-jonas@bernoul.li> References: <20200724180924.21944-1-jonas@bernoul.li> <20200727152503.15939-1-jonas@bernoul.li> MIME-Version: 1.0 Message-ID-Hash: S2VSMFWNO4SCGSLY4VM3DDTANSRURMLR X-Message-ID-Hash: S2VSMFWNO4SCGSLY4VM3DDTANSRURMLR X-MailFrom: jonas@bernoul.li 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; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: 0.03 X-TUID: bQAMnG28rgkS The goal of this abstraction was to save space. But that failed as the result actually was that four trivial lines got replace with 15 fairly complicated lines. The opposite of what it was supposed to do. Also it made it harder to come up with the fix in the previous commit; simply grepping for the relevant symbols did not work because they get constructed at run-time instead of appearing in the source file. --- test/test-lib.el | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/test/test-lib.el b/test/test-lib.el index 15271b02..aae9e833 100644 --- a/test/test-lib.el +++ b/test/test-lib.el @@ -104,26 +104,15 @@ (defun orphan-watchdog (pid) "Initiate orphan watchdog check." (run-at-time 60 60 'orphan-watchdog-check pid)) -(defun hook-counter (hook) - "Count how many times a hook is called. Increments -`hook'-counter variable value if it is bound, otherwise does -nothing." - (let ((counter (intern (concat (symbol-name hook) "-counter")))) - (if (boundp counter) - (set counter (1+ (symbol-value counter)))))) - -(defun add-hook-counter (hook) - "Add hook to count how many times `hook' is called." - (add-hook hook (apply-partially 'hook-counter hook))) - -(add-hook-counter 'notmuch-hello-mode-hook) -(add-hook-counter 'notmuch-hello-refresh-hook) - (defvar notmuch-hello-mode-hook-counter -100 "Tests that care about this counter must let-bind it to 0.") +(add-hook 'notmuch-hello-mode-hook + (lambda () (cl-incf notmuch-hello-mode-hook-counter))) (defvar notmuch-hello-refresh-hook-counter -100 "Tests that care about this counter must let-bind it to 0.") +(add-hook 'notmuch-hello-refresh-hook + (lambda () (cl-incf notmuch-hello-refresh-hook-counter))) (defadvice notmuch-search-process-filter (around pessimal activate disable) "Feed notmuch-search-process-filter one character at a time." -- 2.26.0