]> git.notmuchmail.org Git - notmuch/blob - notmuch.el
84152fbccfebb14d55511a50d8fa759873c32d08
[notmuch] / notmuch.el
1 ; notmuch.el --- run notmuch within emacs
2 ;
3 ; Copyright © Carl Worth
4 ;
5 ; This file is part of Notmuch.
6 ;
7 ; Notmuch is free software: you can redistribute it and/or modify it
8 ; under the terms of the GNU General Public License as published by
9 ; the Free Software Foundation, either version 3 of the License, or
10 ; (at your option) any later version.
11 ;
12 ; Notmuch is distributed in the hope that it will be useful, but
13 ; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 ; General Public License for more details.
16 ;
17 ; You should have received a copy of the GNU General Public License
18 ; along with Notmuch.  If not, see <http://www.gnu.org/licenses/>.
19 ;
20 ; Authors: Carl Worth <cworth@cworth.org>
21 ;
22 ; Much of notmuch.el was written by looking at the implementation of
23 ; compile.el from the emacs distribution source which has the
24 ; following copyright and authorsip (and the identical license as
25 ; above):
26 ;
27 ; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
28 ;   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
29 ;   Free Software Foundation, Inc.
30
31 ; Authors: Roland McGrath <roland@gnu.org>,
32 ;           Daniel Pfeiffer <occitan@esperanto.org>
33
34 ;;;###autoload
35 (defun notmuch-search-mode ()
36   "Major mode for handling the output of notmuch search"
37   (interactive)
38   (kill-all-local-variables)
39   (setq major-mode 'notmuch-search-mode
40         mode-name "notmuch-search")
41   (setq buffer-read-only t))
42
43 (defun notmuch-search (query)
44   "Run \"notmuch search\" with the given query string and display results."
45   (interactive "sNotmuch search:")
46   (compilation-start (concat "notmuch search " query) 'notmuch-search-mode))
47
48 (defun notmuch ()
49   "Run notmuch to display all mail with tag of 'inbox'"
50   (interactive)
51   (require 'compile)
52   (notmuch-search "tag:inbox"))