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 qHvGAd861l7FSgAA0tVLHw (envelope-from ) for ; Tue, 02 Jun 2020 11:41:19 +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 4NlDOd461l5jMAAAbx9fmQ (envelope-from ) for ; Tue, 02 Jun 2020 11:41:18 +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 41C2394036B for ; Tue, 2 Jun 2020 11:41:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 660CF6DE0946; Tue, 2 Jun 2020 04:41:12 -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 MYW1nrL47Dsa; Tue, 2 Jun 2020 04:41:11 -0700 (PDT) Received: from arlo.cworth.org (localhost [IPv6:::1]) by arlo.cworth.org (Postfix) with ESMTP id 2CD376DE0B3B; Tue, 2 Jun 2020 04:41:11 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 3335B6DE0B3B for ; Tue, 2 Jun 2020 04:41:09 -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 44yFJegg7Dgn for ; Tue, 2 Jun 2020 04:41:07 -0700 (PDT) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by arlo.cworth.org (Postfix) with ESMTPS id 5B9696DE0946 for ; Tue, 2 Jun 2020 04:41:07 -0700 (PDT) Received: by mail-wr1-f54.google.com with SMTP id r7so3090199wro.1 for ; Tue, 02 Jun 2020 04:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dme-org.20150623.gappssmtp.com; s=20150623; h=to:subject:in-reply-to:references:from:date:message-id:mime-version; bh=BKK3wUSOqv8j+48fSQayK9ipfp0zvPkErkdf4hrKwlA=; b=UBp1+TFmJ4Hvid4RJ3gv+pg8kS2kXsZwC88nIVfU56NYgW7d+VjNfD59WgzrJOROsJ urQY5dk2Y9Ho6TPNKE2YTjeCKk+D7GtlADLf3ZchagmA6xrVUPZNvk/BFteRzC9JRTBm L7CFBM9OmEyJ0m9zRFXOKBkvy88+VMu2iFtyy2HXXmzDeBH2FfpUJGVoYItagUMVQUl8 kMm9Qx2W8EcwaKTpVswKme6ZEbngScgFE3K6ZQGKNcoKPgzUV5/xeYZJL5OEJv8zHmf7 znWsImpkyCsHA7MwPbsPzu+7zXUnxcWzp+oS3IK+V5B144wZ23iY2YV65+aqfxEWwQXJ YhKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:subject:in-reply-to:references:from:date :message-id:mime-version; bh=BKK3wUSOqv8j+48fSQayK9ipfp0zvPkErkdf4hrKwlA=; b=nOaAzErzr/XS1g7DxKlrEqSgTchCBRIHdoFWxTsvqJaIxOnzA9VNo9ZWXJCcCnG3jW vsdZhpd4Ks9wf9bI6ucJDM86c0RP75JzDORHJA06RibRWyOxwlj80L5rg4XprQw4MFIg j17bwdEEvOBZDrKkBUyWW1g2dGyFmCd3KCBALNYh2IBO1GW3ktYwDx5VSx9kLvei3bZt CeCePCHYXZLCU0pz40rGSZo+pujhChXKRRRgYsmTMAKT9twVEXj7i0Yek0WnH9fr6aQY V0ZMbmy4UuCqMpy3OB5yKQ10AO7erRGRnQZZi90nsrs6wJNwyEGo8EcQInQUHDrAbSHm zG6g== X-Gm-Message-State: AOAM530cVVA1IU7SQnfOGwyCM2YhF6kL46kV/vUD9Ydr/3E8N01kfwdF ScpRS5EysJ4Qm7w9HNNhCENfJg== X-Google-Smtp-Source: ABdhPJy0gKad0fSx403mzZ+Di8WHnUxQeJ6HcDZPJR/mCROxsHV5RsEStaQ7bANJ4jKxHkdCy6midQ== X-Received: by 2002:adf:dc42:: with SMTP id m2mr15551466wrj.342.1591098064097; Tue, 02 Jun 2020 04:41:04 -0700 (PDT) Received: from disaster-area.hh.sledj.net (disaster-area.hh.sledj.net. [2001:8b0:bb71:7140:64::1]) by smtp.gmail.com with ESMTPSA id h74sm3661191wrh.76.2020.06.02.04.41.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2020 04:41:03 -0700 (PDT) Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id a02a7c22; Tue, 2 Jun 2020 11:41:02 +0000 (UTC) To: Sean Whitton , notmuch@notmuchmail.org Subject: Re: Lazily loading notmuch into Emacs In-Reply-To: <87367ed6y7.fsf@iris.silentflame.com> References: <87367ed6y7.fsf@iris.silentflame.com> X-HGTTG: heart-of-gold From: David Edmondson X-Playing: Floating Points: Bias Date: Tue, 02 Jun 2020 12:41:02 +0100 Message-ID: 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=dme-org.20150623.gappssmtp.com header.s=20150623 header.b=UBp1+TFm; 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: mRHA/p7oGhU7 On Monday, 2020-06-01 at 10:36:16 -07, Sean Whitton wrote: > 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. I'd hoped that: (require 'notmuch-mua) (setq mail-user-agent 'notmuch-user-agent) would be sufficient to get things wired up, but it doesn't seem to be. If we fix that, would it seem more appropriate? If we get it right then it shouldn't load any other notmuch code (including notmuch-config.el) until you actually use one of the functions. (None of this will configure your chosen bindings of course, you'll still have to do that yourself.) dme. -- Everybody's got something to hide, 'cept me and my monkey.