unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jonas Bernoulli <jonas@bernoul.li>
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	[thread overview]
Message-ID: <20210110140112.25930-32-jonas@bernoul.li> (raw)
In-Reply-To: <20210110140112.25930-1-jonas@bernoul.li>

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

  parent reply	other threads:[~2021-01-10 14:04 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 16:23 [PATCH 00/32] [emacs] Add outline headings and switch to lexical scope Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 01/32] emacs: use setq instead of set Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 02/32] emacs: sanitize dedicated widget action/notify functions Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 03/32] emacs: define new notmuch-search-item widget type Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 04/32] emacs: notmuch-start-notmuch: remove backward compatibility code Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 05/32] emacs: notmuch-start-notmuch-error-sentinel: assert buffer is alive Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 06/32] emacs: notmuch-start-notmuch-sentinel: " Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 07/32] emacs: notmuch-start-notmuch: avoid storing process buffer twice Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 08/32] emacs: avoid passing around some redundant information Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 09/32] emacs: avoid killing process buffer when process is still alive Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 10/32] emacs: make headings outline-minor-mode compatible Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 11/32] emacs: use lexical-bindings in all libraries Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 12/32] emacs: deal with unused lexical arguments and variables Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 13/32] emacs: notmuch-tag--get-formats: silence byte-compiler Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 14/32] emacs: inline notmuch-sexp-eof into only caller Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 15/32] emacs: notmuch-wash-region-to-button: remove unused MSG argument Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 16/32] emacs: silence compiler wrt notmuch-show-insert-part-text/plain Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 17/32] emacs: define notmuch-message-queued-tag-changes as buffer-local Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 18/32] emacs: notmuch-message-apply-queued-tag-changes: cosmetics Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 19/32] emacs: notmuch-wash.el: require diff-mode at beginning of code Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 20/32] emacs: notmuch-mua-prompt-for-sender: don't force Ido on users Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 21/32] emacs: notmuch-mua.el: move all options into "Options" section Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 22/32] emacs: notmuch-crypto-status-button-type: fix potential bug Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 23/32] emacs: various cosmetic improvements Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 24/32] emacs: various comment improvements Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 25/32] emacs: various doc-string improvements Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 26/32] emacs: remove variable notmuch-search-disjunctive-regexp Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 27/32] emacs: define a few variables as automatically buffer-local Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 28/32] emacs: notmuch-search-stash-thread-id: use notmuch-search-query-string Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 29/32] emacs: reorder notmuch.el a bit Jonas Bernoulli
2020-12-14 16:23 ` [PATCH 30/32] emacs: avoid unnecessary let-bindings Jonas Bernoulli
2020-12-14 16:24 ` [PATCH 31/32] emacs: use string-empty-p Jonas Bernoulli
2020-12-14 16:24 ` [PATCH 32/32] emacs: notmuch-tree-get-match: No longer define as command Jonas Bernoulli
2020-12-27 10:14 ` [PATCH 00/32] [emacs] Add outline headings and switch to lexical scope Tomi Ollila
2020-12-28 14:08   ` Tomi Ollila
2020-12-30 17:10   ` Jonas Bernoulli
2021-01-10 14:00 ` [PATCH v2 00/36] " Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 01/36] emacs: use setq instead of set Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 02/36] emacs: sanitize dedicated widget action/notify functions Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 03/36] emacs: define new notmuch-search-item widget type Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 04/36] emacs: notmuch-start-notmuch: remove backward compatibility code Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 05/36] emacs: notmuch-start-notmuch-error-sentinel: assert buffer is alive Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 06/36] emacs: notmuch-start-notmuch-sentinel: " Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 07/36] emacs: notmuch-start-notmuch: avoid storing process buffer twice Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 08/36] emacs: avoid passing around some redundant information Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 09/36] emacs: avoid killing process buffer when process is still alive Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 10/36] emacs: make headings outline-minor-mode compatible Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 11/36] emacs: use lexical-bindings in all libraries Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 12/36] emacs: deal with unused lexical arguments and variables Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 13/36] emacs: notmuch-tag--get-formats: silence byte-compiler Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 14/36] emacs: inline notmuch-sexp-eof into only caller Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 15/36] emacs: notmuch-wash-region-to-button: remove unused MSG argument Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 16/36] emacs: silence compiler wrt notmuch-show-insert-part-text/plain Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 17/36] emacs: define notmuch-message-queued-tag-changes as buffer-local Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 18/36] emacs: notmuch-message-apply-queued-tag-changes: cosmetics Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 19/36] emacs: notmuch-wash.el: require diff-mode at beginning of code Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 20/36] emacs: notmuch-mua-prompt-for-sender: don't force Ido on users Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 21/36] emacs: notmuch-mua.el: move all options into "Options" section Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 22/36] emacs: notmuch-crypto-status-button-type: fix potential bug Jonas Bernoulli
2021-01-10 14:00   ` [PATCH v2 23/36] emacs: various cosmetic improvements Jonas Bernoulli
2021-01-13 17:37     ` [PATCH v3 " Jonas Bernoulli
2021-01-10 14:01   ` [PATCH v2 24/36] emacs: various comment improvements Jonas Bernoulli
2021-01-10 14:01   ` [PATCH v2 25/36] emacs: various doc-string improvements Jonas Bernoulli
2021-01-10 14:01   ` [PATCH v2 26/36] emacs: remove variable notmuch-search-disjunctive-regexp Jonas Bernoulli
2021-01-10 14:01   ` [PATCH v2 27/36] emacs: define a few variables as automatically buffer-local Jonas Bernoulli
2021-01-10 14:01   ` [PATCH v2 28/36] emacs: notmuch-search-stash-thread-id: use notmuch-search-query-string Jonas Bernoulli
2021-01-10 14:01   ` [PATCH v2 29/36] emacs: reorder notmuch.el a bit Jonas Bernoulli
2021-01-10 14:01   ` [PATCH v2 30/36] emacs: avoid unnecessary let-bindings Jonas Bernoulli
2021-01-10 14:01   ` Jonas Bernoulli [this message]
2021-01-10 14:01   ` [PATCH v2 32/36] emacs: make subr-x available in all libraries Jonas Bernoulli
2021-01-10 14:01   ` [PATCH v2 33/36] emacs: use string-empty-p Jonas Bernoulli
2021-01-10 14:01   ` [PATCH v2 34/36] emacs: notmuch-tree-get-match: No longer define as command Jonas Bernoulli
2021-01-10 14:01   ` [PATCH v2 35/36] emacs: allow opting out of notmuch's address completion Jonas Bernoulli
2021-01-10 14:01   ` [PATCH v2 36/36] emacs: notmuch-address-expand-name: use the actual initial-input Jonas Bernoulli
2021-01-15 11:28     ` David Bremner
2021-01-13  9:13   ` [PATCH v2 00/36] [emacs] Add outline headings and switch to lexical scope Tomi Ollila
2021-01-13 12:11   ` David Bremner
2021-01-13 13:02     ` Tomi Ollila
2021-01-13 17:41     ` Jonas Bernoulli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210110140112.25930-32-jonas@bernoul.li \
    --to=jonas@bernoul.li \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).