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 cAj4IG8J+1/idgAA0tVLHw (envelope-from ) for ; Sun, 10 Jan 2021 14:04: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 WBemHG8J+18lRAAAbx9fmQ (envelope-from ) for ; Sun, 10 Jan 2021 14:04:31 +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 DF352940416 for ; Sun, 10 Jan 2021 14:04:30 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 32DF82BF6B; Sun, 10 Jan 2021 09:02:18 -0500 (EST) Received: from mail.hostpark.net (mail.hostpark.net [212.243.197.30]) by mail.notmuchmail.org (Postfix) with ESMTPS id AB4A929CF2 for ; Sun, 10 Jan 2021 09:01:18 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id A8698166C1 for ; Sun, 10 Jan 2021 15:01:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=sel2011a; t=1610287274; bh=C3adlDSAkN5lSaI nku9axurqklC/NOHqZ3stFqkvknc=; b=cWyL3FP2uSjM4q06lf0P6DMgwQvcE6v t7yMN1RjPi3Ej+fTgTzwUllGGPWod+jFGRVITpvIUF44rDz+tKwty/y90PwhCOnh Upitka+td4FAZvOO9iARpOVjv1ND0SPyp0SlOU76kcuFu7EwRMhvzI1vpZ+9jr1A FSU+IHxOK2E0= 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 10224) with ESMTP id sePFE5LfQgCY for ; Sun, 10 Jan 2021 15:01:14 +0100 (CET) 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 6F00416634 for ; Sun, 10 Jan 2021 15:01:14 +0100 (CET) From: Jonas Bernoulli To: notmuch@notmuchmail.org Subject: [PATCH v2 31/36] emacs: improve how cl-lib and pcase are required Date: Sun, 10 Jan 2021 15:01:07 +0100 Message-Id: <20210110140112.25930-32-jonas@bernoul.li> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20210110140112.25930-1-jonas@bernoul.li> References: <20201214162401.19569-1-jonas@bernoul.li> <20210110140112.25930-1-jonas@bernoul.li> MIME-Version: 1.0 Message-ID-Hash: OY5JESOWFMLGXZULC6FY3P4ZNGPVAVSE X-Message-ID-Hash: OY5JESOWFMLGXZULC6FY3P4ZNGPVAVSE 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-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 0.06 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=bernoul.li header.s=sel2011a header.b=cWyL3FP2; 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-Migadu-Queue-Id: DF352940416 X-Spam-Score: 0.06 X-Migadu-Scanner: scn1.migadu.com X-TUID: ogamXSYn1PMn We need to load `cl-lib' at run-time because we use more from it than just macros. Never-the-less many, but not all libraries required it only at compile-time, which we got away with because at least some libraries already required it at run-time as well. We use `cl-lib' and (currently to a lesser extend) `pcase' throughout the code-base, which means that we should require these features in most libraries. In the past we tried to only require these features in just the libraries that actually need them, without fully succeeding. We did not succeed in doing so because that means we would have to check every time that we use a function from these features whether they are already being required in the current library. An alternative would be to add the `require' forms at the top of every library but that is a bit annoying too. In order to make sure that these features are loaded when needed but also to keep the noise down we only require them in "notmuch-lib.el", which most other libraries require, and in most of the few libraries that do not do so, namely "notmuch-draft.el", "notmuch-message.el" and "notmuch-parser.el". ("coolj.el", "make-deps.el", various generated libraries, and "notmuch-compat.el" are left touched.) --- emacs/notmuch-address.el | 2 -- emacs/notmuch-company.el | 2 -- emacs/notmuch-draft.el | 3 +++ emacs/notmuch-hello.el | 1 - emacs/notmuch-jump.el | 4 ---- emacs/notmuch-lib.el | 1 + emacs/notmuch-maildir-fcc.el | 2 -- emacs/notmuch-message.el | 3 +++ emacs/notmuch-mua.el | 2 -- emacs/notmuch-parser.el | 3 ++- emacs/notmuch-show.el | 4 ---- emacs/notmuch-tag.el | 4 ---- emacs/notmuch-tree.el | 2 -- emacs/notmuch.el | 2 -- 14 files changed, 9 insertions(+), 26 deletions(-) diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el index f313c415..ca24c744 100644 --- a/emacs/notmuch-address.el +++ b/emacs/notmuch-address.el @@ -21,8 +21,6 @@ ;;; Code: -(eval-when-compile (require 'cl-lib)) - (require 'message) (require 'notmuch-parser) (require 'notmuch-lib) diff --git a/emacs/notmuch-company.el b/emacs/notmuch-company.el index 4439cc15..c6a004ae 100644 --- a/emacs/notmuch-company.el +++ b/emacs/notmuch-company.el @@ -32,8 +32,6 @@ ;;; Code: -(eval-when-compile (require 'cl-lib)) - (require 'notmuch-lib) (defvar-local notmuch-company-last-prefix nil) diff --git a/emacs/notmuch-draft.el b/emacs/notmuch-draft.el index bc688434..2939da55 100644 --- a/emacs/notmuch-draft.el +++ b/emacs/notmuch-draft.el @@ -25,6 +25,9 @@ ;;; Code: +(require 'cl-lib) +(require 'pcase) + (require 'notmuch-maildir-fcc) (require 'notmuch-tag) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 186ac172..24d2d19e 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -21,7 +21,6 @@ ;;; Code: -(require 'cl-lib) (require 'widget) (require 'wid-edit) ; For `widget-forward'. diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el index 34d6c796..6fab5a79 100644 --- a/emacs/notmuch-jump.el +++ b/emacs/notmuch-jump.el @@ -22,10 +22,6 @@ ;;; Code: -(eval-when-compile - (require 'cl-lib) - (require 'pcase)) - (require 'notmuch-lib) (require 'notmuch-hello) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index cbac8859..6130309a 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -22,6 +22,7 @@ ;;; Code: (require 'cl-lib) +(require 'pcase) (require 'mm-util) (require 'mm-view) diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el index 63e5514c..374765b7 100644 --- a/emacs/notmuch-maildir-fcc.el +++ b/emacs/notmuch-maildir-fcc.el @@ -21,8 +21,6 @@ ;;; Code: -(eval-when-compile (require 'cl-lib)) - (require 'message) (require 'notmuch-lib) diff --git a/emacs/notmuch-message.el b/emacs/notmuch-message.el index abeff53a..b90c934a 100644 --- a/emacs/notmuch-message.el +++ b/emacs/notmuch-message.el @@ -21,6 +21,9 @@ ;;; Code: +(require 'cl-lib) +(require 'pcase) + (require 'message) (require 'notmuch-tag) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 2e4dc71a..c5b1b482 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -21,8 +21,6 @@ ;;; Code: -(eval-when-compile (require 'cl-lib)) - (require 'message) (require 'mm-view) (require 'format-spec) diff --git a/emacs/notmuch-parser.el b/emacs/notmuch-parser.el index 294e0544..9749a6be 100644 --- a/emacs/notmuch-parser.el +++ b/emacs/notmuch-parser.el @@ -21,7 +21,8 @@ ;;; Code: -(eval-when-compile (require 'cl-lib)) +(require 'cl-lib) +(require 'pcase) (defun notmuch-sexp-create-parser () "Return a new streaming S-expression parser. diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 27925669..ea4444e5 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -23,10 +23,6 @@ ;;; Code: -(eval-when-compile - (require 'cl-lib) - (require 'pcase)) - (require 'mm-view) (require 'message) (require 'mm-decode) diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index 3c958dd4..982b372c 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -23,10 +23,6 @@ ;;; Code: -(require 'cl-lib) -(eval-when-compile - (require 'pcase)) - (require 'crm) (require 'notmuch-lib) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 51a43edd..95d5f642 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -24,8 +24,6 @@ ;;; Code: -(eval-when-compile (require 'cl-lib)) - (require 'mail-parse) (require 'notmuch-lib) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 3436e1fc..d2e87b1b 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -65,8 +65,6 @@ ;;; Code: -(eval-when-compile (require 'cl-lib)) - (require 'mm-view) (require 'message) -- 2.29.1