--- /dev/null
+Return-Path: <too@guru-group.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 742C8431FBF\r
+ for <notmuch@notmuchmail.org>; Sat, 29 Mar 2014 01:08:13 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id PwBkbMjNrNNW for <notmuch@notmuchmail.org>;\r
+ Sat, 29 Mar 2014 01:08:11 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 9DEDA431FBC\r
+ for <notmuch@notmuchmail.org>; Sat, 29 Mar 2014 01:08:11 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id A1B781000F3; Sat, 29 Mar 2014 10:08:05 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/2] emacs: add defcustom notmuch-init-file and load it if\r
+ exists\r
+Date: Sat, 29 Mar 2014 10:07:59 +0200\r
+Message-Id: <1396080479-19161-2-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.8.0\r
+In-Reply-To: <1396080479-19161-1-git-send-email-tomi.ollila@iki.fi>\r
+References: <1396080479-19161-1-git-send-email-tomi.ollila@iki.fi>\r
+Cc: tomi.ollila@iki.fi\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 29 Mar 2014 08:08:13 -0000\r
+\r
+So that users can easily organize their notmuch-specific configurations\r
+to separate file and they don't have to have notmuch configurations in\r
+*every* emacs installation they launch, especially if those need to\r
+'(require notmuch) to make the configurations possible.\r
+---\r
+ emacs/notmuch.el | 18 ++++++++++++++++++\r
+ 1 file changed, 18 insertions(+)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 34a3b3c..64295ac 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -85,6 +85,18 @@ (defcustom notmuch-search-result-format\r
+ :type '(alist :key-type (string) :value-type (string))\r
+ :group 'notmuch-search)\r
+ \r
++;; The name of this variable `notmuch-init-file' is consistent with the\r
++;; convention used in e.g. emacs and gnus. The value, `notmuch-config[.el[c]]'\r
++;; is consistent with notmuch cli configuration file `~/.notmuch-config'.\r
++(defcustom notmuch-init-file (locate-user-emacs-file "notmuch-config")\r
++ "Your Notmuch Emacs-Lisp configuration file name.\r
++If a file with one of the suffixes defined by `get-load-suffixes' exists,\r
++it will be read instead.\r
++This file is read once when notmuch is loaded; the notmuch hooks added\r
++there will be called at other points of notmuch execution."\r
++ :type 'file\r
++ :group 'notmuch)\r
++\r
+ (defvar notmuch-query-history nil\r
+ "Variable to store minibuffer history for notmuch queries")\r
+ \r
+@@ -1017,3 +1029,9 @@ (defun notmuch-cycle-notmuch-buffers ()\r
+ (setq mail-user-agent 'notmuch-user-agent)\r
+ \r
+ (provide 'notmuch)\r
++\r
++;; After provide to avoid loops if notmuch was require'd via notmuch-init-file.\r
++(if init-file-user ; don't load init file if the -q option was used.\r
++ (let ((init-file (locate-file notmuch-init-file '("/")\r
++ (get-load-suffixes))))\r
++ (if init-file (load init-file nil t t))))\r
+-- \r
+1.8.0\r
+\r