From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id AIeeFqA81V45QgAA0tVLHw (envelope-from ) for ; Mon, 01 Jun 2020 17:36:32 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id Q69yEqA81V7XZgAAB5/wlQ (envelope-from ) for ; Mon, 01 Jun 2020 17:36:32 +0000 Received: from arlo.cworth.org (arlo.cworth.org [50.126.95.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 481E79404CE for ; Mon, 1 Jun 2020 17:36:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id ABA846DE023C; Mon, 1 Jun 2020 10:36:25 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org 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 0QLvxs8SNjVM; Mon, 1 Jun 2020 10:36:25 -0700 (PDT) Received: from arlo.cworth.org (localhost [IPv6:::1]) by arlo.cworth.org (Postfix) with ESMTP id 099D36DE024F; Mon, 1 Jun 2020 10:36:24 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 80F126DE024F for ; Mon, 1 Jun 2020 10:36:22 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org 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 UqMzlKrMVmVU for ; Mon, 1 Jun 2020 10:36:21 -0700 (PDT) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by arlo.cworth.org (Postfix) with ESMTPS id B6A836DE023C for ; Mon, 1 Jun 2020 10:36:20 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 15D6F5C00A0 for ; Mon, 1 Jun 2020 13:36:18 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 01 Jun 2020 13:36:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=from:to:subject:date:message-id:mime-version:content-type; s= fm3; bh=hKJ0d8qEBbJbXm7lMLpIXFUKzlVeed4mk+3+uHoYnIk=; b=f3ZOmEkn cGna6SMI8iT615KXS76NuwcJd9WdbvrNzFXQlMAbBts8a0QzLBSNvw6LroZv7Leu gAXfPy0C9XuiZ6qE2PZjDH69dD07KulkKZvXDpYqpy4plhiY25kLwD0/HRWGG1Dd EOm2cU/ZvKZiJ96WkInzWiLXjp1ZCX3wedd20I+6yAzCS6Hoe/eGC7Lva+mF4QrY DL9h04QZ+jkcydW366zSaDsiRqZXVQhgkgWmON1x9Hfx6dO4HWsz2YlYAa7uaxFl JZNek31eFg13TqnR1kCmv+8J/sa6FCD5tAwnHQWYGyGHMQ4/T6qqaM/Cz35MlGJi 8rCEjYM5LBZhzA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=hKJ0d8qEBbJbXm7lMLpIXFUKzlVee d4mk+3+uHoYnIk=; b=ZqIvvYXaJcviAnh/RQfQ9Hk1Ta+rxkJw8gE+vSbQJuo3w 73iWbys4bh83xEzAzVmZEmNX5Qb9XRpIjrsEjA6Z9nBFYsScaC4LDwljvgicWA+B tVJgU+feh8DBFonLKGkLBavdM5/z7Tkt9FolhSj6cUdjkXKXJuUr6qpeOr5esepO XguLBGfa+LVUuSMFkb+D0UO1lF/7m5GEg5gDAye3QwU8GhlgW4HtnMZ78EenNbLf O4xYDdCatPMkiWC9exQ5IcYAGpLawlvcv7GllUSQAWNrZj4lAN9Vf1PCWiQgiywf lGq1kyK8f9EPXpln0jSGPnBVB6ysN02LXTrlWetFg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudefhedguddtiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfggtgesthdtredttd dttdenucfhrhhomhepufgvrghnucghhhhithhtohhnuceoshhpfihhihhtthhonhesshhp fihhihhtthhonhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeelleegjeehvdehgeehgf efgedvhfdvfefffeehjedtgeefheffiedtfeetjeeuheenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsphifhhhithhtohhnsehsphifhhhith htohhnrdhnrghmvg X-ME-Proxy: From: Sean Whitton To: notmuch@notmuchmail.org Subject: Lazily loading notmuch into Emacs Date: Mon, 01 Jun 2020 10:36:16 -0700 Message-ID: <87367ed6y7.fsf@iris.silentflame.com> MIME-Version: 1.0 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: notmuch-bounces@notmuchmail.org Sender: "notmuch" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=spwhitton.name header.s=fm3 header.b=f3ZOmEkn; dkim=fail (body hash did not verify) header.d=messagingengine.com header.s=fm2 header.b=ZqIvvYXa; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 50.126.95.6 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: -0.01 X-TUID: m3/9+RgpdXha Hello, I don't want to put (require 'notmuch) into my Emacs init because that will slow down initial Emacs startup a fair bit, especially since my (file which is equivalent to) notmuch-config.el does quite a bit of processing to populate notmuch-saved-searches. So I have this: ;; Ensure notmuch does its `message-mode' configuration and that my ;; notmuch-config.el gets loaded before certain commands happen. An ;; alternative to advising `compose-mail' and friends here would be ;; to remap its keys to `notmuch-mua-new-mail', but it is nice to ;; have things work correctly if some lisp code somewhere calls ;; `compose-mail' or friends (defun spw/load-notmuch (&rest ignore) (require 'notmuch)) (dolist (cmd '(compose-mail compose-mail-other-window compose-mail-other-frame notmuch-jump-search notmuch-hello)) (advice-add cmd :before #'spw/load-notmuch)) (global-set-key "\C-cs" #'notmuch-search) (global-set-key "\C-cm" #'notmuch-jump-search) (global-set-key "\C-cM" #'notmuch-hello) This is not a very idiomatic way to make use of an ELPA package, however. Does anyone have a better approach that does not involve advice-add? I'm using the elpa-notmuch package on Debian. -- Sean Whitton