From: Mark Walters Date: Sun, 30 Mar 2014 07:25:23 +0000 (+0100) Subject: Re: [PATCH 2/2] emacs: add defcustom notmuch-init-file and load it if exists X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=023bdc2d615f0a728979f127e3d9d221f7e35ab6;p=notmuch-archives.git Re: [PATCH 2/2] emacs: add defcustom notmuch-init-file and load it if exists --- diff --git a/e9/14fc4ac691755816f4225a579bb5345eda5b01 b/e9/14fc4ac691755816f4225a579bb5345eda5b01 new file mode 100644 index 000000000..91fa05c17 --- /dev/null +++ b/e9/14fc4ac691755816f4225a579bb5345eda5b01 @@ -0,0 +1,136 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id EE58C431FBD + for ; Sun, 30 Mar 2014 00:25:44 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id eKNx0HccdZWx for ; + Sun, 30 Mar 2014 00:25:38 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 1BD18431FBC + for ; Sun, 30 Mar 2014 00:25:38 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1WUA7Q-00066I-1w; Sun, 30 Mar 2014 08:25:27 +0100 +Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1WUA7P-0006De-M5; Sun, 30 Mar 2014 08:25:23 +0100 +From: Mark Walters +To: Tomi Ollila , notmuch@notmuchmail.org +Subject: Re: [PATCH 2/2] emacs: add defcustom notmuch-init-file and load it if + exists +In-Reply-To: <1396080479-19161-2-git-send-email-tomi.ollila@iki.fi> +References: <1396080479-19161-1-git-send-email-tomi.ollila@iki.fi> + <1396080479-19161-2-git-send-email-tomi.ollila@iki.fi> +User-Agent: Notmuch/0.15.2+615~g78e3a93 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Sun, 30 Mar 2014 08:25:23 +0100 +Message-ID: <87a9c89mho.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 93.97.24.31 +X-QM-Geographic: According to ripencc, + this message was delivered by a machine in Britain (UK) (GB). +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: d9f15b9f1392a55a9962a7a35c9916b9 (of first 20000 bytes) +X-SpamAssassin-Score: 0.0 +X-SpamAssassin-SpamBar: / +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored 0.0 points. Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * 0.0 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +Cc: tomi.ollila@iki.fi +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 30 Mar 2014 07:25:45 -0000 + + +This looks good, but I haven't tested as it doesn't fit with my current +setup. (Just to clarify my current setup still works, but it would be a +moderate amount of effort to actually exercise the new code) + +One question: is it possible to get emacs to save notmuch customizations +to the notmuch init file rather than to .emacs? I think it isn't but +thought it worth checking in case. + +Best wishes + +Mark + + +On Sat, 29 Mar 2014, Tomi Ollila wrote: +> So that users can easily organize their notmuch-specific configurations +> to separate file and they don't have to have notmuch configurations in +> *every* emacs installation they launch, especially if those need to +> '(require notmuch) to make the configurations possible. +> --- +> emacs/notmuch.el | 18 ++++++++++++++++++ +> 1 file changed, 18 insertions(+) +> +> diff --git a/emacs/notmuch.el b/emacs/notmuch.el +> index 34a3b3c..64295ac 100644 +> --- a/emacs/notmuch.el +> +++ b/emacs/notmuch.el +> @@ -85,6 +85,18 @@ (defcustom notmuch-search-result-format +> :type '(alist :key-type (string) :value-type (string)) +> :group 'notmuch-search) +> +> +;; The name of this variable `notmuch-init-file' is consistent with the +> +;; convention used in e.g. emacs and gnus. The value, `notmuch-config[.el[c]]' +> +;; is consistent with notmuch cli configuration file `~/.notmuch-config'. +> +(defcustom notmuch-init-file (locate-user-emacs-file "notmuch-config") +> + "Your Notmuch Emacs-Lisp configuration file name. +> +If a file with one of the suffixes defined by `get-load-suffixes' exists, +> +it will be read instead. +> +This file is read once when notmuch is loaded; the notmuch hooks added +> +there will be called at other points of notmuch execution." +> + :type 'file +> + :group 'notmuch) +> + +> (defvar notmuch-query-history nil +> "Variable to store minibuffer history for notmuch queries") +> +> @@ -1017,3 +1029,9 @@ (defun notmuch-cycle-notmuch-buffers () +> (setq mail-user-agent 'notmuch-user-agent) +> +> (provide 'notmuch) +> + +> +;; After provide to avoid loops if notmuch was require'd via notmuch-init-file. +> +(if init-file-user ; don't load init file if the -q option was used. +> + (let ((init-file (locate-file notmuch-init-file '("/") +> + (get-load-suffixes)))) +> + (if init-file (load init-file nil t t)))) +> -- +> 1.8.0 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch