diff options
author | Tomi Ollila <tomi.ollila@iki.fi> | 2014-03-29 10:07:59 +0200 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2014-03-30 11:02:28 -0300 |
commit | 31fc76b782c5ebc38ec4a6d5f4fea12fe141f460 (patch) | |
tree | bf9f0b1d81e271aeaa1d1b61e4105bb693de2e57 /emacs/notmuch.el | |
parent | 7341b78abaa2db79271ea0e8a82120661448e251 (diff) |
emacs: add defcustom notmuch-init-file and load it if exists
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.
Diffstat (limited to 'emacs/notmuch.el')
-rw-r--r-- | emacs/notmuch.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/emacs/notmuch.el b/emacs/notmuch.el index e646aa5b..233c784d 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -81,6 +81,18 @@ To enter a line break in customize, press \\[quoted-insert] C-j." :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") @@ -1013,3 +1025,9 @@ notmuch buffers exist, run `notmuch'." (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)))) |