Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / eb / 5852101f8f96db1172c50ebbd1fa0a5fa79f80
1 Return-Path: <too@guru-group.fi>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 742C8431FBF\r
6         for <notmuch@notmuchmail.org>; Sat, 29 Mar 2014 01:08:13 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id PwBkbMjNrNNW for <notmuch@notmuchmail.org>;\r
16         Sat, 29 Mar 2014 01:08:11 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 9DEDA431FBC\r
19         for <notmuch@notmuchmail.org>; Sat, 29 Mar 2014 01:08:11 -0700 (PDT)\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)\r
21         id A1B781000F3; Sat, 29 Mar 2014 10:08:05 +0200 (EET)\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>\r
23 To: notmuch@notmuchmail.org\r
24 Subject: [PATCH 2/2] emacs: add defcustom notmuch-init-file and load it if\r
25         exists\r
26 Date: Sat, 29 Mar 2014 10:07:59 +0200\r
27 Message-Id: <1396080479-19161-2-git-send-email-tomi.ollila@iki.fi>\r
28 X-Mailer: git-send-email 1.8.0\r
29 In-Reply-To: <1396080479-19161-1-git-send-email-tomi.ollila@iki.fi>\r
30 References: <1396080479-19161-1-git-send-email-tomi.ollila@iki.fi>\r
31 Cc: tomi.ollila@iki.fi\r
32 X-BeenThere: notmuch@notmuchmail.org\r
33 X-Mailman-Version: 2.1.13\r
34 Precedence: list\r
35 List-Id: "Use and development of the notmuch mail system."\r
36         <notmuch.notmuchmail.org>\r
37 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
38         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
39 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
40 List-Post: <mailto:notmuch@notmuchmail.org>\r
41 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
42 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
44 X-List-Received-Date: Sat, 29 Mar 2014 08:08:13 -0000\r
45 \r
46 So that users can easily organize their notmuch-specific configurations\r
47 to separate file and they don't have to have notmuch configurations in\r
48 *every* emacs installation they launch, especially if those need to\r
49 '(require notmuch) to make the configurations possible.\r
50 ---\r
51  emacs/notmuch.el | 18 ++++++++++++++++++\r
52  1 file changed, 18 insertions(+)\r
53 \r
54 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
55 index 34a3b3c..64295ac 100644\r
56 --- a/emacs/notmuch.el\r
57 +++ b/emacs/notmuch.el\r
58 @@ -85,6 +85,18 @@ (defcustom notmuch-search-result-format\r
59    :type '(alist :key-type (string) :value-type (string))\r
60    :group 'notmuch-search)\r
61  \r
62 +;; The name of this variable `notmuch-init-file' is consistent with the\r
63 +;; convention used in e.g. emacs and gnus. The value, `notmuch-config[.el[c]]'\r
64 +;; is consistent with notmuch cli configuration file `~/.notmuch-config'.\r
65 +(defcustom notmuch-init-file (locate-user-emacs-file "notmuch-config")\r
66 +  "Your Notmuch Emacs-Lisp configuration file name.\r
67 +If a file with one of the suffixes defined by `get-load-suffixes' exists,\r
68 +it will be read instead.\r
69 +This file is read once when notmuch is loaded; the notmuch hooks added\r
70 +there will be called at other points of notmuch execution."\r
71 +  :type 'file\r
72 +  :group 'notmuch)\r
73 +\r
74  (defvar notmuch-query-history nil\r
75    "Variable to store minibuffer history for notmuch queries")\r
76  \r
77 @@ -1017,3 +1029,9 @@ (defun notmuch-cycle-notmuch-buffers ()\r
78  (setq mail-user-agent 'notmuch-user-agent)\r
79  \r
80  (provide 'notmuch)\r
81 +\r
82 +;; After provide to avoid loops if notmuch was require'd via notmuch-init-file.\r
83 +(if init-file-user ; don't load init file if the -q option was used.\r
84 +    (let ((init-file (locate-file notmuch-init-file '("/")\r
85 +                                 (get-load-suffixes))))\r
86 +      (if init-file (load init-file nil t t))))\r
87 -- \r
88 1.8.0\r
89 \r