├── .dir-locals.el ├── .gitignore ├── .travis.yml ├── AUTHORS ├── COPYING ├── COPYING-GPL-3 ├── INSTALL ├── Makefile ├── Makefile.local ├── NEWS ├── README ├── bindings ├── go │ ├── .gitignore │ ├── LICENSE │ ├── Makefile │ ├── README │ └── src │ │ ├── notmuch-addrlookup │ │ └── addrlookup.go │ │ └── notmuch │ │ └── notmuch.go ├── python │ ├── .gitignore │ ├── MANIFEST.in │ ├── README │ ├── debian │ │ ├── changelog │ │ ├── compat │ │ ├── control │ │ ├── copyright │ │ ├── docs │ │ └── rules │ ├── docs │ │ ├── COPYING │ │ ├── Makefile │ │ └── source │ │ │ ├── conf.py │ │ │ ├── database.rst │ │ │ ├── filesystem.rst │ │ │ ├── index.rst │ │ │ ├── message.rst │ │ │ ├── messages.rst │ │ │ ├── notes.rst │ │ │ ├── query.rst │ │ │ ├── quickstart.rst │ │ │ ├── status_and_errors.rst │ │ │ ├── tags.rst │ │ │ ├── thread.rst │ │ │ └── threads.rst │ ├── notmuch │ │ ├── __init__.py │ │ ├── compat.py │ │ ├── database.py │ │ ├── directory.py │ │ ├── errors.py │ │ ├── filenames.py │ │ ├── globals.py │ │ ├── message.py │ │ ├── messages.py │ │ ├── query.py │ │ ├── tag.py │ │ ├── thread.py │ │ ├── threads.py │ │ └── version.py │ └── setup.py └── ruby │ ├── .gitignore │ ├── database.c │ ├── defs.h │ ├── directory.c │ ├── extconf.rb │ ├── filenames.c │ ├── init.c │ ├── message.c │ ├── messages.c │ ├── query.c │ ├── rdoc.sh │ ├── status.c │ ├── tags.c │ ├── thread.c │ └── threads.c ├── command-line-arguments.c ├── command-line-arguments.h ├── compat ├── .gitignore ├── Makefile ├── Makefile.local ├── README ├── canonicalize_file_name.c ├── check_asctime.c ├── check_getpwuid.c ├── compat.h ├── function-attributes.h ├── gen_zlib_pc.c ├── getdelim.c ├── getline.c ├── have_canonicalize_file_name.c ├── have_d_type.c ├── have_getline.c ├── have_strcasestr.c ├── have_strsep.c ├── have_timegm.c ├── strcasestr.c ├── strsep.c └── timegm.c ├── completion ├── Makefile ├── Makefile.local ├── README ├── notmuch-completion.bash ├── notmuch-completion.tcsh └── notmuch-completion.zsh ├── configure ├── contrib ├── notmuch-deliver │ ├── .gitignore │ ├── .mailmap │ ├── Makefile.am │ ├── README.mkd │ ├── autogen.sh │ ├── configure.ac │ ├── m4 │ │ └── ax_check_compiler_flags.m4 │ ├── maildrop │ │ ├── maildir │ │ │ ├── Makefile.am │ │ │ ├── configure.in │ │ │ ├── maildircreate.c │ │ │ ├── maildircreate.h │ │ │ ├── maildirmisc.h │ │ │ ├── maildirmkdir.c │ │ │ └── maildiropen.c │ │ └── numlib │ │ │ ├── Makefile.am │ │ │ ├── atotimet.c │ │ │ ├── atouidt.c │ │ │ ├── changeuidgid.c │ │ │ ├── configure.in │ │ │ ├── numlib.h │ │ │ ├── strdevt.c │ │ │ ├── strgidt.c │ │ │ ├── strhdevt.c │ │ │ ├── strhinot.c │ │ │ ├── strhpidt.c │ │ │ ├── strhtimet.c │ │ │ ├── strinot.c │ │ │ ├── strofft.c │ │ │ ├── strpidt.c │ │ │ ├── strsize.c │ │ │ ├── strsizet.c │ │ │ ├── strtimet.c │ │ │ └── struidt.c │ └── src │ │ ├── Makefile.am │ │ └── main.c ├── notmuch-mutt │ ├── .gitignore │ ├── Makefile │ ├── README │ ├── notmuch-mutt │ └── notmuch-mutt.rc └── notmuch-vim │ ├── Makefile │ ├── README │ ├── notmuch.yaml │ ├── plugin │ └── notmuch.vim │ └── syntax │ ├── notmuch-compose.vim │ ├── notmuch-folders.vim │ ├── notmuch-git-diff.vim │ ├── notmuch-search.vim │ └── notmuch-show.vim ├── crypto.c ├── debian ├── .gitignore ├── NEWS ├── changelog ├── compat ├── control ├── copyright ├── gbp.conf ├── libnotmuch-dev.install ├── libnotmuch3.install ├── libnotmuch3.symbols ├── notmuch-emacs.README.Debian ├── notmuch-emacs.dirs ├── notmuch-emacs.emacsen-compat ├── notmuch-emacs.emacsen-install ├── notmuch-emacs.emacsen-remove ├── notmuch-emacs.install ├── notmuch-emacs.postinst ├── notmuch-emacs.prerm ├── notmuch-mutt.docs ├── notmuch-mutt.install ├── notmuch-mutt.manpages ├── notmuch-vim.README.Debian ├── notmuch-vim.dirs ├── notmuch-vim.docs ├── notmuch-vim.install ├── notmuch.dirs ├── notmuch.docs ├── notmuch.emacsen-startup ├── notmuch.examples ├── notmuch.install ├── python-notmuch.install ├── python3-notmuch.install ├── ruby-notmuch.install ├── rules └── source │ ├── format │ └── options ├── debugger.c ├── devel ├── RELEASING ├── STYLE ├── TODO ├── gen-testdb.sh ├── man-to-mdwn.pl ├── news2wiki.pl ├── nmbug │ ├── nmbug │ ├── nmbug-status │ └── status-config.json ├── printmimestructure ├── release-checks.sh ├── schemata └── uncrustify.cfg ├── doc ├── .gitignore ├── INSTALL ├── Makefile ├── Makefile.local ├── conf.py ├── doxygen.cfg ├── index.rst ├── man1 │ ├── notmuch-compact.rst │ ├── notmuch-config.rst │ ├── notmuch-count.rst │ ├── notmuch-dump.rst │ ├── notmuch-insert.rst │ ├── notmuch-new.rst │ ├── notmuch-reply.rst │ ├── notmuch-restore.rst │ ├── notmuch-search.rst │ ├── notmuch-show.rst │ ├── notmuch-tag.rst │ └── notmuch.rst ├── man5 │ └── notmuch-hooks.rst ├── man7 │ └── notmuch-search-terms.rst ├── mkdocdeps.py ├── notmuch-emacs.rst └── prerst2man.py ├── emacs ├── .gitignore ├── Makefile ├── Makefile.local ├── coolj.el ├── make-deps.el ├── notmuch-address.el ├── notmuch-crypto.el ├── notmuch-hello.el ├── notmuch-jump.el ├── notmuch-lib.el ├── notmuch-logo.png ├── notmuch-maildir-fcc.el ├── notmuch-message.el ├── notmuch-mua.el ├── notmuch-parser.el ├── notmuch-print.el ├── notmuch-query.el ├── notmuch-show.el ├── notmuch-tag.el ├── notmuch-tree.el ├── notmuch-version.el.tmpl ├── notmuch-wash.el └── notmuch.el ├── gmime-filter-reply.c ├── gmime-filter-reply.h ├── hooks.c ├── lib ├── Makefile ├── Makefile.local ├── database-private.h ├── database.cc ├── directory.cc ├── filenames.c ├── gen-version-script.sh ├── index.cc ├── libsha1.c ├── libsha1.h ├── message-file.c ├── message.cc ├── messages.c ├── notmuch-private.h ├── notmuch.h ├── parse-time-vrp.cc ├── parse-time-vrp.h ├── query.cc ├── sha1.c ├── string-list.c ├── tags.c └── thread.cc ├── mime-node.c ├── notmuch-client.h ├── notmuch-compact.c ├── notmuch-config.c ├── notmuch-count.c ├── notmuch-dump.c ├── notmuch-insert.c ├── notmuch-new.c ├── notmuch-reply.c ├── notmuch-restore.c ├── notmuch-search.c ├── notmuch-setup.c ├── notmuch-show.c ├── notmuch-tag.c ├── notmuch-time.c ├── notmuch.c ├── notmuch.desktop ├── packaging ├── debian └── fedora │ └── notmuch.spec ├── parse-time-string ├── Makefile ├── Makefile.local ├── README ├── parse-time-string.c └── parse-time-string.h ├── performance-test ├── .gitignore ├── M00-new.sh ├── M01-dump-restore.sh ├── Makefile ├── Makefile.local ├── README ├── T00-new.sh ├── T01-dump-restore.sh ├── T02-tag.sh ├── download │ ├── .gitignore │ ├── notmuch-email-corpus-0.3.tar.xz.asc │ └── notmuch-email-corpus-0.4.tar.xz.asc ├── notmuch-memory-test ├── notmuch-time-test ├── perf-test-lib.sh └── version.sh ├── query-string.c ├── sprinter-json.c ├── sprinter-sexp.c ├── sprinter-text.c ├── sprinter.h ├── tag-util.c ├── tag-util.h ├── test ├── .gitignore ├── Makefile ├── Makefile.local ├── README ├── T000-basic.sh ├── T010-help-test.sh ├── T020-compact.sh ├── T030-config.sh ├── T040-setup.sh ├── T050-new.sh ├── T060-count.sh ├── T070-insert.sh ├── T080-search.sh ├── T090-search-output.sh ├── T100-search-by-folder.sh ├── T110-search-position-overlap-bug.sh ├── T120-search-insufficient-from-quoting.sh ├── T130-search-limiting.sh ├── T140-excludes.sh ├── T150-tagging.sh ├── T160-json.sh ├── T170-sexp.sh ├── T180-text.sh ├── T190-multipart.sh ├── T200-thread-naming.sh ├── T210-raw.sh ├── T220-reply.sh ├── T230-reply-to-sender.sh ├── T240-dump-restore.sh ├── T250-uuencode.sh ├── T260-thread-order.sh ├── T270-author-order.sh ├── T280-from-guessing.sh ├── T290-long-id.sh ├── T300-encoding.sh ├── T310-emacs.sh ├── T320-emacs-large-search-buffer.sh ├── T330-emacs-subject-to-filename.sh ├── T340-maildir-sync.sh ├── T350-crypto.sh ├── T360-symbol-hiding.sh ├── T370-search-folder-coherence.sh ├── T380-atomicity.sh ├── T390-python.sh ├── T400-hooks.sh ├── T410-argument-parsing.sh ├── T420-emacs-test-functions.sh ├── T430-emacs-address-cleaning.sh ├── T440-emacs-hello.sh ├── T450-emacs-show.sh ├── T460-emacs-tree.sh ├── T470-missing-headers.sh ├── T480-hex-escaping.sh ├── T490-parse-time-string.sh ├── T500-search-date.sh ├── T510-thread-replies.sh ├── T520-show.sh ├── T530-upgrade.sh ├── T550-db-features.sh ├── aggregate-results.sh ├── arg-test.c ├── atomicity.gdb ├── corpus │ ├── 01:2, │ ├── 02:2, │ ├── bar │ │ ├── 17:2, │ │ ├── 18:2, │ │ ├── baz │ │ │ ├── 05:2, │ │ │ ├── 23:2, │ │ │ ├── 24:2, │ │ │ ├── cur │ │ │ │ ├── 25:2, │ │ │ │ └── 26:2, │ │ │ └── new │ │ │ │ ├── 27:2, │ │ │ │ └── 28:2, │ │ ├── cur │ │ │ ├── 19:2, │ │ │ └── 20:2, │ │ └── new │ │ │ ├── 21:2, │ │ │ └── 22:2, │ ├── cur │ │ ├── 29:2, │ │ ├── 30:2, │ │ ├── 31:2, │ │ ├── 32:2, │ │ ├── 33:2, │ │ ├── 34:2, │ │ ├── 35:2, │ │ ├── 36:2, │ │ ├── 37:2, │ │ ├── 38:2, │ │ ├── 39:2, │ │ ├── 40:2, │ │ ├── 41:2, │ │ ├── 42:2, │ │ ├── 43:2, │ │ ├── 44:2, │ │ ├── 45:2, │ │ ├── 46:2, │ │ ├── 47:2, │ │ ├── 48:2, │ │ ├── 49:2, │ │ ├── 50:2, │ │ ├── 51:2, │ │ ├── 52:2, │ │ └── 53:2, │ ├── foo │ │ ├── 06:2, │ │ ├── baz │ │ │ ├── 11:2, │ │ │ ├── 12:2, │ │ │ ├── cur │ │ │ │ ├── 13:2, │ │ │ │ └── 14:2, │ │ │ └── new │ │ │ │ ├── 15:2, │ │ │ │ └── 16:2, │ │ ├── cur │ │ │ ├── 07:2, │ │ │ └── 08:2, │ │ └── new │ │ │ ├── 03:2, │ │ │ ├── 09:2, │ │ │ └── 10:2, │ └── new │ │ └── 04:2, ├── database-test.c ├── database-test.h ├── emacs-address-cleaning.el ├── emacs-show.expected-output │ ├── notmuch-show-elide-non-matching-messages-off │ ├── notmuch-show-elide-non-matching-messages-on │ ├── notmuch-show-indent-thread-content-off │ ├── notmuch-show-process-crypto-mime-parts-off │ └── notmuch-show-process-crypto-mime-parts-on ├── emacs.expected-output │ ├── attachment │ ├── notmuch-hello │ ├── notmuch-hello-empty-custom-queries-section │ ├── notmuch-hello-empty-custom-tags-section │ ├── notmuch-hello-long-names │ ├── notmuch-hello-new-section │ ├── notmuch-hello-no-saved-searches │ ├── notmuch-hello-section-counts │ ├── notmuch-hello-section-hidden-tag │ ├── notmuch-hello-section-with-empty │ ├── notmuch-hello-view-inbox │ ├── notmuch-hello-with-empty │ ├── notmuch-search-tag-inbox │ ├── notmuch-show-message-with-headers-hidden │ ├── notmuch-show-message-with-headers-visible │ ├── notmuch-show-thread-maildir-storage │ ├── notmuch-show-thread-maildir-storage-with-fourfold-indentation │ ├── notmuch-show-thread-maildir-storage-without-indentation │ ├── notmuch-show-thread-with-all-messages-collapsed │ ├── notmuch-show-thread-with-all-messages-uncollapsed │ ├── notmuch-show-thread-with-hidden-messages │ └── raw-message-cf0c4d-52ad0a ├── gen-threads.py ├── gnupg-secret-key.NOTE ├── gnupg-secret-key.asc ├── hex-xcode.c ├── make-db-version.cc ├── notmuch-test ├── parse-time.c ├── random-corpus.c ├── smtp-dummy.c ├── symbol-test.cc ├── test-databases │ ├── .gitignore │ ├── Makefile │ ├── Makefile.local │ └── database-v1.tar.xz.sha256 ├── test-lib-common.sh ├── test-lib.el ├── test-lib.sh ├── test-verbose ├── test.expected-output │ ├── test-verbose-no │ └── test-verbose-yes ├── tree.expected-output │ ├── notmuch-tree-show-window │ ├── notmuch-tree-single-thread │ ├── notmuch-tree-tag-inbox │ ├── notmuch-tree-tag-inbox-tagged │ └── notmuch-tree-tag-inbox-thread-tagged └── valgrind │ ├── suppressions │ └── valgrind.sh ├── util ├── Makefile ├── Makefile.local ├── endian-util.h ├── error_util.c ├── error_util.h ├── hex-escape.c ├── hex-escape.h ├── string-util.c ├── string-util.h ├── talloc-extra.c ├── talloc-extra.h ├── util.c ├── util.h ├── xutil.c ├── xutil.h ├── zlib-extra.c └── zlib-extra.h ├── version └── vim ├── Makefile ├── README ├── notmuch.txt ├── notmuch.vim ├── notmuch.yaml └── syntax ├── notmuch-compose.vim ├── notmuch-folders.vim ├── notmuch-git-diff.vim ├── notmuch-search.vim └── notmuch-show.vim /.dir-locals.el: -------------------------------------------------------------------------------- 1 | ;; emacs local configuration settings for notmuch source 2 | ;; surmised by dkg on 2010-11-23 13:43:18-0500 3 | ;; amended by amdragon on 2011-06-06 4 | 5 | ((c-mode 6 | (indent-tabs-mode . t) 7 | (tab-width . 8) 8 | (c-basic-offset . 4) 9 | (c-file-style . "linux")) 10 | (c++-mode 11 | (indent-tabs-mode . t) 12 | (tab-width . 8) 13 | (c-basic-offset . 4) 14 | (c-file-style . "linux")) 15 | (emacs-lisp-mode 16 | (indent-tabs-mode . t) 17 | (tab-width . 8)) 18 | (shell-mode 19 | (indent-tabs-mode . t) 20 | (tab-width . 8) 21 | (sh-basic-offset . 4) 22 | (sh-indentation . 4)) 23 | (nil 24 | (fill-column . 70)) 25 | ) 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .first-build-message 2 | Makefile.config 3 | version.stamp 4 | TAGS 5 | tags 6 | *cscope* 7 | .deps 8 | /notmuch 9 | notmuch.sym 10 | notmuch-shared 11 | libnotmuch.so* 12 | libnotmuch*.dylib 13 | *.[ao] 14 | *~ 15 | .*.swp 16 | releases 17 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | before_install: 3 | - sudo apt-get update -qq 4 | - sudo apt-get install dtach libxapian-dev libgmime-2.6-dev libtalloc-dev python-sphinx 5 | 6 | # Notmuch requires zlib 1.2.5.2, unfortunately travis runs on Ubuntu 12.04LTS which 7 | # ships with zlib 1.2.3.3. We need to update to zlib 1.2.5.2 to be able to build. 8 | # TODO: Watch https://github.com/travis-ci/travis-ci/issues/2046 and remove 9 | # this hack once travis-ci switches to Ubuntu 14.04 10 | - wget 'https://github.com/notmuch/travis-files/raw/master/zlib1g-dev_1.2.8.dfsg-1ubuntu1_amd64.deb' 11 | - wget 'https://github.com/notmuch/travis-files/raw/master/zlib1g_1.2.8.dfsg-1ubuntu1_amd64.deb' 12 | - sudo dpkg -i zlib1g-dev_1.2.8.dfsg-1ubuntu1_amd64.deb zlib1g_1.2.8.dfsg-1ubuntu1_amd64.deb 13 | - sudo apt-get install -f 14 | 15 | script: 16 | - ./configure 17 | - make test 18 | 19 | notifications: 20 | irc: 21 | channels: 22 | - "chat.freenode.net#notmuch" 23 | on_success: change 24 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Carl Worth is the primary author of Notmuch. 2 | But there's really not much that he's done. There's been a lot of 3 | standing on shoulders here: 4 | 5 | William Morgan deserves credit for providing the primary inspiration 6 | for Notmuch with his program Sup (http://sup.rubyforge.org/). 7 | 8 | Some people have contributed code that has made it into Notmuch 9 | without their specific knowledge (but with their full permission 10 | thanks to the GNU General Public License). This includes: 11 | 12 | Brian Gladman (with Mikhail Gusarov ) 13 | Implementation of SHA-1 (nice and small) (libsha1.c) 14 | 15 | Please see the various files in the Notmuch distribution for 16 | individual copyright statements. 17 | 18 | And of course, though their code isn't distributed here, Notmuch would 19 | be not much of anything without the contributors to Xapian, the search 20 | engine that does the really heavy lifting, as well as the various 21 | system libraries, compilers, and the kernel that make it all work 22 | (thanks GNU, thanks Linux). Thanks to everyone who has played a part! 23 | 24 | Here is an incomplete list of other people that have made 25 | contributions to Notmuch (whether by code, bug reporting/fixes, 26 | ideas, inspiration, testing or feedback): 27 | 28 | Martin Krafft 29 | Keith Packard 30 | Jamey Sharp 31 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Notmuch is free software. 2 | 3 | You can redistribute it and/or modify it under the terms of the GNU 4 | General Public License as published by the Free Software Foundation, 5 | either version 3 of the License, or (at your option) any later 6 | version. 7 | 8 | This program is distributed in the hope that it will be useful, but 9 | WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program, (in the COPYING-GPL-3 file in this 15 | directory). If not, see http://www.gnu.org/licenses/ 16 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # We want the all target to be the implicit target (if no target is 2 | # given explicitly on the command line) so mention it first. 3 | all: 4 | 5 | # Sub-directory Makefile.local fragments can append to these variables 6 | # to have directory-specific cflags as necessary. 7 | 8 | extra_cflags := 9 | extra_cxxflags := 10 | 11 | # Get settings from the output of configure by running it to generate 12 | # Makefile.config if it doesn't exist yet. 13 | 14 | # If Makefile.config doesn't exist, then srcdir won't be 15 | # set. Conditionally set it (assuming a plain srcdir build) so that 16 | # the rule to generate Makefile.config can actually work. 17 | srcdir ?= . 18 | 19 | include Makefile.config 20 | 21 | # We make all targets depend on the Makefiles themselves. 22 | global_deps = Makefile Makefile.config Makefile.local \ 23 | $(subdirs:%=%/Makefile) $(subdirs:%=%/Makefile.local) 24 | 25 | Makefile.config: $(srcdir)/configure 26 | ifeq ($(configure_options),) 27 | @echo "" 28 | @echo "Note: Calling ./configure with no command-line arguments. This is often fine," 29 | @echo " but if you want to specify any arguments (such as an alternate prefix" 30 | @echo " into which to install), call ./configure explicitly and then make again." 31 | @echo " See \"./configure --help\" for more details." 32 | @echo "" 33 | endif 34 | $(srcdir)/configure $(configure_options) 35 | 36 | # Finally, include all of the Makefile.local fragments where all the 37 | # real work is done. 38 | 39 | include $(subdirs:%=%/Makefile.local) Makefile.local 40 | -------------------------------------------------------------------------------- /bindings/go/.gitignore: -------------------------------------------------------------------------------- 1 | src/github.com/ 2 | pkg/ 3 | bin/ 4 | -------------------------------------------------------------------------------- /bindings/go/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for the go bindings of notmuch 2 | 3 | export GOPATH ?= $(shell pwd) 4 | export CGO_CFLAGS ?= -I../../../../lib 5 | export CGO_LDFLAGS ?= -L../../../../lib 6 | 7 | GO ?= go 8 | GOFMT ?= gofmt 9 | 10 | all: notmuch notmuch-addrlookup 11 | 12 | .PHONY: notmuch 13 | notmuch: 14 | $(GO) install notmuch 15 | 16 | .PHONY: goconfig 17 | goconfig: 18 | if [ ! -d github.com/msbranco/goconfig ]; then \ 19 | $(GO) get github.com/msbranco/goconfig; \ 20 | fi 21 | 22 | .PHONY: notmuch-addrlookup 23 | notmuch-addrlookup: notmuch goconfig 24 | $(GO) install notmuch-addrlookup 25 | 26 | .PHONY: format 27 | format: 28 | $(GOFMT) -w=true $(GOFMT_OPTS) src/notmuch 29 | $(GOFMT) -w=true $(GOFMT_OPTS) src/notmuch-addrlookup 30 | 31 | .PHONY: check-format 32 | check-format: 33 | $(GOFMT) -d=true $(GOFMT_OPTS) src/notmuch 34 | $(GOFMT) -d=true $(GOFMT_OPTS) src/notmuch-addrlookup 35 | 36 | .PHONY: clean 37 | clean: 38 | $(GO) clean notmuch 39 | $(GO) clean notmuch-addrlookup 40 | rm -rf pkg bin 41 | -------------------------------------------------------------------------------- /bindings/go/README: -------------------------------------------------------------------------------- 1 | go-notmuch 2 | ========== 3 | 4 | simple go bindings to the libnotmuch library[1]. 5 | 6 | they are heavily inspired from the vala bindings from Sebastian Spaeth: 7 | https://github.com/spaetz/vala-notmuch 8 | 9 | note: the whole library hasn't been wrapped (yet?) 10 | 11 | todo 12 | ---- 13 | 14 | - improve notmuch-addrlookup regexp 15 | 16 | [1] http://notmuchmail.org/ -------------------------------------------------------------------------------- /bindings/python/.gitignore: -------------------------------------------------------------------------------- 1 | *.py[co] 2 | /docs/build 3 | /docs/html 4 | build/ 5 | -------------------------------------------------------------------------------- /bindings/python/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include notmuch 2 | #recursive-include docs/html * -------------------------------------------------------------------------------- /bindings/python/debian/changelog: -------------------------------------------------------------------------------- 1 | cnotmuch (0.2.1-1) karmic; urgency=low 2 | 3 | * Initial release 4 | 5 | -- Sebastian Spaeth Tue, 30 Mar 2010 11:31:39 +0200 6 | -------------------------------------------------------------------------------- /bindings/python/debian/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /bindings/python/debian/control: -------------------------------------------------------------------------------- 1 | Source: cnotmuch 2 | Section: python 3 | Priority: extra 4 | Maintainer: Sebastian Spaeth 5 | Build-Depends: debhelper (>= 7.3.0), python-support (>= 0.5.3) 6 | Build-Depends-Indep: python (>= 2.5), python-support 7 | Standards-Version: 3.8.1 8 | Homepage: http://pypi.python.org/pypi/cnotmuch 9 | 10 | Package: cnotmuch 11 | Architecture: all 12 | XB-Python-Version: ${python:Versions} 13 | Depends: ${misc:Depends},${python:Depends}, notmuch (> 0.0+201001211401) 14 | Description: Interface to the notmuch mail search and index library 15 | The cnotmuch module provides an interface to the notmuch functionality, 16 | directly interfacing with a shared notmuch library. 17 | Notmuch provides a maildatabase that allows for extremely quick searching and 18 | filtering of your email according to various criteria. 19 | -------------------------------------------------------------------------------- /bindings/python/debian/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by: 2 | 3 | Sebastian Spaeth on Tue, 30 Mar 2010 10:02:22 +0200 4 | 5 | It was downloaded from: 6 | 7 | http://pypi.python.org/packages/source/c/cnotmuch/cnotmuch-0.2.1.tar.gz 8 | 9 | Upstream Author(s): 10 | 11 | Sebastian Spaeth 12 | 13 | Copyright: 14 | 15 | Copyright (C) 2010 Sebastian Spaeth 16 | 17 | License: 18 | 19 | This package is free software; you can redistribute it and/or modify 20 | it under the terms of the GNU General Public License as published by 21 | the Free Software Foundation; either version 2 of the License, or 22 | (at your option) any later version. 23 | 24 | This package is distributed in the hope that it will be useful, 25 | but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | GNU General Public License for more details. 28 | 29 | You should have received a copy of the GNU General Public License 30 | along with this package; if not, write to the Free Software 31 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 32 | 33 | On Debian systems, the complete text of the GNU General 34 | Public License version 2 can be found in `/usr/share/common-licenses/GPL-2'. 35 | 36 | The Debian packaging is: 37 | 38 | Copyright (C) 2010 Sebastian Spaeth 39 | 40 | and is licensed under the GPL version 3, 41 | see `/usr/share/common-licenses/GPL-3'. 42 | 43 | -------------------------------------------------------------------------------- /bindings/python/debian/docs: -------------------------------------------------------------------------------- 1 | README 2 | -------------------------------------------------------------------------------- /bindings/python/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | %: 4 | dh $@ 5 | -------------------------------------------------------------------------------- /bindings/python/docs/source/database.rst: -------------------------------------------------------------------------------- 1 | :class:`Database` -- The underlying notmuch database 2 | ==================================================== 3 | 4 | .. currentmodule:: notmuch 5 | 6 | .. autoclass:: Database([path=None[, create=False[, mode=MODE.READ_ONLY]]]) 7 | 8 | .. automethod:: create 9 | 10 | .. automethod:: open(path, status=MODE.READ_ONLY) 11 | 12 | .. automethod:: close 13 | 14 | .. automethod:: get_path 15 | 16 | .. automethod:: get_version 17 | 18 | .. automethod:: needs_upgrade 19 | 20 | .. automethod:: upgrade 21 | 22 | .. automethod:: begin_atomic 23 | 24 | .. automethod:: end_atomic 25 | 26 | .. automethod:: get_directory 27 | 28 | .. automethod:: add_message 29 | 30 | .. automethod:: remove_message 31 | 32 | .. automethod:: find_message 33 | 34 | .. automethod:: find_message_by_filename 35 | 36 | .. automethod:: get_all_tags 37 | 38 | .. automethod:: create_query 39 | 40 | .. attribute:: Database.MODE 41 | 42 | Defines constants that are used as the mode in which to open a database. 43 | 44 | MODE.READ_ONLY 45 | Open the database in read-only mode 46 | 47 | MODE.READ_WRITE 48 | Open the database in read-write mode 49 | -------------------------------------------------------------------------------- /bindings/python/docs/source/filesystem.rst: -------------------------------------------------------------------------------- 1 | Files and directories 2 | ===================== 3 | 4 | .. currentmodule:: notmuch 5 | 6 | :class:`Filenames` -- An iterator over filenames 7 | ------------------------------------------------ 8 | 9 | .. autoclass:: Filenames 10 | 11 | .. automethod:: Filenames.__len__ 12 | 13 | :class:`Directoy` -- A directory entry in the database 14 | ------------------------------------------------------ 15 | 16 | .. autoclass:: Directory 17 | 18 | .. automethod:: Directory.get_child_files 19 | 20 | .. automethod:: Directory.get_child_directories 21 | 22 | .. automethod:: Directory.get_mtime 23 | 24 | .. automethod:: Directory.set_mtime 25 | 26 | .. autoattribute:: Directory.mtime 27 | 28 | .. autoattribute:: Directory.path 29 | -------------------------------------------------------------------------------- /bindings/python/docs/source/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to :mod:`notmuch`'s documentation 2 | ========================================= 3 | 4 | .. currentmodule:: notmuch 5 | 6 | The :mod:`notmuch` module provides an interface to the `notmuch 7 | `_ functionality, directly interfacing to a 8 | shared notmuch library. Within :mod:`notmuch`, the classes 9 | :class:`Database`, :class:`Query` provide most of the core 10 | functionality, returning :class:`Threads`, :class:`Messages` and 11 | :class:`Tags`. 12 | 13 | .. moduleauthor:: Sebastian Spaeth 14 | 15 | :License: This module is covered under the GNU GPL v3 (or later). 16 | 17 | .. toctree:: 18 | :maxdepth: 1 19 | 20 | quickstart 21 | notes 22 | status_and_errors 23 | database 24 | query 25 | messages 26 | message 27 | tags 28 | threads 29 | thread 30 | filesystem 31 | 32 | Indices and tables 33 | ================== 34 | 35 | * :ref:`genindex` 36 | * :ref:`search` 37 | -------------------------------------------------------------------------------- /bindings/python/docs/source/message.rst: -------------------------------------------------------------------------------- 1 | :class:`Message` -- A single message 2 | ==================================== 3 | 4 | .. currentmodule:: notmuch 5 | 6 | .. autoclass:: Message 7 | 8 | .. automethod:: get_message_id 9 | 10 | .. automethod:: get_thread_id 11 | 12 | .. automethod:: get_replies 13 | 14 | .. automethod:: get_filename 15 | 16 | .. automethod:: get_filenames 17 | 18 | .. attribute:: FLAG 19 | 20 | FLAG.MATCH 21 | This flag is automatically set by a 22 | Query.search_threads on those messages that match the 23 | query. This allows us to distinguish matches from the rest 24 | of the messages in that thread. 25 | 26 | .. automethod:: get_flag 27 | 28 | .. automethod:: set_flag 29 | 30 | .. automethod:: get_date 31 | 32 | .. automethod:: get_header 33 | 34 | .. automethod:: get_tags 35 | 36 | .. automethod:: maildir_flags_to_tags 37 | 38 | .. automethod:: tags_to_maildir_flags 39 | 40 | .. automethod:: remove_tag 41 | 42 | .. automethod:: add_tag 43 | 44 | .. automethod:: remove_all_tags 45 | 46 | .. automethod:: freeze 47 | 48 | .. automethod:: thaw 49 | 50 | .. automethod:: __str__ 51 | -------------------------------------------------------------------------------- /bindings/python/docs/source/messages.rst: -------------------------------------------------------------------------------- 1 | :class:`Messages` -- A bunch of messages 2 | ======================================== 3 | 4 | .. currentmodule:: notmuch 5 | 6 | .. autoclass:: Messages 7 | 8 | .. automethod:: collect_tags 9 | 10 | .. method:: __len__() 11 | 12 | .. warning:: 13 | 14 | :meth:`__len__` was removed in version 0.6 as it exhausted the iterator and broke 15 | list(Messages()). Use the :meth:`Query.count_messages` function or use `len(list(msgs))`. 16 | -------------------------------------------------------------------------------- /bindings/python/docs/source/notes.rst: -------------------------------------------------------------------------------- 1 | Interfacing with notmuch 2 | ======================== 3 | 4 | .. todo:: move the note about talloc out of the code 5 | 6 | .. automodule:: notmuch 7 | -------------------------------------------------------------------------------- /bindings/python/docs/source/query.rst: -------------------------------------------------------------------------------- 1 | :class:`Query` -- A search query 2 | ================================ 3 | 4 | .. currentmodule:: notmuch 5 | 6 | .. autoclass:: Query 7 | 8 | .. automethod:: create 9 | 10 | .. attribute:: Query.SORT 11 | 12 | Defines constants that are used as the mode in which to open a database. 13 | 14 | SORT.OLDEST_FIRST 15 | Sort by message date, oldest first. 16 | 17 | SORT.NEWEST_FIRST 18 | Sort by message date, newest first. 19 | 20 | SORT.MESSAGE_ID 21 | Sort by email message ID. 22 | 23 | SORT.UNSORTED 24 | Do not apply a special sort order (returns results in document id 25 | order). 26 | 27 | .. automethod:: set_sort 28 | 29 | .. attribute:: sort 30 | 31 | Instance attribute :attr:`sort` contains the sort order (see 32 | :attr:`Query.SORT`) if explicitely specified via 33 | :meth:`set_sort`. By default it is set to `None`. 34 | 35 | .. automethod:: search_threads 36 | 37 | .. automethod:: search_messages 38 | 39 | .. automethod:: count_messages 40 | 41 | .. automethod:: count_threads 42 | -------------------------------------------------------------------------------- /bindings/python/docs/source/quickstart.rst: -------------------------------------------------------------------------------- 1 | Quickstart and examples 2 | ======================= 3 | 4 | .. todo:: write a nice introduction 5 | .. todo:: improve the examples 6 | 7 | Notmuch can be imported as:: 8 | 9 | import notmuch 10 | 11 | or:: 12 | 13 | from notmuch import Query, Database 14 | 15 | db = Database('path', create=True) 16 | msgs = Query(db, 'from:myself').search_messages() 17 | 18 | for msg in msgs: 19 | print(msg) 20 | -------------------------------------------------------------------------------- /bindings/python/docs/source/tags.rst: -------------------------------------------------------------------------------- 1 | :class:`Tags` -- Notmuch tags 2 | ----------------------------- 3 | 4 | .. currentmodule:: notmuch 5 | 6 | .. autoclass:: Tags 7 | :members: 8 | 9 | .. method:: __len__ 10 | 11 | .. warning:: 12 | 13 | :meth:`__len__` was removed in version 0.6 as it exhausted the iterator and broke 14 | list(Tags()). Use :meth:`len(list(msgs))` instead if you need to know the number of 15 | tags. 16 | 17 | .. automethod:: __str__ 18 | -------------------------------------------------------------------------------- /bindings/python/docs/source/thread.rst: -------------------------------------------------------------------------------- 1 | :class:`Thread` -- A single thread 2 | ================================== 3 | 4 | .. currentmodule:: notmuch 5 | 6 | .. autoclass:: Thread 7 | 8 | .. automethod:: get_thread_id 9 | 10 | .. automethod:: get_total_messages 11 | 12 | .. automethod:: get_toplevel_messages 13 | 14 | .. automethod:: get_matched_messages 15 | 16 | .. automethod:: get_authors 17 | 18 | .. automethod:: get_subject 19 | 20 | .. automethod:: get_oldest_date 21 | 22 | .. automethod:: get_newest_date 23 | 24 | .. automethod:: get_tags 25 | 26 | .. automethod:: __str__ 27 | -------------------------------------------------------------------------------- /bindings/python/docs/source/threads.rst: -------------------------------------------------------------------------------- 1 | :class:`Threads` -- Threads iterator 2 | ==================================== 3 | 4 | .. currentmodule:: notmuch 5 | 6 | .. autoclass:: Threads 7 | 8 | .. automethod:: __len__ 9 | 10 | .. automethod:: __str__ 11 | -------------------------------------------------------------------------------- /bindings/python/notmuch/version.py: -------------------------------------------------------------------------------- 1 | # this file should be kept in sync with ../../../version 2 | __VERSION__ = '0.18.1' 3 | -------------------------------------------------------------------------------- /bindings/ruby/.gitignore: -------------------------------------------------------------------------------- 1 | # .gitignore for bindings/ruby 2 | 3 | # Generated files 4 | Makefile 5 | mkmf.log 6 | notmuch.so 7 | -------------------------------------------------------------------------------- /bindings/ruby/extconf.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # coding: utf-8 3 | # Copyright 2010, 2011, 2012 Ali Polatel 4 | # Distributed under the terms of the GNU General Public License v3 5 | 6 | require 'mkmf' 7 | 8 | dir = File.join('..', '..', 'lib') 9 | 10 | # includes 11 | $INCFLAGS = "-I#{dir} #{$INCFLAGS}" 12 | 13 | # make sure there are no undefined symbols 14 | $LDFLAGS += ' -Wl,--no-undefined' 15 | 16 | def have_local_library(lib, path, func, headers = nil) 17 | checking_for checking_message(func, lib) do 18 | lib = File.join(path, lib) 19 | if try_func(func, lib, headers) 20 | $LOCAL_LIBS += lib 21 | end 22 | end 23 | end 24 | 25 | if not have_local_library('libnotmuch.so', dir, 'notmuch_database_create', 'notmuch.h') 26 | exit 1 27 | end 28 | 29 | # Create Makefile 30 | dir_config('notmuch') 31 | create_makefile('notmuch') 32 | -------------------------------------------------------------------------------- /bindings/ruby/filenames.c: -------------------------------------------------------------------------------- 1 | /* The Ruby interface to the notmuch mail library 2 | * 3 | * Copyright © 2010 Ali Polatel 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/ . 17 | * 18 | * Author: Ali Polatel 19 | */ 20 | 21 | #include "defs.h" 22 | 23 | /* 24 | * call-seq: FILENAMES.destroy! => nil 25 | * 26 | * Destroys the filenames, freeing all resources allocated for it. 27 | */ 28 | VALUE 29 | notmuch_rb_filenames_destroy (VALUE self) 30 | { 31 | notmuch_filenames_t *fnames; 32 | 33 | Data_Get_Notmuch_FileNames (self, fnames); 34 | 35 | notmuch_filenames_destroy (fnames); 36 | DATA_PTR (self) = NULL; 37 | 38 | return Qnil; 39 | } 40 | 41 | /* 42 | * call-seq: FILENAMES.each {|item| block } => FILENAMES 43 | * 44 | * Calls +block+ once for each element in +self+, passing that element as a 45 | * parameter. 46 | */ 47 | VALUE 48 | notmuch_rb_filenames_each (VALUE self) 49 | { 50 | notmuch_filenames_t *fnames; 51 | 52 | Data_Get_Notmuch_FileNames (self, fnames); 53 | 54 | for (; notmuch_filenames_valid (fnames); notmuch_filenames_move_to_next (fnames)) 55 | rb_yield (rb_str_new2 (notmuch_filenames_get (fnames))); 56 | 57 | return self; 58 | } 59 | -------------------------------------------------------------------------------- /bindings/ruby/rdoc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if test -z "$RDOC"; then 4 | RDOC=rdoc 5 | if which rdoc19 >/dev/null 2>&1; then 6 | RDOC=rdoc19 7 | fi 8 | fi 9 | 10 | set -e 11 | set -x 12 | 13 | $RDOC --main 'Notmuch' --title 'Notmuch Ruby API' --op ruby *.c 14 | 15 | if test "$1" = "--upload"; then 16 | rsync -avze ssh --delete --partial --progress ruby bach.exherbo.org:public_html/notmuch/ 17 | fi 18 | -------------------------------------------------------------------------------- /bindings/ruby/tags.c: -------------------------------------------------------------------------------- 1 | /* The Ruby interface to the notmuch mail library 2 | * 3 | * Copyright © 2010, 2011 Ali Polatel 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/ . 17 | * 18 | * Author: Ali Polatel 19 | */ 20 | 21 | #include "defs.h" 22 | 23 | /* 24 | * call-seq: TAGS.destroy! => nil 25 | * 26 | * Destroys the tags, freeing all resources allocated for it. 27 | */ 28 | VALUE 29 | notmuch_rb_tags_destroy (VALUE self) 30 | { 31 | notmuch_tags_t *tags; 32 | 33 | Data_Get_Notmuch_Tags (self, tags); 34 | 35 | notmuch_tags_destroy (tags); 36 | DATA_PTR (self) = NULL; 37 | 38 | return Qnil; 39 | } 40 | 41 | /* 42 | * call-seq: TAGS.each {|item| block } => TAGS 43 | * 44 | * Calls +block+ once for each element in +self+, passing that element as a 45 | * parameter. 46 | */ 47 | VALUE 48 | notmuch_rb_tags_each (VALUE self) 49 | { 50 | const char *tag; 51 | notmuch_tags_t *tags; 52 | 53 | Data_Get_Notmuch_Tags (self, tags); 54 | 55 | for (; notmuch_tags_valid (tags); notmuch_tags_move_to_next (tags)) { 56 | tag = notmuch_tags_get (tags); 57 | rb_yield (rb_str_new2 (tag)); 58 | } 59 | 60 | return self; 61 | } 62 | -------------------------------------------------------------------------------- /bindings/ruby/threads.c: -------------------------------------------------------------------------------- 1 | /* The Ruby interface to the notmuch mail library 2 | * 3 | * Copyright © 2010, 2011 Ali Polatel 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/ . 17 | * 18 | * Author: Ali Polatel 19 | */ 20 | 21 | #include "defs.h" 22 | 23 | /* 24 | * call-seq: THREADS.destroy! => nil 25 | * 26 | * Destroys the threads, freeing all resources allocated for it. 27 | */ 28 | VALUE 29 | notmuch_rb_threads_destroy (VALUE self) 30 | { 31 | notmuch_threads_t *threads; 32 | 33 | Data_Get_Struct (self, notmuch_threads_t, threads); 34 | 35 | notmuch_threads_destroy (threads); 36 | DATA_PTR (self) = NULL; 37 | 38 | return Qnil; 39 | } 40 | 41 | /* call-seq: THREADS.each {|item| block } => THREADS 42 | * 43 | * Calls +block+ once for each thread in +self+, passing that element as a 44 | * parameter. 45 | */ 46 | VALUE 47 | notmuch_rb_threads_each (VALUE self) 48 | { 49 | notmuch_thread_t *thread; 50 | notmuch_threads_t *threads; 51 | 52 | Data_Get_Notmuch_Threads (self, threads); 53 | 54 | for (; notmuch_threads_valid (threads); notmuch_threads_move_to_next (threads)) { 55 | thread = notmuch_threads_get (threads); 56 | rb_yield (Data_Wrap_Struct (notmuch_rb_cThread, NULL, NULL, thread)); 57 | } 58 | 59 | return self; 60 | } 61 | -------------------------------------------------------------------------------- /compat/.gitignore: -------------------------------------------------------------------------------- 1 | zlib.pc 2 | -------------------------------------------------------------------------------- /compat/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | $(MAKE) -C .. all 3 | 4 | .DEFAULT: 5 | $(MAKE) -C .. $@ 6 | -------------------------------------------------------------------------------- /compat/Makefile.local: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | 3 | dir := compat 4 | extra_cflags += -I$(srcdir)/$(dir) 5 | 6 | notmuch_compat_srcs := 7 | 8 | ifneq ($(HAVE_CANONICALIZE_FILE_NAME),1) 9 | notmuch_compat_srcs += $(dir)/canonicalize_file_name.c 10 | endif 11 | 12 | ifneq ($(HAVE_GETLINE),1) 13 | notmuch_compat_srcs += $(dir)/getline.c $(dir)/getdelim.c 14 | endif 15 | 16 | ifneq ($(HAVE_STRCASESTR),1) 17 | notmuch_compat_srcs += $(dir)/strcasestr.c 18 | endif 19 | 20 | ifneq ($(HAVE_STRSEP),1) 21 | notmuch_compat_srcs += $(dir)/strsep.c 22 | endif 23 | 24 | ifneq ($(HAVE_TIMEGM),1) 25 | notmuch_compat_srcs += $(dir)/timegm.c 26 | endif 27 | 28 | SRCS := $(SRCS) $(notmuch_compat_srcs) 29 | -------------------------------------------------------------------------------- /compat/README: -------------------------------------------------------------------------------- 1 | notmuch/compat 2 | 3 | This directory consists of three things: 4 | 5 | 1. Small programs used by the notmuch configure script to test for the 6 | availability of certain system features, (library functions, etc.). 7 | 8 | For example: have_getline.c 9 | 10 | 2. Compatibility implementations of those system features for systems 11 | that don't provide their own versions. 12 | 13 | For example: getline.c 14 | 15 | The compilation of these files is made conditional on the output of 16 | the test programs from [1]. 17 | 18 | 3. Macro definitions abstracting compiler differences (e.g. function 19 | attributes). 20 | 21 | For example: function-attributes.h 22 | -------------------------------------------------------------------------------- /compat/canonicalize_file_name.c: -------------------------------------------------------------------------------- 1 | #include "compat.h" 2 | #include 3 | #undef _GNU_SOURCE 4 | #include 5 | 6 | char * 7 | canonicalize_file_name (const char * path) 8 | { 9 | #ifdef PATH_MAX 10 | char *resolved_path = malloc (PATH_MAX+1); 11 | if (resolved_path == NULL) 12 | return NULL; 13 | 14 | return realpath (path, resolved_path); 15 | #else 16 | #error undefined PATH_MAX _and_ missing canonicalize_file_name not supported 17 | #endif 18 | } 19 | -------------------------------------------------------------------------------- /compat/check_asctime.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | struct tm tm; 7 | 8 | (void) asctime_r (&tm, NULL); 9 | 10 | return (0); 11 | } 12 | -------------------------------------------------------------------------------- /compat/check_getpwuid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | struct passwd passwd, *ignored; 7 | 8 | (void) getpwuid_r (0, &passwd, NULL, 0, &ignored); 9 | 10 | return (0); 11 | } 12 | -------------------------------------------------------------------------------- /compat/function-attributes.h: -------------------------------------------------------------------------------- 1 | /* function-attributes.h - Provides compiler abstractions for 2 | * function attributes 3 | * 4 | * Copyright (c) 2012 Justus Winter <4winter@informatik.uni-hamburg.de> 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see http://www.gnu.org/licenses/ . 18 | */ 19 | 20 | #ifndef FUNCTION_ATTRIBUTES_H 21 | #define FUNCTION_ATTRIBUTES_H 22 | 23 | /* clang provides this macro to test for support for function 24 | * attributes. If it isn't defined, this provides a compatibility 25 | * macro for other compilers. 26 | */ 27 | #ifndef __has_attribute 28 | #define __has_attribute(x) 0 29 | #endif 30 | 31 | /* Provide a NORETURN_ATTRIBUTE macro similar to PRINTF_ATTRIBUTE from 32 | * talloc. 33 | * 34 | * This attribute is understood by gcc since version 2.5. clang 35 | * provides support for testing for function attributes. 36 | */ 37 | #ifndef NORETURN_ATTRIBUTE 38 | #if (__GNUC__ >= 3 || \ 39 | (__GNUC__ == 2 && __GNUC_MINOR__ >= 5) || \ 40 | __has_attribute (noreturn)) 41 | #define NORETURN_ATTRIBUTE __attribute__ ((noreturn)) 42 | #else 43 | #define NORETURN_ATTRIBUTE 44 | #endif 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /compat/gen_zlib_pc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static const char *template = 5 | "prefix=/usr\n" 6 | "exec_prefix=${prefix}\n" 7 | "libdir=${exec_prefix}/lib\n" 8 | "\n" 9 | "Name: zlib\n" 10 | "Description: zlib compression library\n" 11 | "Version: %s\n" 12 | "Libs: -lz\n"; 13 | 14 | int main(void) 15 | { 16 | printf(template, ZLIB_VERSION); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /compat/getline.c: -------------------------------------------------------------------------------- 1 | /* getline.c --- Implementation of replacement getline function. 2 | Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; either version 3, or (at 7 | your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, but 10 | WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | 02110-1301, USA. */ 18 | 19 | /* Written by Simon Josefsson. */ 20 | 21 | #include "compat.h" 22 | 23 | #include 24 | 25 | ssize_t 26 | getline (char **lineptr, size_t *n, FILE *stream) 27 | { 28 | return getdelim (lineptr, n, '\n', stream); 29 | } 30 | -------------------------------------------------------------------------------- /compat/have_canonicalize_file_name.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | int main() 5 | { 6 | char *found; 7 | char *string; 8 | 9 | found = canonicalize_file_name (string); 10 | } 11 | -------------------------------------------------------------------------------- /compat/have_d_type.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | struct dirent ent; 6 | 7 | (void) ent.d_type; 8 | 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /compat/have_getline.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | ssize_t count = 0; 8 | size_t n = 0; 9 | char **lineptr = NULL; 10 | FILE *stream = NULL; 11 | 12 | count = getline(lineptr, &n, stream); 13 | } 14 | -------------------------------------------------------------------------------- /compat/have_strcasestr.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | int main() 5 | { 6 | char *found; 7 | const char *haystack, *needle; 8 | 9 | found = strcasestr(haystack, needle); 10 | } 11 | -------------------------------------------------------------------------------- /compat/have_strsep.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | int main() 5 | { 6 | char *found; 7 | char **stringp; 8 | const char *delim; 9 | 10 | found = strsep(stringp, delim); 11 | } 12 | -------------------------------------------------------------------------------- /compat/have_timegm.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "compat.h" 3 | 4 | int main() 5 | { 6 | return (int) timegm((struct tm *)0); 7 | } 8 | -------------------------------------------------------------------------------- /compat/strcasestr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * slow simplistic reimplementation of strcasestr for systems that 3 | * don't include it in their library 4 | * 5 | * based on a GPL implementation in OpenTTD found under GPL v2 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License as 9 | published by the Free Software Foundation, version 2. 10 | 11 | This program is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19 | 02110-1301, USA. */ 20 | 21 | /* Imported into notmuch by Dirk Hohndel - original author unknown. */ 22 | 23 | #include 24 | 25 | #include "compat.h" 26 | 27 | char *strcasestr(const char *haystack, const char *needle) 28 | { 29 | size_t hay_len = strlen(haystack); 30 | size_t needle_len = strlen(needle); 31 | while (hay_len >= needle_len) { 32 | if (strncasecmp(haystack, needle, needle_len) == 0) 33 | return (char *) haystack; 34 | 35 | haystack++; 36 | hay_len--; 37 | } 38 | 39 | return NULL; 40 | } 41 | -------------------------------------------------------------------------------- /compat/timegm.c: -------------------------------------------------------------------------------- 1 | /* timegm.c --- Implementation of replacement timegm function. 2 | 3 | This program is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU General Public License as 5 | published by the Free Software Foundation; either version 3, or (at 6 | your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, but 9 | WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 16 | 02110-1301, USA. */ 17 | 18 | /* Copyright 2013 Blake Jones. */ 19 | 20 | #include 21 | #include "compat.h" 22 | 23 | static int 24 | leapyear (int year) 25 | { 26 | return ((year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0)); 27 | } 28 | 29 | /* 30 | * This is a simple implementation of timegm() which does what is needed 31 | * by create_output() -- just turns the "struct tm" into a GMT time_t. 32 | * It does not normalize any of the fields of the "struct tm", nor does 33 | * it set tm_wday or tm_yday. 34 | */ 35 | time_t 36 | timegm (struct tm *tm) 37 | { 38 | int monthlen[2][12] = { 39 | { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, 40 | { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, 41 | }; 42 | int year, month, days; 43 | 44 | days = 365 * (tm->tm_year - 70); 45 | for (year = 70; year < tm->tm_year; year++) { 46 | if (leapyear(1900 + year)) { 47 | days++; 48 | } 49 | } 50 | for (month = 0; month < tm->tm_mon; month++) { 51 | days += monthlen[leapyear(1900 + year)][month]; 52 | } 53 | days += tm->tm_mday - 1; 54 | 55 | return ((((days * 24) + tm->tm_hour) * 60 + tm->tm_min) * 60 + tm->tm_sec); 56 | } 57 | -------------------------------------------------------------------------------- /completion/Makefile: -------------------------------------------------------------------------------- 1 | # See Makefile.local for the list of files to be compiled in this 2 | # directory. 3 | all: 4 | $(MAKE) -C .. all 5 | 6 | .DEFAULT: 7 | $(MAKE) -C .. $@ 8 | -------------------------------------------------------------------------------- /completion/Makefile.local: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | 3 | dir := completion 4 | 5 | # The dir variable will be re-assigned to later, so we can't use it 6 | # directly in any shell commands. Instead we save its value in other, 7 | # private variables that we can use in the commands. 8 | bash_script := $(srcdir)/$(dir)/notmuch-completion.bash 9 | zsh_script := $(srcdir)/$(dir)/notmuch-completion.zsh 10 | 11 | install: install-$(dir) 12 | 13 | install-$(dir): 14 | @echo $@ 15 | ifeq ($(WITH_BASH),1) 16 | mkdir -p "$(DESTDIR)$(bash_completion_dir)" 17 | install -m0644 $(bash_script) "$(DESTDIR)$(bash_completion_dir)/notmuch" 18 | endif 19 | ifeq ($(WITH_ZSH),1) 20 | mkdir -p "$(DESTDIR)$(zsh_completion_dir)" 21 | install -m0644 $(zsh_script) "$(DESTDIR)$(zsh_completion_dir)/_notmuch" 22 | endif 23 | -------------------------------------------------------------------------------- /completion/README: -------------------------------------------------------------------------------- 1 | notmuch completion 2 | 3 | This directory contains support for various shells to automatically 4 | complete partially entered notmuch command lines. 5 | 6 | notmuch-completion.bash 7 | 8 | Command-line completion for the bash shell. This depends on 9 | bash-completion package [1] version 2.0, which depends on bash 10 | version 3.2 or later. 11 | 12 | [1] http://bash-completion.alioth.debian.org/ 13 | 14 | notmuch-completion.tcsh 15 | 16 | Command-line completion for the tcsh shell. 17 | 18 | notmuch-completion.zsh 19 | 20 | Command-line completion for the zsh shell. 21 | -------------------------------------------------------------------------------- /completion/notmuch-completion.tcsh: -------------------------------------------------------------------------------- 1 | set NOTMUCH_CMD=`notmuch help | awk '/\t/' | cut -f2 |grep -v '^$'` 2 | complete notmuch 'p/1/$NOTMUCH_CMD/' 3 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/.gitignore: -------------------------------------------------------------------------------- 1 | # gitignore for notmuch-deliver 2 | .*.swp 3 | *~ 4 | *.[oa] 5 | *.py[co] 6 | 7 | tags 8 | 9 | *.lo 10 | *.la 11 | 12 | .deps 13 | .libs 14 | Makefile.in 15 | Makefile 16 | 17 | gmon.out 18 | gprof* 19 | 20 | /INSTALL 21 | /aclocal.m4 22 | /autom4te.cache 23 | /config.guess 24 | /config.h 25 | /config.h.in 26 | /config.log 27 | /config.sub 28 | /config.status 29 | /configure 30 | /compile 31 | /depcomp 32 | /install-sh 33 | /missing 34 | /stamp-h1 35 | /libtool 36 | /ltmain.sh 37 | 38 | m4/libtool.m4 39 | m4/lt*.m4 40 | 41 | maildrop/numlib/config.h 42 | src/notmuch-deliver 43 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/.mailmap: -------------------------------------------------------------------------------- 1 | Ali Polatel 2 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/Makefile.am: -------------------------------------------------------------------------------- 1 | CLEANFILES= *~ 2 | MAINTAINERCLEANFILES= Makefile.in configure aclocal.m4 \ 3 | config.h config.h.in INSTALL 4 | ACLOCAL_AMFLAGS= -I m4 5 | AUTOMAKE_OPTIONS= dist-bzip2 no-dist-gzip std-options foreign 6 | SUBDIRS= maildrop/numlib src . 7 | 8 | doc_DATA= README.mkd 9 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/README.mkd: -------------------------------------------------------------------------------- 1 | ## About 2 | `notmuch-deliver` is a [maildir](http://cr.yp.to/proto/maildir.html) delivery 3 | tool. 4 | 5 | ## Overview 6 | `notmuch-deliver` is a [maildir](http://cr.yp.to/proto/maildir.html) delivery 7 | tool for [notmuch](http://notmuchmail.org) mail indexer. It reads from standard 8 | input, delivers the mail to the specified maildir and adds it to the notmuch 9 | database. This is meant as a convenient alternative to running `notmuch new` 10 | after mail delivery. 11 | 12 | ## Usage 13 | Here's a simple example for [maildrop](http://www.courier-mta.org/maildrop/): 14 | 15 | # Deliver local mail to $MAILDIR/.Local and add local tag. 16 | if (/^From: root/:h) 17 | { 18 | to "|notmuch-deliver -f -t local Local" 19 | } 20 | 21 | # Deliver lkml mail to $MAILDIR/.Lkml, add lkml tag and remove inbox tag. 22 | if (/^List-Id: linux-kernel@vger.kernel.org/:h) 23 | { 24 | to "|notmuch-deliver -f -t lkml -r inbox Lkml" 25 | } 26 | 27 | # Deliver the rest to $MAILDIR, adding personal tag 28 | to "|notmuch-deliver -t personal" 29 | 30 | ## Requirements 31 | - [notmuch](http://notmuchmail.org) shared library 32 | - [GLib](http://library.gnome.org/devel/glib/)-2.16 or newer 33 | 34 | ## Contribute 35 | Clone [git://github.com/alip/notmuch-deliver.git](git://github.com/alip/notmuch-deliver.git). 36 | Format patches are preferred. Either send a mail to me or poke me on IRC. 37 | My personal e-mail address is [alip@exherbo.org](mailto:alip@exherbo.org). 38 | I'm available on IRC as `alip` on [Freenode](http://freenode.net) and [OFTC](http://www.oftc.net). 39 | 40 | ## License 41 | You may redistribute this under the same terms as notmuch itself. 42 | 43 | 44 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # vim: set sw=4 et sts=4 tw=80 : 3 | 4 | die() { 5 | echo "$@" >&2 6 | exit 1 7 | } 8 | 9 | echo ">>> libtoolize --copy --force --automake" 10 | libtoolize --copy --force --automake || die "libtoolize failed" 11 | echo ">>> rm -f config.cache" 12 | rm -f config.cache 13 | echo ">>> aclocal -I m4" 14 | aclocal -I m4 || die "aclocal failed" 15 | echo ">>> autoheader" 16 | autoheader || die "autoheader failed" 17 | echo ">>> autoconf" 18 | autoconf || die "autoconf failed" 19 | echo ">>> automake --foreign --add-missing --copy" 20 | automake --foreign --add-missing --copy || die "automake failed" 21 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/maildrop/maildir/maildircreate.h: -------------------------------------------------------------------------------- 1 | #ifndef maildircreate_h 2 | #define maildircreate_h 3 | 4 | /* 5 | ** Copyright 1998 - 2003 Double Precision, Inc. 6 | ** See COPYING for distribution information. 7 | */ 8 | 9 | #if HAVE_CONFIG_H 10 | #include "config.h" 11 | #endif 12 | 13 | #include 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | 20 | /* Create messages in maildirs */ 21 | 22 | struct maildir_tmpcreate_info { 23 | const char *maildir; 24 | unsigned long msgsize; /* If known, 0 otherwise (must use requota later)*/ 25 | const char *uniq; /* You need when creating multiple msgs */ 26 | const char *hostname; /* If known, NULL otherwise */ 27 | int openmode; /* Default open mode */ 28 | int doordie; /* Loop until we get it right. */ 29 | char *tmpname; /* On exit, filename in tmp */ 30 | char *newname; /* On exit, filename in new */ 31 | }; 32 | 33 | #define maildir_tmpcreate_init(i) \ 34 | do \ 35 | { \ 36 | memset( (i), 0, sizeof(*(i))); \ 37 | (i)->openmode=0644; \ 38 | } while(0) 39 | 40 | int maildir_tmpcreate_fd(struct maildir_tmpcreate_info *); 41 | FILE *maildir_tmpcreate_fp(struct maildir_tmpcreate_info *); 42 | void maildir_tmpcreate_free(struct maildir_tmpcreate_info *); 43 | 44 | /* Move created message from tmp to new */ 45 | int maildir_movetmpnew(const char *tmpname, const char *newname); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/maildrop/maildir/maildirmkdir.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2000 Double Precision, Inc. 3 | ** See COPYING for distribution information. 4 | */ 5 | 6 | #if HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #if HAVE_UNISTD_H 15 | #include 16 | #endif 17 | #include 18 | 19 | #include "maildirmisc.h" 20 | 21 | 22 | int maildir_mkdir(const char *dir) 23 | { 24 | char *buf, *p; 25 | size_t l; 26 | 27 | if (dir == 0 || dir[0] == 0) 28 | { 29 | errno = EINVAL; 30 | return (-1); 31 | } 32 | l = strlen(dir); 33 | if ((buf = malloc(l + sizeof("/tmp"))) == 0) 34 | { 35 | errno = ENOMEM; 36 | return (-1); 37 | } 38 | strcpy(buf, dir); 39 | strcpy(buf+l, "/cur"); 40 | 41 | /* We do mkdir -p here */ 42 | 43 | p = buf+1; 44 | while ((p = strchr(p, '/')) != 0) 45 | { 46 | *p = '\0'; 47 | if (mkdir(buf, 0700) < 0 && errno != EEXIST) 48 | { 49 | free(buf); 50 | return (-1); 51 | } 52 | *p++ = '/'; 53 | } 54 | 55 | if (mkdir(buf, 0700) < 0 && errno != EEXIST) { 56 | free(buf); 57 | return (-1); 58 | } 59 | strcpy(buf+l, "/new"); 60 | if (mkdir(buf, 0700) < 0 && errno != EEXIST) { 61 | free(buf); 62 | return (-1); 63 | } 64 | /* 65 | * make /tmp last because this is the one we open first - 66 | * the existence of this directory implies the whole 67 | * Maildir structure is complete 68 | */ 69 | strcpy(buf+l, "/tmp"); 70 | if (mkdir(buf, 0700) < 0 && errno != EEXIST) { 71 | free(buf); 72 | return (-1); 73 | } 74 | free(buf); 75 | return (0); 76 | } 77 | 78 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/maildrop/numlib/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 1998 - 2004 Double Precision, Inc. See COPYING for 3 | # distribution information. 4 | 5 | 6 | CLEANFILES=$(noinst_DATA) 7 | noinst_LTLIBRARIES=libnumlib.la 8 | 9 | libnumlib_la_SOURCES=\ 10 | atotimet.c \ 11 | atouidt.c \ 12 | changeuidgid.c \ 13 | numlib.h \ 14 | strdevt.c \ 15 | strgidt.c \ 16 | strhdevt.c \ 17 | strhinot.c \ 18 | strhpidt.c \ 19 | strhtimet.c \ 20 | strinot.c \ 21 | strofft.c \ 22 | strpidt.c \ 23 | strsize.c \ 24 | strsizet.c \ 25 | strtimet.c \ 26 | struidt.c 27 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/maildrop/numlib/atotimet.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003 Double Precision, Inc. 3 | ** See COPYING for distribution information. 4 | */ 5 | 6 | #if HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif 9 | #include "numlib.h" 10 | #include 11 | 12 | 13 | LIBMAIL_STRIMPL(time_t, libmail_strtotime_t, libmail_atotime_t) 14 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/maildrop/numlib/atouidt.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003 Double Precision, Inc. 3 | ** See COPYING for distribution information. 4 | */ 5 | 6 | #if HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif 9 | #include "numlib.h" 10 | #include 11 | 12 | 13 | LIBMAIL_STRIMPL(uid_t, libmail_strtouid_t, libmail_atouid_t) 14 | LIBMAIL_STRIMPL(gid_t, libmail_strtogid_t, libmail_atogid_t) 15 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/maildrop/numlib/configure.in: -------------------------------------------------------------------------------- 1 | dnl Process this file with autoconf to produce a configure script. 2 | dnl 3 | dnl Copyright 1998 - 2010 Double Precision, Inc. See COPYING for 4 | dnl distribution information. 5 | 6 | AC_PREREQ(2.59) 7 | AC_INIT(numlib, 0.10, courier-users@lists.sourceforge.net) 8 | 9 | >confdefs.h # Kill PACKAGE_ macros 10 | 11 | AC_CONFIG_SRCDIR([atotimet.c]) 12 | AM_CONFIG_HEADER([config.h]) 13 | AM_INIT_AUTOMAKE([foreign no-define]) 14 | 15 | dnl Checks for programs. 16 | AC_PROG_AWK 17 | AC_PROG_CC 18 | AC_PROG_INSTALL 19 | AC_PROG_LN_S 20 | AC_PROG_LIBTOOL 21 | 22 | if test "$GCC" = "yes" 23 | then 24 | CFLAGS="$CFLAGS -Wall" 25 | fi 26 | 27 | dnl Checks for libraries. 28 | 29 | dnl Checks for header files. 30 | 31 | AC_CHECK_HEADERS(unistd.h stdint.h) 32 | 33 | AC_CHECK_TYPE(int64_t, [ : ], 34 | [ 35 | AC_DEFINE_UNQUOTED(int64_t,long long,[default definition of int64_t]) 36 | ]) 37 | 38 | dnl Checks for typedefs, structures, and compiler characteristics. 39 | AC_TYPE_UID_T 40 | AC_TYPE_PID_T 41 | AC_SYS_LARGEFILE 42 | 43 | dnl Checks for library functions. 44 | 45 | AC_CHECK_FUNCS(setgroups initgroups) 46 | AC_OUTPUT(Makefile) 47 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/maildrop/numlib/strdevt.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2003 Double Precision, Inc. 3 | ** See COPYING for distribution information. 4 | */ 5 | 6 | #if HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif 9 | #include "numlib.h" 10 | #include 11 | 12 | 13 | char *libmail_str_dev_t(dev_t t, char *arg) 14 | { 15 | char buf[NUMBUFSIZE]; 16 | char *p=buf+sizeof(buf)-1; 17 | 18 | *p=0; 19 | do 20 | { 21 | *--p= '0' + (t % 10); 22 | t=t / 10; 23 | } while(t); 24 | return (strcpy(arg, p)); 25 | } 26 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/maildrop/numlib/strgidt.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 1998 - 2000 Double Precision, Inc. 3 | ** See COPYING for distribution information. 4 | */ 5 | 6 | #if HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif 9 | #include "numlib.h" 10 | #include 11 | 12 | 13 | char *libmail_str_gid_t(gid_t t, char *arg) 14 | { 15 | char buf[NUMBUFSIZE]; 16 | char *p=buf+sizeof(buf)-1; 17 | 18 | *p=0; 19 | do 20 | { 21 | *--p= '0' + (t % 10); 22 | t=t / 10; 23 | } while(t); 24 | return (strcpy(arg, p)); 25 | } 26 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/maildrop/numlib/strhdevt.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 1998 - 2003 Double Precision, Inc. 3 | ** See COPYING for distribution information. 4 | */ 5 | 6 | #if HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif 9 | #include "numlib.h" 10 | #include 11 | 12 | 13 | static const char xdigit[]="0123456789ABCDEF"; 14 | 15 | char *libmail_strh_dev_t(dev_t t, char *arg) 16 | { 17 | char buf[sizeof(t)*2+1]; 18 | char *p=buf+sizeof(buf)-1; 19 | unsigned i; 20 | 21 | *p=0; 22 | for (i=0; i 11 | 12 | 13 | static const char xdigit[]="0123456789ABCDEF"; 14 | 15 | char *libmail_strh_ino_t(ino_t t, char *arg) 16 | { 17 | char buf[sizeof(t)*2+1]; 18 | char *p=buf+sizeof(buf)-1; 19 | unsigned i; 20 | 21 | *p=0; 22 | for (i=0; i 11 | 12 | 13 | static const char xdigit[]="0123456789ABCDEF"; 14 | 15 | char *libmail_strh_pid_t(pid_t t, char *arg) 16 | { 17 | char buf[sizeof(t)*2+1]; 18 | char *p=buf+sizeof(buf)-1; 19 | unsigned i; 20 | 21 | *p=0; 22 | for (i=0; i 11 | 12 | 13 | static const char xdigit[]="0123456789ABCDEF"; 14 | 15 | char *libmail_strh_time_t(time_t t, char *arg) 16 | { 17 | char buf[sizeof(t)*2+1]; 18 | char *p=buf+sizeof(buf)-1; 19 | unsigned i; 20 | 21 | *p=0; 22 | for (i=0; i 11 | 12 | 13 | char *libmail_str_ino_t(ino_t t, char *arg) 14 | { 15 | char buf[NUMBUFSIZE]; 16 | char *p=buf+sizeof(buf)-1; 17 | 18 | *p=0; 19 | do 20 | { 21 | *--p= '0' + (t % 10); 22 | t=t / 10; 23 | } while(t); 24 | return (strcpy(arg, p)); 25 | } 26 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/maildrop/numlib/strofft.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 1998 - 2010 Double Precision, Inc. 3 | ** See COPYING for distribution information. 4 | */ 5 | 6 | #if HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif 9 | #include "numlib.h" 10 | #include 11 | 12 | 13 | char *libmail_str_off_t(off_t t, char *arg) 14 | { 15 | char buf[NUMBUFSIZE]; 16 | char *p=buf+sizeof(buf)-1; 17 | int isneg=0; 18 | 19 | if (t < 0) 20 | { 21 | t= -t; 22 | isneg=1; 23 | } 24 | 25 | *p=0; 26 | do 27 | { 28 | *--p= '0' + (t % 10); 29 | t=t / 10; 30 | } while(t); 31 | 32 | if (isneg) 33 | *--p='-'; 34 | 35 | return (strcpy(arg, p)); 36 | } 37 | 38 | char *libmail_str_int64_t(int64_t t, char *arg) 39 | { 40 | char buf[NUMBUFSIZE]; 41 | char *p=buf+sizeof(buf)-1; 42 | int isneg=0; 43 | 44 | if (t < 0) 45 | { 46 | t= -t; 47 | isneg=1; 48 | } 49 | 50 | *p=0; 51 | do 52 | { 53 | *--p= '0' + (t % 10); 54 | t=t / 10; 55 | } while(t); 56 | 57 | if (isneg) 58 | *--p='-'; 59 | 60 | return (strcpy(arg, p)); 61 | } 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/maildrop/numlib/strpidt.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 1998 - 2000 Double Precision, Inc. 3 | ** See COPYING for distribution information. 4 | */ 5 | 6 | #if HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif 9 | #include "numlib.h" 10 | #include 11 | 12 | 13 | char *libmail_str_pid_t(pid_t t, char *arg) 14 | { 15 | char buf[NUMBUFSIZE]; 16 | char *p=buf+sizeof(buf)-1; 17 | 18 | *p=0; 19 | do 20 | { 21 | *--p= '0' + (t % 10); 22 | t=t / 10; 23 | } while(t); 24 | return (strcpy(arg, p)); 25 | } 26 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/maildrop/numlib/strsize.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 2001 Double Precision, Inc. 3 | ** See COPYING for distribution information. 4 | */ 5 | 6 | #if HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif 9 | #include "numlib.h" 10 | #include 11 | 12 | 13 | static void cat_n(char *buf, unsigned long n) 14 | { 15 | char bb[NUMBUFSIZE+1]; 16 | char *p=bb+sizeof(bb)-1; 17 | 18 | *p=0; 19 | do 20 | { 21 | *--p = "0123456789"[n % 10]; 22 | n=n/10; 23 | } while (n); 24 | strcat(buf, p); 25 | } 26 | 27 | char *libmail_str_sizekb(unsigned long n, char *sizebuf) 28 | { 29 | /* If size is less than 1K bytes, display it as 0.xK */ 30 | 31 | if (n < 1024) 32 | { 33 | strcpy(sizebuf, "0."); 34 | cat_n(sizebuf, (int)(10 * n / 1024 )); 35 | strcat(sizebuf, "K"); 36 | } 37 | /* If size is less than 1 meg, display is as xK */ 38 | 39 | else if (n < 1024 * 1024) 40 | { 41 | *sizebuf=0; 42 | cat_n(sizebuf, (unsigned long)(n+512)/1024); 43 | strcat(sizebuf, "K"); 44 | } 45 | 46 | /* Otherwise, display in megabytes */ 47 | 48 | else 49 | { 50 | unsigned long nm=(double)n / (1024.0 * 1024.0) * 10; 51 | 52 | *sizebuf=0; 53 | cat_n( sizebuf, nm / 10); 54 | strcat(sizebuf, "."); 55 | cat_n( sizebuf, nm % 10); 56 | strcat(sizebuf, "M"); 57 | } 58 | 59 | return (sizebuf); 60 | } 61 | 62 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/maildrop/numlib/strsizet.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 1998 - 2000 Double Precision, Inc. 3 | ** See COPYING for distribution information. 4 | */ 5 | 6 | #if HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif 9 | #include "numlib.h" 10 | #include 11 | 12 | 13 | char *libmail_str_size_t(size_t t, char *arg) 14 | { 15 | char buf[NUMBUFSIZE]; 16 | char *p=buf+sizeof(buf)-1; 17 | 18 | *p=0; 19 | do 20 | { 21 | *--p= '0' + (t % 10); 22 | t=t / 10; 23 | } while(t); 24 | return (strcpy(arg, p)); 25 | } 26 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/maildrop/numlib/strtimet.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 1998 - 2000 Double Precision, Inc. 3 | ** See COPYING for distribution information. 4 | */ 5 | 6 | #if HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif 9 | #include "numlib.h" 10 | #include 11 | 12 | 13 | char *libmail_str_time_t(time_t t, char *arg) 14 | { 15 | char buf[NUMBUFSIZE]; 16 | char *p=buf+sizeof(buf)-1; 17 | 18 | *p=0; 19 | do 20 | { 21 | *--p= '0' + (t % 10); 22 | t=t / 10; 23 | } while(t); 24 | return (strcpy(arg, p)); 25 | } 26 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/maildrop/numlib/struidt.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright 1998 - 2000 Double Precision, Inc. 3 | ** See COPYING for distribution information. 4 | */ 5 | 6 | #if HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif 9 | #include "numlib.h" 10 | #include 11 | 12 | 13 | char *libmail_str_uid_t(uid_t t, char *arg) 14 | { 15 | char buf[NUMBUFSIZE]; 16 | char *p=buf+sizeof(buf)-1; 17 | 18 | *p=0; 19 | do 20 | { 21 | *--p= '0' + (t % 10); 22 | t=t / 10; 23 | } while(t); 24 | return (strcpy(arg, p)); 25 | } 26 | -------------------------------------------------------------------------------- /contrib/notmuch-deliver/src/Makefile.am: -------------------------------------------------------------------------------- 1 | DEFS+= -DGITHEAD=\"$(GITHEAD)\" 2 | AM_CPPFLAGS= \ 3 | -I$(top_builddir)/maildrop/numlib \ 4 | -I$(top_srcdir)/maildrop \ 5 | -I$(top_srcdir)/maildrop/maildir 6 | AM_CFLAGS= @NOTMUCH_DELIVER_CFLAGS@ $(glib_CFLAGS) 7 | 8 | noinst_HEADERS=\ 9 | $(top_srcdir)/maildrop/maildir/maildircreate.h \ 10 | $(top_srcdir)/maildrop/maildir/maildirmisc.h 11 | 12 | bin_PROGRAMS=\ 13 | notmuch-deliver 14 | 15 | notmuch_deliver_SOURCES=\ 16 | $(top_srcdir)/maildrop/maildir/maildircreate.c \ 17 | $(top_srcdir)/maildrop/maildir/maildiropen.c \ 18 | $(top_srcdir)/maildrop/maildir/maildirmkdir.c \ 19 | main.c 20 | notmuch_deliver_LDADD=\ 21 | $(top_builddir)/maildrop/numlib/libnumlib.la \ 22 | $(glib_LIBS) 23 | -------------------------------------------------------------------------------- /contrib/notmuch-mutt/.gitignore: -------------------------------------------------------------------------------- 1 | notmuch-mutt.1 2 | README.html 3 | -------------------------------------------------------------------------------- /contrib/notmuch-mutt/Makefile: -------------------------------------------------------------------------------- 1 | NAME = notmuch-mutt 2 | 3 | all: $(NAME) $(NAME).1 4 | 5 | $(NAME).1: $(NAME) 6 | pod2man $< > $@ 7 | 8 | README.html: README 9 | markdown $< > $@ 10 | 11 | clean: 12 | rm -f notmuch-mutt.1 README.html 13 | -------------------------------------------------------------------------------- /contrib/notmuch-mutt/notmuch-mutt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclements/notmuch/658a00e7c809cc4e3076aab28e105d3761086451/contrib/notmuch-mutt/notmuch-mutt -------------------------------------------------------------------------------- /contrib/notmuch-mutt/notmuch-mutt.rc: -------------------------------------------------------------------------------- 1 | macro index \ 2 | "set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key\ 3 | notmuch-mutt -r --prompt search\ 4 | `echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`\ 5 | set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key" \ 6 | "notmuch: search mail" 7 | 8 | macro index \ 9 | "set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key\ 10 | notmuch-mutt -r thread\ 11 | `echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`\ 12 | set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key" \ 13 | "notmuch: reconstruct thread" 14 | 15 | macro index \ 16 | "set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key\ 17 | notmuch-mutt tag -- -inbox\ 18 | set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key" \ 19 | "notmuch: remove message from inbox" 20 | -------------------------------------------------------------------------------- /contrib/notmuch-vim/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all help install link symlink 2 | 3 | files = plugin/notmuch.vim \ 4 | $(wildcard syntax/notmuch-*.vim) 5 | prefix = $(HOME)/.vim 6 | destdir = $(prefix)/plugin 7 | 8 | INSTALL = install -D -m644 9 | 10 | all: help 11 | 12 | help: 13 | @echo "I don't actually build anything, but I will help you install" 14 | @echo "notmuch support for vim." 15 | @echo 16 | @echo " make install - copy plugin scripts and syntax files to ~/.vim" 17 | @echo " make symlink - create symlinks in ~/.vim (useful for development)" 18 | 19 | install: 20 | @for x in $(files); do $(INSTALL) $(CURDIR)/$$x $(prefix)/$$x; done 21 | 22 | link symlink: INSTALL = ln -fs 23 | link symlink: install 24 | -------------------------------------------------------------------------------- /contrib/notmuch-vim/notmuch.yaml: -------------------------------------------------------------------------------- 1 | addon: notmuch 2 | description: "notmuch mail user interface" 3 | files: 4 | - plugin/notmuch.vim 5 | - syntax/notmuch-compose.vim 6 | - syntax/notmuch-folders.vim 7 | - syntax/notmuch-search.vim 8 | - syntax/notmuch-show.vim 9 | -------------------------------------------------------------------------------- /contrib/notmuch-vim/syntax/notmuch-compose.vim: -------------------------------------------------------------------------------- 1 | runtime! syntax/mail.vim 2 | 3 | syntax region nmComposeHelp contains=nmComposeHelpLine start='^Notmuch-Help:\%1l' end='^\(Notmuch-Help:\)\@!' 4 | syntax match nmComposeHelpLine /Notmuch-Help:/ contained 5 | 6 | highlight link nmComposeHelp Include 7 | highlight link nmComposeHelpLine Error 8 | -------------------------------------------------------------------------------- /contrib/notmuch-vim/syntax/notmuch-folders.vim: -------------------------------------------------------------------------------- 1 | " notmuch folders mode syntax file 2 | 3 | syntax region nmFoldersCount start='^' end='\%10v' 4 | syntax region nmFoldersName start='\%11v' end='\%31v' 5 | syntax match nmFoldersSearch /([^()]\+)$/ 6 | 7 | highlight link nmFoldersCount Statement 8 | highlight link nmFoldersName Type 9 | highlight link nmFoldersSearch String 10 | 11 | highlight CursorLine term=reverse cterm=reverse gui=reverse 12 | 13 | -------------------------------------------------------------------------------- /contrib/notmuch-vim/syntax/notmuch-git-diff.vim: -------------------------------------------------------------------------------- 1 | syn match diffRemoved "^-.*" 2 | syn match diffAdded "^+.*" 3 | 4 | syn match diffSeparator "^---$" 5 | syn match diffSubname " @@..*"ms=s+3 contained 6 | syn match diffLine "^@.*" contains=diffSubname 7 | 8 | syn match diffFile "^diff .*" 9 | syn match diffNewFile "^+++ .*" 10 | syn match diffOldFile "^--- .*" 11 | 12 | hi def link diffOldFile diffFile 13 | hi def link diffNewFile diffFile 14 | 15 | hi def link diffFile Type 16 | hi def link diffRemoved Special 17 | hi def link diffAdded Identifier 18 | hi def link diffLine Statement 19 | hi def link diffSubname PreProc 20 | 21 | syntax match gitDiffStatLine /^ .\{-}\zs[+-]\+$/ contains=gitDiffStatAdd,gitDiffStatDelete 22 | syntax match gitDiffStatAdd /+/ contained 23 | syntax match gitDiffStatDelete /-/ contained 24 | 25 | hi def link gitDiffStatAdd diffAdded 26 | hi def link gitDiffStatDelete diffRemoved 27 | -------------------------------------------------------------------------------- /contrib/notmuch-vim/syntax/notmuch-search.vim: -------------------------------------------------------------------------------- 1 | syntax region nmSearch start=/^/ end=/$/ oneline contains=nmSearchDate 2 | syntax match nmSearchDate /^.\{-13}/ contained nextgroup=nmSearchNum 3 | syntax match nmSearchNum /.\{-4}/ contained nextgroup=nmSearchFrom 4 | syntax match nmSearchFrom /.\{-21}/ contained nextgroup=nmSearchSubject 5 | syntax match nmSearchSubject /.\{0,}\(([^()]\+)$\)\@=/ contained nextgroup=nmSearchTags 6 | syntax match nmSearchTags /.\+$/ contained 7 | 8 | highlight link nmSearchDate Statement 9 | highlight link nmSearchNum Type 10 | highlight link nmSearchFrom Include 11 | highlight link nmSearchSubject Normal 12 | highlight link nmSearchTags String 13 | -------------------------------------------------------------------------------- /contrib/notmuch-vim/syntax/notmuch-show.vim: -------------------------------------------------------------------------------- 1 | " notmuch show mode syntax file 2 | 3 | syntax cluster nmShowMsgDesc contains=nmShowMsgDescWho,nmShowMsgDescDate,nmShowMsgDescTags 4 | syntax match nmShowMsgDescWho /[^)]\+)/ contained 5 | syntax match nmShowMsgDescDate / ([^)]\+[0-9]) / contained 6 | syntax match nmShowMsgDescTags /([^)]\+)$/ contained 7 | 8 | syntax cluster nmShowMsgHead contains=nmShowMsgHeadKey,nmShowMsgHeadVal 9 | syntax match nmShowMsgHeadKey /^[^:]\+: / contained 10 | syntax match nmShowMsgHeadVal /^\([^:]\+: \)\@<=.*/ contained 11 | 12 | syntax cluster nmShowMsgBody contains=@nmShowMsgBodyMail,@nmShowMsgBodyGit 13 | syntax include @nmShowMsgBodyMail syntax/mail.vim 14 | 15 | silent! syntax include @nmShowMsgBodyGit syntax/notmuch-git-diff.vim 16 | 17 | highlight nmShowMsgDescWho term=reverse cterm=reverse gui=reverse 18 | highlight link nmShowMsgDescDate Type 19 | highlight link nmShowMsgDescTags String 20 | 21 | highlight link nmShowMsgHeadKey Macro 22 | "highlight link nmShowMsgHeadVal NONE 23 | 24 | highlight Folded term=reverse ctermfg=LightGrey ctermbg=Black guifg=LightGray guibg=Black 25 | -------------------------------------------------------------------------------- /debian/.gitignore: -------------------------------------------------------------------------------- 1 | tmp/ 2 | libnotmuch-dev/ 3 | libnotmuch*/ 4 | notmuch-emacs/ 5 | notmuch/ 6 | notmuch-mutt/ 7 | notmuch-ruby/ 8 | python*-notmuch/ 9 | *.debhelper 10 | *.debhelper.log 11 | *.substvars 12 | files 13 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/gbp.conf: -------------------------------------------------------------------------------- 1 | # Configuration file for git-buildpackage 2 | 3 | [DEFAULT] 4 | # The default branch for upstream sources 5 | upstream-branch = master 6 | 7 | # The default branch for the debian patch (no patch in our case) 8 | debian-branch = master 9 | 10 | # Directory for performing the build 11 | export-dir = ./debian-build 12 | 13 | # Format for upstream tags 14 | upstream-tag = %(version)s 15 | 16 | # Format for the debian tag 17 | debian-tag = debian/%(version)s 18 | -------------------------------------------------------------------------------- /debian/libnotmuch-dev.install: -------------------------------------------------------------------------------- 1 | usr/include 2 | usr/lib/*/libnotmuch.so 3 | -------------------------------------------------------------------------------- /debian/libnotmuch3.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/libnotmuch.so.* 2 | -------------------------------------------------------------------------------- /debian/notmuch-emacs.README.Debian: -------------------------------------------------------------------------------- 1 | * For help in getting started with notmuch and the emacs interface, 2 | see /usr/share/doc/notmuch/README. 3 | 4 | -- David Bremner , Wed, 27 Nov 2013 08:17:11 -0400 5 | -------------------------------------------------------------------------------- /debian/notmuch-emacs.dirs: -------------------------------------------------------------------------------- 1 | usr/share/emacs/site-lisp/notmuch 2 | -------------------------------------------------------------------------------- /debian/notmuch-emacs.emacsen-compat: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /debian/notmuch-emacs.emacsen-install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # /usr/lib/emacsen-common/packages/install/notmuch-emacs 3 | set -e 4 | 5 | FLAVOR=$1 6 | PACKAGE=notmuch 7 | 8 | case "${FLAVOR}" in 9 | emacs) 10 | return 0 11 | ;; 12 | xemacs*|emacs2[12]) 13 | # patches welcome. 14 | echo install/${PACKAGE}: skipping install for unsupported emacsen flavor ${FLAVOR} 15 | exit 0 16 | ;; 17 | *) 18 | echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR} 19 | esac 20 | 21 | 22 | elc_dir=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} 23 | el_dir=/usr/share/emacs/site-lisp/${PACKAGE} 24 | 25 | byte_compile_options="--quick --directory=${el_dir} -batch -f batch-byte-compile" 26 | 27 | echo install/${PACKAGE}: byte-compiling for ${FLAVOR} 28 | 29 | [ -d ${elc_dir} ] || mkdir ${elc_dir} 30 | 31 | # Create symlinks to the .el files (see section 6E in debian-emacs 32 | # polcy). This makes complation easy, and also allows find-function 33 | # and find-library to work properly. 34 | (cd ${elc_dir} && cp -s ${el_dir}/*.el .) 35 | 36 | # Byte compile them 37 | (cd ${elc_dir} 38 | set +e 39 | ${FLAVOR} ${byte_compile_options} *.el > Install.log 2>&1 40 | if test $? -ne 0 41 | then 42 | cat Install.log 43 | exit 1 44 | fi 45 | set -e 46 | gzip -9 Install.log) 47 | 48 | exit 0; 49 | -------------------------------------------------------------------------------- /debian/notmuch-emacs.emacsen-remove: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # /usr/lib/emacsen-common/packages/remove/notmuch 3 | 4 | set -e 5 | 6 | FLAVOR=$1 7 | PACKAGE=notmuch 8 | elc_dir=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} 9 | 10 | case "${FLAVOR}" in 11 | emacs) 12 | return 0 13 | ;; 14 | xemacs*|emacs2[12]) 15 | # patches welcome. 16 | echo install/${PACKAGE}: skipping removal for unsupported emacsen flavor ${FLAVOR} 17 | exit 0 18 | ;; 19 | *) 20 | echo remove/${PACKAGE}: Handling removal for emacsen flavor ${FLAVOR} 21 | esac 22 | 23 | echo remove/${PACKAGE}: Handling removal of emacsen flavor ${FLAVOR} 24 | 25 | echo emacsen-common: purging byte-compiled files for ${FLAVOR} 26 | rm -f ${elc_dir}/*.elc 27 | rm -f ${elc_dir}/*.el 28 | rm -f ${elc_dir}/Install.log* 29 | if test -e "${elc_dir}" 30 | then 31 | rmdir --ignore-fail-on-non-empty "${elc_dir}" 32 | fi 33 | 34 | exit 0; 35 | -------------------------------------------------------------------------------- /debian/notmuch-emacs.install: -------------------------------------------------------------------------------- 1 | usr/share/emacs/site-lisp/notmuch/*.el 2 | -------------------------------------------------------------------------------- /debian/notmuch-emacs.postinst: -------------------------------------------------------------------------------- 1 | dir="/var/lib/emacsen-common/state/package/installed" 2 | mkdir -p -m 0755 ${dir} 3 | touch ${dir}/notmuch-emacs 4 | #DEBHELPER# 5 | if [ -d /0755 ]; then 6 | rmdir /0755 || true 7 | fi 8 | -------------------------------------------------------------------------------- /debian/notmuch-emacs.prerm: -------------------------------------------------------------------------------- 1 | #DEBHELPER# 2 | dir="/var/lib/emacsen-common/state/package/installed" 3 | rm -f ${dir}/notmuch-emacs 4 | -------------------------------------------------------------------------------- /debian/notmuch-mutt.docs: -------------------------------------------------------------------------------- 1 | contrib/notmuch-mutt/README 2 | -------------------------------------------------------------------------------- /debian/notmuch-mutt.install: -------------------------------------------------------------------------------- 1 | contrib/notmuch-mutt/notmuch-mutt usr/bin 2 | contrib/notmuch-mutt/notmuch-mutt.rc etc/Muttrc.d 3 | -------------------------------------------------------------------------------- /debian/notmuch-mutt.manpages: -------------------------------------------------------------------------------- 1 | contrib/notmuch-mutt/notmuch-mutt.1 2 | -------------------------------------------------------------------------------- /debian/notmuch-vim.README.Debian: -------------------------------------------------------------------------------- 1 | notmuch for Debian 2 | ================== 3 | 4 | To use the vim plugin, please install it using vim-addons(1) 5 | 6 | See also /usr/share/doc/notmuch/README. 7 | 8 | -- David Bremner , Fri, 1 Jul 2011 11:34:39 -0300 9 | -------------------------------------------------------------------------------- /debian/notmuch-vim.dirs: -------------------------------------------------------------------------------- 1 | usr/share/vim/registry 2 | usr/share/vim/addons/plugin 3 | usr/share/vim/addons/doc 4 | usr/share/vim/addons/syntax 5 | -------------------------------------------------------------------------------- /debian/notmuch-vim.docs: -------------------------------------------------------------------------------- 1 | vim/README 2 | -------------------------------------------------------------------------------- /debian/notmuch-vim.install: -------------------------------------------------------------------------------- 1 | vim/notmuch.vim usr/share/vim/addons/plugin 2 | vim/notmuch.txt usr/share/vim/addons/doc 3 | vim/syntax/notmuch-*.vim usr/share/vim/addons/syntax 4 | vim/notmuch.yaml usr/share/vim/registry 5 | -------------------------------------------------------------------------------- /debian/notmuch.dirs: -------------------------------------------------------------------------------- 1 | usr/bin 2 | etc/bash_completion.d 3 | -------------------------------------------------------------------------------- /debian/notmuch.docs: -------------------------------------------------------------------------------- 1 | NEWS 2 | README 3 | -------------------------------------------------------------------------------- /debian/notmuch.emacsen-startup: -------------------------------------------------------------------------------- 1 | ;; -*-emacs-lisp-*- 2 | ;; 3 | ;; Emacs startup file, e.g. /etc/emacs/site-start.d/50notmuch.el 4 | ;; for the Debian notmuch package 5 | 6 | ;; The notmuch package follows the Debian/GNU Linux 'emacsen' policy and 7 | ;; byte-compiles its elisp files for each 'emacs flavor' (emacs19, 8 | ;; xemacs19, emacs20, xemacs20...). The compiled code is then 9 | ;; installed in a subdirectory of the respective site-lisp directory. 10 | 11 | (cond 12 | ((not (file-exists-p "/usr/share/emacs/site-lisp/notmuch")) 13 | (message "Package notmuch removed but not purged. Skipping setup.")) 14 | ((not (file-exists-p (concat "/usr/share/" 15 | (symbol-name debian-emacs-flavor) 16 | "/site-lisp/notmuch"))) 17 | (message "Package notmuch not fully installed. Skipping setup.")) 18 | (t 19 | (debian-pkg-add-load-path-item 20 | (concat "/usr/share/" 21 | (symbol-name debian-emacs-flavor) 22 | "/site-lisp/notmuch")) 23 | (autoload 'notmuch "notmuch" "Run notmuch and display saved searches, known tags, etc." t) 24 | (autoload 'notmuch-hello "notmuch" "Run notmuch and display saved searches, known tags, etc." t) 25 | (autoload 'notmuch-search "notmuch" "Run \"notmuch search\" with the given query string and display results." t) 26 | (autoload 'notmuch-show "notmuch" "Run \"notmuch show\" with the given thread ID and display results." t) 27 | 28 | )) 29 | -------------------------------------------------------------------------------- /debian/notmuch.examples: -------------------------------------------------------------------------------- 1 | completion/notmuch-completion.zsh 2 | -------------------------------------------------------------------------------- /debian/notmuch.install: -------------------------------------------------------------------------------- 1 | usr/bin 2 | usr/share/man 3 | etc/bash_completion.d 4 | -------------------------------------------------------------------------------- /debian/python-notmuch.install: -------------------------------------------------------------------------------- 1 | usr/lib/python2* 2 | -------------------------------------------------------------------------------- /debian/python3-notmuch.install: -------------------------------------------------------------------------------- 1 | usr/lib/python3* 2 | -------------------------------------------------------------------------------- /debian/ruby-notmuch.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/*ruby/*/*/notmuch.so 2 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | python3_all = py3versions -s | xargs -n1 | xargs -t -I {} env {} 4 | 5 | %: 6 | dh $@ --with python2,python3 7 | 8 | override_dh_auto_configure: 9 | dh_auto_configure -- --emacslispdir=/usr/share/emacs/site-lisp/notmuch 10 | 11 | override_dh_auto_build: 12 | dh_auto_build -- V=1 13 | dh_auto_build --sourcedirectory bindings/python 14 | cd bindings/python && $(python3_all) setup.py build 15 | cd bindings/ruby && ruby extconf.rb --vendor && make 16 | $(MAKE) -C contrib/notmuch-mutt 17 | 18 | override_dh_auto_clean: 19 | dh_auto_clean 20 | dh_auto_clean --sourcedirectory bindings/python 21 | cd bindings/python && $(python3_all) setup.py clean -a 22 | dh_auto_clean --sourcedirectory bindings/ruby 23 | $(MAKE) -C contrib/notmuch-mutt clean 24 | 25 | override_dh_auto_install: 26 | dh_auto_install 27 | dh_auto_install --sourcedirectory bindings/python 28 | cd bindings/python && $(python3_all) setup.py install --install-layout=deb --root=$(CURDIR)/debian/tmp 29 | dh_auto_install --sourcedirectory bindings/ruby 30 | 31 | override_dh_strip: 32 | dh_strip --dbg-package notmuch-dbg 33 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /debian/source/options: -------------------------------------------------------------------------------- 1 | single-debian-patch 2 | tar-ignore 3 | tar-ignore=performance-test/download/*.tar.xz 4 | -------------------------------------------------------------------------------- /debugger.c: -------------------------------------------------------------------------------- 1 | /* debugger.c - Some debugger utilities for the notmuch mail library 2 | * 3 | * Copyright © 2009 Chris Wilson 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/ . 17 | * 18 | * Author: Chris Wilson 19 | */ 20 | 21 | #include "notmuch-client.h" 22 | 23 | #include 24 | 25 | #if HAVE_VALGRIND 26 | #include 27 | #else 28 | #define RUNNING_ON_VALGRIND 0 29 | #endif 30 | 31 | notmuch_bool_t 32 | debugger_is_active (void) 33 | { 34 | char buf[1024]; 35 | 36 | if (RUNNING_ON_VALGRIND) 37 | return TRUE; 38 | 39 | sprintf (buf, "/proc/%d/exe", getppid ()); 40 | if (readlink (buf, buf, sizeof (buf)) != -1 && 41 | strncmp (basename (buf), "gdb", 3) == 0) 42 | { 43 | return TRUE; 44 | } 45 | 46 | return FALSE; 47 | } 48 | -------------------------------------------------------------------------------- /devel/printmimestructure: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Author: Daniel Kahn Gillmor 5 | # License: GPLv3+ 6 | 7 | # This script reads a MIME message from stdin and produces a treelike 8 | # representation on it stdout. 9 | 10 | # Example: 11 | # 12 | # 0 dkg@alice:~$ printmimestructure < 'Maildir/cur/1269025522.M338697P12023.monkey,S=6459,W=6963:2,Sa' 13 | # └┬╴multipart/signed 6546 bytes 14 | # ├─╴text/plain inline 895 bytes 15 | # └─╴application/pgp-signature inline [signature.asc] 836 bytes 16 | # 0 dkg@alice:~$ 17 | 18 | 19 | # If you want to number the parts, i suggest piping the output through 20 | # something like "cat -n" 21 | 22 | import email 23 | import sys 24 | 25 | def test(z, prefix=''): 26 | fname = '' if z.get_filename() is None else ' [' + z.get_filename() + ']' 27 | cset = '' if z.get_charset() is None else ' (' + z.get_charset() + ')' 28 | disp = z.get_params(None, header='Content-Disposition') 29 | if (disp is None): 30 | disposition = '' 31 | else: 32 | disposition = '' 33 | for d in disp: 34 | if d[0] in [ 'attachment', 'inline' ]: 35 | disposition = ' ' + d[0] 36 | if (z.is_multipart()): 37 | print prefix + '┬╴' + z.get_content_type() + cset + disposition + fname, z.as_string().__len__().__str__() + ' bytes' 38 | if prefix.endswith('└'): 39 | prefix = prefix.rpartition('└')[0] + ' ' 40 | if prefix.endswith('├'): 41 | prefix = prefix.rpartition('├')[0] + '│' 42 | parts = z.get_payload() 43 | i = 0 44 | while (i < parts.__len__()-1): 45 | test(parts[i], prefix + '├') 46 | i += 1 47 | test(parts[i], prefix + '└') 48 | # FIXME: show epilogue? 49 | else: 50 | print prefix + '─╴'+ z.get_content_type() + cset + disposition + fname, z.get_payload().__len__().__str__(), 'bytes' 51 | 52 | test(email.message_from_file(sys.stdin), '└') 53 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | docdeps.mk 3 | _build 4 | -------------------------------------------------------------------------------- /doc/INSTALL: -------------------------------------------------------------------------------- 1 | This file contains some more detailed information about building and 2 | installing the documentation. 3 | 4 | Building with sphinx. 5 | --------------------- 6 | 7 | - You need sphinx at least version 1.0. 8 | 9 | - You can build build and install man pages with 'make install-man' 10 | 11 | - You can build man, info, html, and pdf versions of the docs 12 | (currently only the man pages) with 13 | 14 | 'make install-{man|info|html|pdf}' 15 | 16 | Building the man pages 17 | ---------------------- 18 | 19 | - You can build the man pages with rst2man (from python-docutils) with 20 | 'make rst2man'. 21 | 22 | - Currently there is no support to automagically install the resulting 23 | nroff files, but it should work to modify the target install-man 24 | in doc/Makefile.local. 25 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | $(MAKE) -C .. all 3 | 4 | .DEFAULT: 5 | $(MAKE) -C .. $@ 6 | -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | 2 | Welcome to notmuch's documentation! 3 | =================================== 4 | 5 | Contents: 6 | 7 | .. toctree:: 8 | :titlesonly: 9 | 10 | man1/notmuch 11 | man1/notmuch-compact 12 | man1/notmuch-config 13 | man1/notmuch-count 14 | man1/notmuch-dump 15 | man5/notmuch-hooks 16 | man1/notmuch-insert 17 | man1/notmuch-new 18 | man1/notmuch-reply 19 | man1/notmuch-restore 20 | man1/notmuch-search 21 | man7/notmuch-search-terms 22 | man1/notmuch-show 23 | man1/notmuch-tag 24 | 25 | Indices and tables 26 | ================== 27 | 28 | * :ref:`genindex` 29 | * :ref:`modindex` 30 | * :ref:`search` 31 | -------------------------------------------------------------------------------- /doc/man1/notmuch-compact.rst: -------------------------------------------------------------------------------- 1 | =============== 2 | notmuch-compact 3 | =============== 4 | 5 | SYNOPSIS 6 | ======== 7 | 8 | **notmuch** **compact** [--quiet] [--backup=<*directory*>] 9 | 10 | DESCRIPTION 11 | =========== 12 | 13 | The **compact** command can be used to compact the notmuch database. 14 | This can both reduce the space required by the database and improve 15 | lookup performance. 16 | 17 | The compacted database is built in a temporary directory and is later 18 | moved into the place of the origin database. The original uncompacted 19 | database is discarded, unless the ``--backup=``\ option is 20 | used. 21 | 22 | Note that the database write lock will be held during the compaction 23 | process (which may be quite long) to protect data integrity. 24 | 25 | Supported options for **compact** include 26 | 27 | ``--backup=``\ 28 | Save the current database to the given directory before 29 | replacing it with the compacted database. The backup directory 30 | must not exist and it must reside on the same mounted filesystem 31 | as the current database. 32 | 33 | ``--quiet`` 34 | Do not report database compaction progress to stdout. 35 | 36 | ENVIRONMENT 37 | =========== 38 | 39 | The following environment variables can be used to control the behavior 40 | of notmuch. 41 | 42 | **NOTMUCH\_CONFIG** 43 | Specifies the location of the notmuch configuration file. Notmuch 44 | will use ${HOME}/.notmuch-config if this variable is not set. 45 | 46 | SEE ALSO 47 | ======== 48 | 49 | **notmuch(1)**, **notmuch-count(1)**, **notmuch-dump(1)**, 50 | **notmuch-hooks(5)**, **notmuch-insert(1)**, **notmuch-new(1)**, 51 | **notmuch-reply(1)**, **notmuch-restore(1)**, **notmuch-search(1)**, 52 | **notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)** 53 | -------------------------------------------------------------------------------- /doc/man1/notmuch-new.rst: -------------------------------------------------------------------------------- 1 | =========== 2 | notmuch-new 3 | =========== 4 | 5 | SYNOPSIS 6 | ======== 7 | 8 | **notmuch** **new** [options] 9 | 10 | DESCRIPTION 11 | =========== 12 | 13 | Find and import any new messages to the database. 14 | 15 | The **new** command scans all sub-directories of the database, 16 | performing full-text indexing on new messages that are found. Each new 17 | message will automatically be tagged with both the **inbox** and 18 | **unread** tags. 19 | 20 | You should run **notmuch new** once after first running **notmuch 21 | setup** to create the initial database. The first run may take a long 22 | time if you have a significant amount of mail (several hundred thousand 23 | messages or more). Subsequently, you should run **notmuch new** whenever 24 | new mail is delivered and you wish to incorporate it into the database. 25 | These subsequent runs will be much quicker than the initial run. 26 | 27 | Invoking ``notmuch`` with no command argument will run **new** if 28 | **notmuch setup** has previously been completed, but **notmuch new** has 29 | not previously been run. 30 | 31 | **notmuch new** updates tags according to maildir flag changes if the 32 | **maildir.synchronize\_flags** configuration option is enabled. See 33 | **notmuch-config(1)** for details. 34 | 35 | The **new** command supports hooks. See **notmuch-hooks(5)** for more 36 | details on hooks. 37 | 38 | Supported options for **new** include 39 | 40 | ``--no-hooks`` 41 | Prevents hooks from being run. 42 | 43 | ``--quiet`` 44 | Do not print progress or results. 45 | 46 | SEE ALSO 47 | ======== 48 | 49 | **notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**, 50 | **notmuch-dump(1)**, **notmuch-hooks(5)**, **notmuch-insert(1)**, 51 | **notmuch-reply(1)**, **notmuch-restore(1)**, **notmuch-search(1)**, 52 | **notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)** 53 | -------------------------------------------------------------------------------- /doc/man5/notmuch-hooks.rst: -------------------------------------------------------------------------------- 1 | ============= 2 | notmuch-hooks 3 | ============= 4 | 5 | SYNOPSIS 6 | ======== 7 | 8 | $DATABASEDIR/.notmuch/hooks/* 9 | 10 | DESCRIPTION 11 | =========== 12 | 13 | Hooks are scripts (or arbitrary executables or symlinks to such) that 14 | notmuch invokes before and after certain actions. These scripts reside 15 | in the .notmuch/hooks directory within the database directory and must 16 | have executable permissions. 17 | 18 | The currently available hooks are described below. 19 | 20 | **pre-new** 21 | This hook is invoked by the **new** command before scanning or 22 | importing new messages into the database. If this hook exits 23 | with a non-zero status, notmuch will abort further processing of 24 | the **new** command. 25 | 26 | Typically this hook is used for fetching or delivering new mail 27 | to be imported into the database. 28 | 29 | **post-new** 30 | This hook is invoked by the **new** command after new messages 31 | have been imported into the database and initial tags have been 32 | applied. The hook will not be run if there have been any errors 33 | during the scan or import. 34 | 35 | Typically this hook is used to perform additional query-based 36 | tagging on the imported messages. 37 | 38 | SEE ALSO 39 | ======== 40 | 41 | **notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**, 42 | **notmuch-dump(1)**, **notmuch-insert(1)**, **notmuch-new(1)**, 43 | **notmuch-reply(1)**, **notmuch-restore(1)**, **notmuch-search(1)**, 44 | **notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)** 45 | -------------------------------------------------------------------------------- /doc/mkdocdeps.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | srcdir = sys.argv[1] 4 | builddir = sys.argv[2] 5 | outfile = sys.argv[3] 6 | 7 | sys.path.insert(0, srcdir) 8 | import conf 9 | 10 | roff_files = [] 11 | rst_files = [] 12 | for page in conf.man_pages: 13 | rst_files = rst_files + ["{0:s}/{1:s}.rst".format(srcdir,page[0])] 14 | roff_files = roff_files + ["{0:s}/man/{1:s}.{2:d}".format(builddir,page[0],page[4])] 15 | 16 | with open(outfile, 'w') as out: 17 | out.write('MAN_ROFF_FILES := ' + ' \\\n\t'.join(roff_files) + '\n') 18 | out.write('MAN_RST_FILES := ' + ' \\\n\t'.join(rst_files) + '\n') 19 | -------------------------------------------------------------------------------- /doc/prerst2man.py: -------------------------------------------------------------------------------- 1 | from sys import argv 2 | from datetime import date 3 | from os.path import dirname, isdir 4 | from os import makedirs, system 5 | import re 6 | 7 | sourcedir = argv[1] 8 | outdir = argv[2] 9 | 10 | if not isdir(outdir): 11 | makedirs(outdir, 0o755) 12 | 13 | execfile(sourcedir + "/conf.py") 14 | 15 | 16 | def header(file, startdocname, command, description, authors, section): 17 | file.write(""" 18 | {0:s} 19 | {1:s} 20 | {2:s} 21 | 22 | :Date: {3:s} 23 | :Version: {4:s} 24 | :Manual section: {5:d} 25 | :Manual group: {6:s} 26 | 27 | """.format( 28 | '-' * len(description), 29 | description, 30 | '-' * len(description), 31 | date.today().isoformat(), release, section, project)) 32 | 33 | blankre = re.compile("^\s*$") 34 | for page in man_pages: 35 | outdirname = outdir + '/' + dirname(page[0]) 36 | if not isdir(outdirname): 37 | makedirs(outdirname, 0o755) 38 | filename = outdir + '/' + page[0] + '.rst' 39 | outfile = open(filename, 'w') 40 | infile = open(sourcedir + '/' + page[0] + '.rst', 'r') 41 | 42 | # this is a crude hack. We look for the first blank line, and 43 | # insert the rst2man header there. 44 | # 45 | # XXX consider really parsing input 46 | 47 | count = 0 48 | lines = infile.readlines() 49 | for line in lines: 50 | outfile.write(line) 51 | if (blankre.match(line)): 52 | break 53 | count = count + 1 54 | 55 | del lines[0:count + 1] 56 | 57 | header(outfile, *page) 58 | 59 | outfile.write("".join(lines)) 60 | outfile.close() 61 | 62 | system('set -x; rst2man {0} {1}/{2}.{3}' 63 | .format(filename, outdir, page[0], page[4])) 64 | -------------------------------------------------------------------------------- /emacs/.gitignore: -------------------------------------------------------------------------------- 1 | .eldeps* 2 | *.elc 3 | notmuch-version.el 4 | -------------------------------------------------------------------------------- /emacs/Makefile: -------------------------------------------------------------------------------- 1 | # See Makefile.local for the list of files to be compiled in this 2 | # directory. 3 | all: 4 | $(MAKE) -C .. all 5 | 6 | .DEFAULT: 7 | $(MAKE) -C .. $@ 8 | -------------------------------------------------------------------------------- /emacs/notmuch-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclements/notmuch/658a00e7c809cc4e3076aab28e105d3761086451/emacs/notmuch-logo.png -------------------------------------------------------------------------------- /emacs/notmuch-version.el.tmpl: -------------------------------------------------------------------------------- 1 | ;; -*- emacs-lisp -*- 2 | ;; 3 | ;; %AG% 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 . 19 | 20 | (defconst notmuch-emacs-version %VERSION% 21 | "Version of Notmuch Emacs MUA.") 22 | 23 | (provide 'notmuch-version) 24 | -------------------------------------------------------------------------------- /lib/Makefile: -------------------------------------------------------------------------------- 1 | # See Makefile.local for the list of files to be compiled in this 2 | # directory. 3 | all: 4 | $(MAKE) -C .. all 5 | 6 | .DEFAULT: 7 | $(MAKE) -C .. $@ 8 | -------------------------------------------------------------------------------- /lib/gen-version-script.sh: -------------------------------------------------------------------------------- 1 | 2 | # we go through a bit of work to get the unmangled names of the 3 | # typeinfo symbols because of 4 | # http://sourceware.org/bugzilla/show_bug.cgi?id=10326 5 | 6 | if [ $# -lt 2 ]; then 7 | echo Usage: $0 header obj1 obj2 obj3 8 | exit 1; 9 | fi 10 | 11 | HEADER=$1 12 | shift 13 | 14 | printf '{\nglobal:\n' 15 | nm $* | awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $3 ~ "Xapian.*Error" {print $3}' | sort | uniq | \ 16 | while read sym; do 17 | demangled=$(c++filt $sym) 18 | case $demangled in 19 | typeinfo*) 20 | printf "\t$sym;\n" 21 | ;; 22 | *) 23 | ;; 24 | esac 25 | done 26 | nm $* | awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $2 == "T" && $3 ~ "^(getline|getdelim|canonicalize_file_name)$" {print $3 ";"}' 27 | sed -n 's/^[[:space:]]*\(notmuch_[a-z_]*\)[[:space:]]*(.*/ \1;/p' $HEADER 28 | printf "local: *;\n};\n" 29 | -------------------------------------------------------------------------------- /lib/parse-time-vrp.h: -------------------------------------------------------------------------------- 1 | /* parse-time-vrp.h - date range query glue 2 | * 3 | * This file is part of notmuch. 4 | * 5 | * Copyright © 2012 Jani Nikula 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it 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 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see http://www.gnu.org/licenses/ . 19 | * 20 | * Author: Jani Nikula 21 | */ 22 | 23 | #ifndef NOTMUCH_PARSE_TIME_VRP_H 24 | #define NOTMUCH_PARSE_TIME_VRP_H 25 | 26 | #include 27 | 28 | /* see *ValueRangeProcessor in xapian-core/include/xapian/queryparser.h */ 29 | class ParseTimeValueRangeProcessor : public Xapian::ValueRangeProcessor { 30 | protected: 31 | Xapian::valueno valno; 32 | 33 | public: 34 | ParseTimeValueRangeProcessor (Xapian::valueno slot_) 35 | : valno(slot_) { } 36 | 37 | Xapian::valueno operator() (std::string &begin, std::string &end); 38 | }; 39 | 40 | #endif /* NOTMUCH_PARSE_TIME_VRP_H */ 41 | -------------------------------------------------------------------------------- /notmuch.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Notmuch (emacs interface) 3 | Exec=emacs -f notmuch 4 | Icon=emblem-mail 5 | Terminal=false 6 | Type=Application 7 | Categories=Network;Email; 8 | -------------------------------------------------------------------------------- /packaging/debian: -------------------------------------------------------------------------------- 1 | The Debian packaging exists in the top-level "debian" directory within 2 | this source-code repository. 3 | -------------------------------------------------------------------------------- /parse-time-string/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | $(MAKE) -C .. all 3 | 4 | .DEFAULT: 5 | $(MAKE) -C .. $@ 6 | -------------------------------------------------------------------------------- /parse-time-string/Makefile.local: -------------------------------------------------------------------------------- 1 | dir := parse-time-string 2 | extra_cflags += -I$(srcdir)/$(dir) 3 | 4 | libparse-time-string_c_srcs := $(dir)/parse-time-string.c 5 | 6 | libparse-time-string_modules := $(libparse-time-string_c_srcs:.c=.o) 7 | 8 | $(dir)/libparse-time-string.a: $(libparse-time-string_modules) 9 | $(call quiet,AR) rcs $@ $^ 10 | 11 | SRCS := $(SRCS) $(libparse-time-string_c_srcs) 12 | CLEAN := $(CLEAN) $(libparse-time-string_modules) $(dir)/libparse-time-string.a 13 | -------------------------------------------------------------------------------- /parse-time-string/README: -------------------------------------------------------------------------------- 1 | PARSE TIME STRING 2 | ================= 3 | 4 | parse_time_string() is a date/time parser originally written for 5 | notmuch by Jani Nikula . However, there is nothing 6 | notmuch specific in it, and it should be kept reusable for other 7 | projects, and ready to be packaged on its own as needed. Please do not 8 | add dependencies on or references to anything notmuch specific. The 9 | parser should only depend on the C library. 10 | -------------------------------------------------------------------------------- /performance-test/.gitignore: -------------------------------------------------------------------------------- 1 | tmp.*/ 2 | log.*/ 3 | corpus/ 4 | notmuch.cache.*/ 5 | -------------------------------------------------------------------------------- /performance-test/M00-new.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | test_description='notmuch new' 4 | 5 | . ./perf-test-lib.sh 6 | 7 | # ensure initial 'notmuch new' is run by memory_start 8 | uncache_database 9 | 10 | memory_start 11 | 12 | # run 'notmuch new' a second time, to test different code paths 13 | memory_run "notmuch new" "notmuch new" 14 | 15 | memory_done 16 | -------------------------------------------------------------------------------- /performance-test/M01-dump-restore.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | test_description='dump and restore' 4 | 5 | . ./perf-test-lib.sh 6 | 7 | memory_start 8 | 9 | memory_run 'load nmbug tags' 'notmuch restore --accumulate --input=corpus.tags/nmbug.sup-dump' 10 | memory_run 'dump *' 'notmuch dump --output=tags.sup' 11 | memory_run 'restore *' 'notmuch restore --input=tags.sup' 12 | memory_run 'dump --format=batch-tag *' 'notmuch dump --format=batch-tag --output=tags.bt' 13 | memory_run 'restore --format=batch-tag *' 'notmuch restore --format=batch-tag --input=tags.bt' 14 | 15 | memory_done 16 | -------------------------------------------------------------------------------- /performance-test/Makefile: -------------------------------------------------------------------------------- 1 | # See Makefile.local for the list of files to be compiled in this 2 | # directory. 3 | all: 4 | $(MAKE) -C .. all 5 | 6 | .DEFAULT: 7 | $(MAKE) -C .. $@ 8 | -------------------------------------------------------------------------------- /performance-test/Makefile.local: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | 3 | dir := performance-test 4 | 5 | include $(srcdir)/$(dir)/version.sh 6 | 7 | TIME_TEST_SCRIPT := ${dir}/notmuch-time-test 8 | MEMORY_TEST_SCRIPT := ${dir}/notmuch-memory-test 9 | 10 | CORPUS_NAME := notmuch-email-corpus-$(PERFTEST_VERSION).tar.xz 11 | TXZFILE := ${dir}/download/${CORPUS_NAME} 12 | SIGFILE := ${TXZFILE}.asc 13 | DEFAULT_URL := http://notmuchmail.org/releases/${CORPUS_NAME} 14 | 15 | perf-test: time-test memory-test 16 | 17 | time-test: setup-perf-test all 18 | @echo 19 | $(TIME_TEST_SCRIPT) $(OPTIONS) 20 | 21 | memory-test: setup-perf-test all 22 | @echo 23 | $(MEMORY_TEST_SCRIPT) $(OPTIONS) 24 | 25 | 26 | .PHONY: download-corpus setup-perf-test 27 | 28 | # Note that this intentionally does not depend on download-corpus. 29 | setup-perf-test: $(TXZFILE) 30 | gpg --verify $(SIGFILE) 31 | 32 | $(TXZFILE): 33 | @printf "\nPlease download ${TXZFILE} using:\n\n" 34 | @printf "\t%% make download-corpus\n\n" 35 | @echo or see http://notmuchmail.org/corpus for download locations 36 | @echo 37 | @false 38 | 39 | download-corpus: 40 | wget -O ${TXZFILE} ${DEFAULT_URL} 41 | 42 | CLEAN := $(CLEAN) $(dir)/tmp.* $(dir)/log.* 43 | DISTCLEAN := $(DISTCLEAN) $(dir)/corpus $(dir)/notmuch.cache.* 44 | DATACLEAN := $(DATACLEAN) $(TXZFILE) 45 | -------------------------------------------------------------------------------- /performance-test/T00-new.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | test_description='notmuch new' 4 | 5 | . ./perf-test-lib.sh 6 | 7 | uncache_database 8 | 9 | time_start 10 | 11 | for i in $(seq 2 6); do 12 | time_run "notmuch new #$i" 'notmuch new' 13 | done 14 | 15 | time_done 16 | -------------------------------------------------------------------------------- /performance-test/T01-dump-restore.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | test_description='dump and restore' 4 | 5 | . ./perf-test-lib.sh 6 | 7 | time_start 8 | 9 | time_run 'load nmbug tags' 'notmuch restore --accumulate < corpus.tags/nmbug.sup-dump' 10 | time_run 'dump *' 'notmuch dump > tags.out' 11 | time_run 'restore *' 'notmuch restore < tags.out' 12 | 13 | time_done 14 | -------------------------------------------------------------------------------- /performance-test/T02-tag.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | test_description='tagging' 4 | 5 | . ./perf-test-lib.sh 6 | 7 | time_start 8 | 9 | time_run 'tag * +new_tag' "notmuch tag +new_tag '*'" 10 | time_run 'tag * +existing_tag' "notmuch tag +new_tag '*'" 11 | time_run 'tag * -existing_tag' "notmuch tag -new_tag '*'" 12 | time_run 'tag * -missing_tag' "notmuch tag -new_tag '*'" 13 | 14 | time_done 15 | -------------------------------------------------------------------------------- /performance-test/download/.gitignore: -------------------------------------------------------------------------------- 1 | *.tar.gz 2 | *.tar.xz 3 | -------------------------------------------------------------------------------- /performance-test/download/notmuch-email-corpus-0.3.tar.xz.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNATURE----- 2 | Version: GnuPG v1.4.12 (GNU/Linux) 3 | 4 | iJwEAAECAAYFAlC9a90ACgkQTiiN/0Um85nAMAP+LCWdKzolcl/KW+JcCd0Dk+9v 5 | 0vvtBVEhBes0TbK6iWrxCV2OIuYG/RhnFlJTZ4MjgaTRxzDubpC+JktaJdLmIQUN 6 | B7ZIDMjFduCwmtyLiuu/00CjxJKUXm7vx+ULGpvp0uxFE/vaqGP997BHwBjjfBVm 7 | YX6BlLX1SV6TfENkuRE= 8 | =Mks5 9 | -----END PGP SIGNATURE----- 10 | -------------------------------------------------------------------------------- /performance-test/download/notmuch-email-corpus-0.4.tar.xz.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNATURE----- 2 | Version: GnuPG v1.4.15 (GNU/Linux) 3 | 4 | iQGcBAABCAAGBQJSdaDkAAoJEPIClx2kp54sQ54L/ikkvF1fy88hjLitN59v6g2J 5 | vw85YNRifNHyp/UXI6nt2eXFzyWJiRHuvHFoBgmEsJVxauOKw61Gs2zd53x9Ear4 6 | MGcQWyiM1cnwX/nD7GvxRQNh33f+FEamTjg+QhG47K0A2YdLWcDC7r9GMatGT11x 7 | 5KE24WQGOqtgQn/9qNtJvkiKIehpRiDTaW/QJ7mTCYeJFjIHJUY8dxyfiTtkJ0z7 8 | cJ6omehvWSw4STbEg65XJgqykxMdltNEavfvSbAT73FgmkkyXxul0s5hDZ/esd0n 9 | re3dyDxGt085POiAgPti05a4tJI5EQC2wLBUFri0s2JdMtazcD6yVuHNbVzZ4Do3 10 | nL/sgwKGUq5wRrPqPWp6HXtZ9zG+/V7hFNrr/l42qGrLqsSh0bqvEnUiwczZLBGy 11 | NEs4G8VjmfS2cMKePsWaekBAvFUtb47PSB6JIPwpCNvKXDrcCb28eOQVB2atgj1h 12 | 9SktOtWYJhWIQp2YW9iae30Z6lhCcdPRRHTFMQq2nQ== 13 | =eSMY 14 | -----END PGP SIGNATURE----- 15 | -------------------------------------------------------------------------------- /performance-test/notmuch-memory-test: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Run tests 4 | # 5 | # Copyright (c) 2005 Junio C Hamano 6 | # 7 | # Adapted from a Makefile to a shell script by Carl Worth (2010) 8 | 9 | if [ ${BASH_VERSINFO[0]} -lt 4 ]; then 10 | echo "Error: The notmuch test suite requires a bash version >= 4.0" 11 | echo "due to use of associative arrays within the test suite." 12 | echo "Please try again with a newer bash (or help us fix the" 13 | echo "test suite to be more portable). Thanks." 14 | exit 1 15 | fi 16 | 17 | cd $(dirname "$0") 18 | 19 | for test in M*.sh; do 20 | ./"$test" "$@" 21 | done 22 | -------------------------------------------------------------------------------- /performance-test/notmuch-time-test: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Run tests 4 | # 5 | # Copyright (c) 2005 Junio C Hamano 6 | # 7 | # Adapted from a Makefile to a shell script by Carl Worth (2010) 8 | 9 | if [ ${BASH_VERSINFO[0]} -lt 4 ]; then 10 | echo "Error: The notmuch test suite requires a bash version >= 4.0" 11 | echo "due to use of associative arrays within the test suite." 12 | echo "Please try again with a newer bash (or help us fix the" 13 | echo "test suite to be more portable). Thanks." 14 | exit 1 15 | fi 16 | 17 | cd $(dirname "$0") 18 | 19 | for test in T*.sh; do 20 | ./"$test" "$@" 21 | done 22 | -------------------------------------------------------------------------------- /performance-test/version.sh: -------------------------------------------------------------------------------- 1 | # this should be both a valid Makefile fragment and valid POSIX(ish) shell. 2 | 3 | PERFTEST_VERSION=0.4 4 | -------------------------------------------------------------------------------- /query-string.c: -------------------------------------------------------------------------------- 1 | /* notmuch - Not much of an email program, (just index and search) 2 | * 3 | * Copyright © 2009 Carl Worth 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/ . 17 | * 18 | * Author: Carl Worth 19 | */ 20 | 21 | #include "notmuch-client.h" 22 | 23 | /* Construct a single query string from the passed arguments, using 24 | * 'ctx' as the talloc owner for all allocations. 25 | * 26 | * Currently, the arguments are just connected with space characters, 27 | * but we might do more processing in the future, (such as inserting 28 | * any AND operators needed to work around Xapian QueryParser bugs). 29 | * 30 | * This function returns NULL in case of insufficient memory. 31 | */ 32 | char * 33 | query_string_from_args (void *ctx, int argc, char *argv[]) 34 | { 35 | char *query_string; 36 | int i; 37 | 38 | query_string = talloc_strdup (ctx, ""); 39 | if (query_string == NULL) 40 | return NULL; 41 | 42 | for (i = 0; i < argc; i++) { 43 | if (i != 0) { 44 | query_string = talloc_strdup_append (query_string, " "); 45 | if (query_string == NULL) 46 | return NULL; 47 | } 48 | 49 | query_string = talloc_strdup_append (query_string, argv[i]); 50 | if (query_string == NULL) 51 | return NULL; 52 | } 53 | 54 | return query_string; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | arg-test 2 | corpus.mail 3 | hex-xcode 4 | parse-time 5 | random-corpus 6 | smtp-dummy 7 | symbol-test 8 | make-db-version 9 | test-results 10 | tmp.* 11 | -------------------------------------------------------------------------------- /test/Makefile: -------------------------------------------------------------------------------- 1 | # See Makefile.local for the list of files to be compiled in this 2 | # directory. 3 | all: 4 | $(MAKE) -C .. all 5 | 6 | .DEFAULT: 7 | $(MAKE) -C .. $@ 8 | -------------------------------------------------------------------------------- /test/T010-help-test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | test_description="online help" 4 | . ./test-lib.sh 5 | 6 | test_expect_success 'notmuch --help' 'notmuch --help' 7 | test_expect_success 'notmuch help' 'notmuch help' 8 | test_expect_success 'notmuch --version' 'notmuch --version' 9 | 10 | if [ $NOTMUCH_HAVE_MAN -eq 1 ]; then 11 | test_expect_success 'notmuch --help tag' 'notmuch --help tag' 12 | test_expect_success 'notmuch help tag' 'notmuch help tag' 13 | else 14 | test_expect_success 'notmuch --help tag (man pages not available)' \ 15 | 'test_must_fail notmuch --help tag' 16 | test_expect_success 'notmuch help tag (man pages not available)' \ 17 | 'test_must_fail notmuch help tag' 18 | fi 19 | 20 | test_done 21 | -------------------------------------------------------------------------------- /test/T020-compact.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | test_description='"notmuch compact"' 3 | . ./test-lib.sh 4 | 5 | add_message '[subject]=One' 6 | add_message '[subject]=Two' 7 | add_message '[subject]=Three' 8 | 9 | notmuch tag +tag1 \* 10 | notmuch tag +tag2 subject:Two 11 | notmuch tag -tag1 +tag3 subject:Three 12 | 13 | if [ $NOTMUCH_HAVE_XAPIAN_COMPACT -eq 0 ]; then 14 | test_begin_subtest "Compact unsupported: error message" 15 | output=$(notmuch compact --quiet 2>&1) 16 | test_expect_equal "$output" "notmuch was compiled against a xapian version lacking compaction support. 17 | Compaction failed: Unsupported operation" 18 | 19 | test_expect_code 1 "Compact unsupported: status code" "notmuch compact" 20 | 21 | test_done 22 | fi 23 | 24 | test_expect_success "Running compact" "notmuch compact --backup=${TEST_DIRECTORY}/xapian.old" 25 | 26 | test_begin_subtest "Compact preserves database" 27 | output=$(notmuch search \* | notmuch_search_sanitize) 28 | test_expect_equal "$output" "\ 29 | thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag1 unread) 30 | thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag2 unread) 31 | thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Three (inbox tag3 unread)" 32 | 33 | test_expect_success 'Restoring Backup' \ 34 | 'rm -Rf ${MAIL_DIR}/.notmuch/xapian && 35 | mv ${TEST_DIRECTORY}/xapian.old ${MAIL_DIR}/.notmuch/xapian' 36 | 37 | test_begin_subtest "Checking restored backup" 38 | output=$(notmuch search \* | notmuch_search_sanitize) 39 | test_expect_equal "$output" "\ 40 | thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag1 unread) 41 | thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag2 unread) 42 | thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Three (inbox tag3 unread)" 43 | 44 | test_done 45 | -------------------------------------------------------------------------------- /test/T040-setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | test_description='"notmuch setup"' 4 | . ./test-lib.sh 5 | 6 | test_begin_subtest "Create a new config interactively" 7 | notmuch --config=new-notmuch-config > /dev/null <&1) 11 | test_expect_equal "$output" "Error: search term did not match precisely one message." 12 | 13 | test_begin_subtest "Show a raw message" 14 | output=$(notmuch show --format=raw id:msg-001@notmuch-test-suite | notmuch_date_sanitize) 15 | test_expect_equal "$output" "From: Notmuch Test Suite 16 | To: Notmuch Test Suite 17 | Message-Id: 18 | Subject: Test message #1 19 | Date: GENERATED_DATE 20 | 21 | This is just a test message (#1)" 22 | 23 | test_begin_subtest "Show another raw message" 24 | output=$(notmuch show --format=raw id:msg-002@notmuch-test-suite | notmuch_date_sanitize) 25 | test_expect_equal "$output" "From: Notmuch Test Suite 26 | To: Notmuch Test Suite 27 | Message-Id: 28 | Subject: Test message #2 29 | Date: GENERATED_DATE 30 | 31 | This is just a test message (#2)" 32 | 33 | test_done 34 | -------------------------------------------------------------------------------- /test/T250-uuencode.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | test_description="handling of uuencoded data" 3 | . ./test-lib.sh 4 | 5 | add_message [subject]=uuencodetest '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \ 6 | '[body]="This message is used to ensure that notmuch correctly handles a 7 | message containing a block of uuencoded data. First, we have a marker 8 | this content beforeuudata . Then we begin the uuencoded data itself: 9 | 10 | begin 644 bogus-uuencoded-data 11 | M0123456789012345678901234567890123456789012345678901234567890 12 | MOBVIOUSLY, THIS IS NOT ANY SORT OF USEFUL UUENCODED DATA. 13 | MINSTEAD THIS IS JUST A WAY TO ENSURE THAT THIS BLOCK OF DATA 14 | MIS CORRECTLY IGNORED WHEN NOTMUCH CREATES ITS INDEX. SO WE 15 | MINCLUDE A DURINGUUDATA MARKER THAT SHOULD NOT RESULT IN ANY 16 | MSEARCH RESULT. 17 | \\\` 18 | end 19 | 20 | Finally, we have our afteruudata marker as well."' 21 | 22 | test_begin_subtest "Ensure content before uu data is indexed" 23 | output=$(notmuch search beforeuudata | notmuch_search_sanitize) 24 | test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; uuencodetest (inbox unread)" 25 | 26 | test_begin_subtest "Ensure uu data is not indexed" 27 | output=$(notmuch search DURINGUUDATA | notmuch_search_sanitize) 28 | test_expect_equal "$output" "" 29 | 30 | test_begin_subtest "Ensure content after uu data is indexed" 31 | output=$(notmuch search afteruudata | notmuch_search_sanitize) 32 | test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; uuencodetest (inbox unread)" 33 | 34 | test_done 35 | -------------------------------------------------------------------------------- /test/T320-emacs-large-search-buffer.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | test_description="Emacs with large search results buffer" 3 | . ./test-lib.sh 4 | 5 | x=xxxxxxxxxx # 10 6 | x=$x$x$x$x$x$x$x$x$x$x # 100 7 | x=$x$x$x$x$x$x$x$x$x # 900 8 | 9 | # We generate a long subject here (over 900 bytes) so that the emacs 10 | # search results get large quickly. With 30 such messages we should 11 | # cross several 4kB page boundaries and see the bug. 12 | n=30 13 | for i in $(seq 1 $n); do 14 | # Roughly 100B2 KiB per message. That is, we need two messages in order to 15 | # exceed the typical size of the pipe buffer (4 KiB on commodity systems). 16 | generate_message '[subject]="$x $i of $n"' 17 | done 18 | 19 | notmuch new > /dev/null 20 | 21 | test_begin_subtest "Ensure that emacs doesn't drop results" 22 | notmuch search '*' > EXPECTED 23 | sed -i -e 's/^thread:[0-9a-f]* //' -e 's/;//' -e 's/xx*/[BLOB]/' EXPECTED 24 | echo 'End of search results.' >> EXPECTED 25 | 26 | test_emacs '(notmuch-search "*") 27 | (notmuch-test-wait) 28 | (test-output)' 29 | sed -i -e s', *, ,g' -e 's/xxx*/[BLOB]/g' OUTPUT 30 | test_expect_equal_file OUTPUT EXPECTED 31 | 32 | test_done 33 | -------------------------------------------------------------------------------- /test/T360-symbol-hiding.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright (c) 2011 David Bremner 4 | # 5 | 6 | # This test tests whether hiding Xapian::Error symbols in libnotmuch 7 | # also hides them for other users of libxapian. This is motivated by 8 | # the discussion in http://gcc.gnu.org/wiki/Visibility' 9 | 10 | test_description='exception symbol hiding' 11 | 12 | . ./test-lib.sh 13 | 14 | run_test(){ 15 | result=$(LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" $TEST_DIRECTORY/symbol-test 2>&1) 16 | } 17 | 18 | output="A Xapian exception occurred opening database: Couldn't stat 'fakedb/.notmuch/xapian' 19 | caught No chert database found at path \`./nonexistant'" 20 | 21 | mkdir -p fakedb/.notmuch 22 | 23 | test_expect_success 'running test' run_test 24 | 25 | test_begin_subtest 'checking output' 26 | test_expect_equal "$result" "$output" 27 | 28 | test_begin_subtest 'comparing existing to exported symbols' 29 | objdump -t $TEST_DIRECTORY/../lib/*.o | awk '$4 == ".text" && $6 ~ "^notmuch" {print $6}' | sort | uniq > ACTUAL 30 | sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' $TEST_DIRECTORY/../notmuch.sym | sort | uniq > EXPORTED 31 | test_expect_equal_file EXPORTED ACTUAL 32 | 33 | test_done 34 | -------------------------------------------------------------------------------- /test/T370-search-folder-coherence.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | test_description='folder tags removed and added through file renames remain consistent' 3 | . ./test-lib.sh 4 | 5 | test_begin_subtest "No new messages" 6 | output=$(NOTMUCH_NEW) 7 | test_expect_equal "$output" "No new mail." 8 | 9 | 10 | test_begin_subtest "Single new message" 11 | generate_message 12 | file_x=$gen_msg_filename 13 | id_x=$gen_msg_id 14 | output=$(NOTMUCH_NEW) 15 | test_expect_equal "$output" "Added 1 new message to the database." 16 | 17 | test_begin_subtest "Add second folder for same message" 18 | dir=$(dirname $file_x) 19 | mkdir $dir/spam 20 | cp $file_x $dir/spam 21 | output=$(NOTMUCH_NEW) 22 | test_expect_equal "$output" "No new mail." 23 | 24 | 25 | test_begin_subtest "Multiple files for same message" 26 | cat <EXPECTED 27 | MAIL_DIR/msg-001 28 | MAIL_DIR/spam/msg-001 29 | EOF 30 | notmuch search --output=files id:$id_x | notmuch_search_files_sanitize >OUTPUT 31 | test_expect_equal_file OUTPUT EXPECTED 32 | 33 | test_begin_subtest "Test matches folder:spam" 34 | output=$(notmuch search folder:spam) 35 | test_expect_equal "$output" "thread:0000000000000001 2001-01-05 [1/1] Notmuch Test Suite; Single new message (inbox unread)" 36 | 37 | test_begin_subtest "Remove folder:spam copy of email" 38 | rm $dir/spam/$(basename $file_x) 39 | output=$(NOTMUCH_NEW) 40 | test_expect_equal "$output" "No new mail. Detected 1 file rename." 41 | 42 | test_begin_subtest "No mails match the folder:spam search" 43 | output=$(notmuch search folder:spam) 44 | test_expect_equal "$output" "" 45 | 46 | test_done 47 | -------------------------------------------------------------------------------- /test/T390-python.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | test_description="python bindings" 3 | . ./test-lib.sh 4 | 5 | add_email_corpus 6 | 7 | test_begin_subtest "compare thread ids" 8 | test_python < EXPECTED 17 | test_expect_equal_file OUTPUT EXPECTED 18 | 19 | test_begin_subtest "compare message ids" 20 | test_python < EXPECTED 29 | test_expect_equal_file OUTPUT EXPECTED 30 | 31 | test_begin_subtest "get non-existent file" 32 | test_python < OUTPUT 7 | cat < EXPECTED 8 | keyword 1 9 | int 7 10 | string foo 11 | positional arg 1 pos1 12 | positional arg 2 pos2 13 | EOF 14 | test_expect_equal_file OUTPUT EXPECTED 15 | 16 | test_done 17 | -------------------------------------------------------------------------------- /test/T420-emacs-test-functions.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | test_description="emacs test function sanity" 4 | . ./test-lib.sh 5 | 6 | test_begin_subtest "emacs test function sanity" 7 | test_emacs_expect_t 't' 8 | 9 | test_done 10 | -------------------------------------------------------------------------------- /test/T430-emacs-address-cleaning.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | test_description="emacs address cleaning" 4 | . ./test-lib.sh 5 | 6 | test_begin_subtest "notmuch-test-address-clean part 1" 7 | test_emacs_expect_t '(notmuch-test-address-cleaning-1)' 8 | 9 | test_begin_subtest "notmuch-test-address-clean part 2" 10 | test_emacs_expect_t '(notmuch-test-address-cleaning-2)' 11 | 12 | test_begin_subtest "notmuch-test-address-clean part 3" 13 | test_emacs_expect_t '(notmuch-test-address-cleaning-3)' 14 | 15 | test_done 16 | -------------------------------------------------------------------------------- /test/T500-search-date.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | test_description="date:since..until queries" 3 | . ./test-lib.sh 4 | 5 | add_email_corpus 6 | 7 | test_begin_subtest "Absolute date range" 8 | output=$(notmuch search date:2010-12-16..12/16/2010 | notmuch_search_sanitize) 9 | test_expect_equal "$output" "thread:XXX 2010-12-16 [1/1] Olivier Berger; Essai accentué (inbox unread)" 10 | 11 | test_begin_subtest "Absolute time range with TZ" 12 | notmuch search date:18-Nov-2009_02:19:26-0800..2009-11-18_04:49:52-06:00 | notmuch_search_sanitize > OUTPUT 13 | cat <EXPECTED 14 | thread:XXX 2009-11-18 [1/3] Carl Worth| Jan Janak; [notmuch] What a great idea! (inbox unread) 15 | thread:XXX 2009-11-18 [1/2] Carl Worth| Jan Janak; [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread) 16 | thread:XXX 2009-11-18 [1/3] Carl Worth| Aron Griffis, Keith Packard; [notmuch] archive (inbox unread) 17 | thread:XXX 2009-11-18 [1/2] Carl Worth| Keith Packard; [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread) 18 | EOF 19 | test_expect_equal_file OUTPUT EXPECTED 20 | 21 | test_done 22 | -------------------------------------------------------------------------------- /test/T520-show.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | test_description='"notmuch show"' 3 | 4 | . ./test-lib.sh 5 | 6 | add_email_corpus 7 | 8 | test_begin_subtest "exit code for show invalid query" 9 | notmuch show foo.. 10 | exit_code=$? 11 | test_expect_equal 1 $exit_code 12 | 13 | test_done 14 | -------------------------------------------------------------------------------- /test/aggregate-results.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | 5 | fixed=0 6 | success=0 7 | failed=0 8 | broken=0 9 | total=0 10 | 11 | for file 12 | do 13 | while read type value 14 | do 15 | case $type in 16 | '') 17 | continue ;; 18 | fixed) 19 | fixed=$(($fixed + $value)) ;; 20 | success) 21 | success=$(($success + $value)) ;; 22 | failed) 23 | failed=$(($failed + $value)) ;; 24 | broken) 25 | broken=$(($broken + $value)) ;; 26 | total) 27 | total=$(($total + $value)) ;; 28 | esac 29 | done <"$file" 30 | done 31 | 32 | pluralize () { 33 | case $2 in 34 | 1) 35 | case $1 in 36 | test) 37 | echo test ;; 38 | failure) 39 | echo failure ;; 40 | esac 41 | ;; 42 | *) 43 | case $1 in 44 | test) 45 | echo tests ;; 46 | failure) 47 | echo failures ;; 48 | esac 49 | ;; 50 | esac 51 | } 52 | 53 | echo "Notmuch test suite complete." 54 | if [ "$fixed" = "0" ] && [ "$failed" = "0" ]; then 55 | tests=$(pluralize "test" $total) 56 | printf "All $total $tests " 57 | if [ "$broken" = "0" ]; then 58 | echo "passed." 59 | else 60 | failures=$(pluralize "failure" $broken) 61 | echo "behaved as expected ($broken expected $failures)." 62 | fi; 63 | else 64 | echo "$success/$total tests passed." 65 | if [ "$broken" != "0" ]; then 66 | tests=$(pluralize "test" $broken) 67 | echo "$broken broken $tests failed as expected." 68 | fi 69 | if [ "$fixed" != "0" ]; then 70 | tests=$(pluralize "test" $fixed) 71 | echo "$fixed broken $tests now fixed." 72 | fi 73 | if [ "$failed" != "0" ]; then 74 | tests=$(pluralize "test" $failed) 75 | echo "$failed $tests failed." 76 | fi 77 | fi 78 | 79 | skipped=$(($total - $fixed - $success - $failed - $broken)) 80 | if [ "$skipped" != "0" ]; then 81 | tests=$(pluralize "test" $skipped) 82 | echo "$skipped $tests skipped." 83 | fi 84 | 85 | if [ $success -gt 0 -a $fixed -eq 0 -a $failed -eq 0 -a $skipped -eq 0 ] 86 | then 87 | exit 0 88 | else 89 | exit 1 90 | fi 91 | -------------------------------------------------------------------------------- /test/arg-test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "command-line-arguments.h" 3 | 4 | 5 | int main(int argc, char **argv){ 6 | 7 | int opt_index=1; 8 | 9 | int kw_val=0; 10 | int int_val=0; 11 | char *pos_arg1=NULL; 12 | char *pos_arg2=NULL; 13 | char *string_val=NULL; 14 | 15 | notmuch_opt_desc_t options[] = { 16 | { NOTMUCH_OPT_KEYWORD, &kw_val, "keyword", 'k', 17 | (notmuch_keyword_t []){ { "one", 1 }, 18 | { "two", 2 }, 19 | { 0, 0 } } }, 20 | { NOTMUCH_OPT_INT, &int_val, "int", 'i', 0}, 21 | { NOTMUCH_OPT_STRING, &string_val, "string", 's', 0}, 22 | { NOTMUCH_OPT_POSITION, &pos_arg1, 0,0, 0}, 23 | { NOTMUCH_OPT_POSITION, &pos_arg2, 0,0, 0}, 24 | { 0, 0, 0, 0, 0 } }; 25 | 26 | opt_index = parse_arguments(argc, argv, options, 1); 27 | 28 | if (opt_index < 0) 29 | return 1; 30 | 31 | if (kw_val) 32 | printf("keyword %d\n", kw_val); 33 | 34 | if (int_val) 35 | printf("int %d\n", int_val); 36 | 37 | if (string_val) 38 | printf("string %s\n", string_val); 39 | 40 | if (pos_arg1) 41 | printf("positional arg 1 %s\n", pos_arg1); 42 | 43 | if (pos_arg2) 44 | printf("positional arg 2 %s\n", pos_arg2); 45 | 46 | 47 | for ( ; opt_index < argc ; opt_index ++) { 48 | printf("non parsed arg %d = %s\n", opt_index, argv[opt_index]); 49 | } 50 | 51 | return 0; 52 | } 53 | -------------------------------------------------------------------------------- /test/corpus/01:2,: -------------------------------------------------------------------------------- 1 | From: "Mikhail Gusarov" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 21:28:37 +0600 4 | Subject: [notmuch] [PATCH 1/2] Close message file after parsing message 5 | headers 6 | Message-ID: <1258471718-6781-1-git-send-email-dottedmag@dottedmag.net> 7 | 8 | Keeping unused files open helps to see "Too many open files" often. 9 | 10 | Signed-off-by: Mikhail Gusarov 11 | --- 12 | lib/message-file.c | 5 +++++ 13 | 1 files changed, 5 insertions(+), 0 deletions(-) 14 | 15 | diff --git a/lib/message-file.c b/lib/message-file.c 16 | index 8a3f8ee..197ab01 100644 17 | --- a/lib/message-file.c 18 | +++ b/lib/message-file.c 19 | @@ -325,6 +325,11 @@ notmuch_message_file_get_header (notmuch_message_file_t *message, 20 | return decoded_value; 21 | } 22 | 23 | + if (message->parsing_finished) { 24 | + fclose (message->file); 25 | + message->file = NULL; 26 | + } 27 | + 28 | if (message->line) 29 | free (message->line); 30 | message->line = NULL; 31 | -- 32 | 1.6.3.3 33 | 34 | 35 | -------------------------------------------------------------------------------- /test/corpus/02:2,: -------------------------------------------------------------------------------- 1 | From: "Mikhail Gusarov" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 21:28:38 +0600 4 | Subject: [notmuch] [PATCH 2/2] Include to get uint32_t in C++ 5 | file with gcc 4.4 6 | In-Reply-To: <1258471718-6781-1-git-send-email-dottedmag@dottedmag.net> 7 | References: <1258471718-6781-1-git-send-email-dottedmag@dottedmag.net> 8 | Message-ID: <1258471718-6781-2-git-send-email-dottedmag@dottedmag.net> 9 | 10 | 11 | Signed-off-by: Mikhail Gusarov 12 | --- 13 | lib/message.cc | 2 ++ 14 | 1 files changed, 2 insertions(+), 0 deletions(-) 15 | 16 | diff --git a/lib/message.cc b/lib/message.cc 17 | index 72c350f..a4b090b 100644 18 | --- a/lib/message.cc 19 | +++ b/lib/message.cc 20 | @@ -21,6 +21,8 @@ 21 | #include "notmuch-private.h" 22 | #include "database-private.h" 23 | 24 | +#include 25 | + 26 | #include 27 | 28 | #include 29 | -- 30 | 1.6.3.3 31 | 32 | 33 | -------------------------------------------------------------------------------- /test/corpus/bar/17:2,: -------------------------------------------------------------------------------- 1 | From: "Israel Herraiz" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 23:57:18 +0100 4 | Subject: [notmuch] New to the list 5 | Message-ID: <1258498485-sup-142@elly> 6 | 7 | Hi all, 8 | 9 | I have subscribed to the list. As suggested by the welcome message, I 10 | am introducing myself. My name is Israel Herraiz, and I have done a 11 | couple of contributions to Sup, the probably well-known here e-mail 12 | client. 13 | 14 | "Not much" sounds interesting, and I wonder whether it could be 15 | integrated with the views of Sup (inbox, threads, etc). So I have 16 | subscribed to the list to keep an eye on what's going on here. 17 | 18 | I have just heard of "Not much". I have not even tried to download the 19 | code yet. 20 | 21 | Cheers, 22 | Israel 23 | 24 | -------------------------------------------------------------------------------- /test/corpus/bar/18:2,: -------------------------------------------------------------------------------- 1 | From: "Aron Griffis" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 18:21:38 -0500 4 | Subject: [notmuch] archive 5 | Message-ID: <20091117232137.GA7669@griffis1.net> 6 | 7 | Just subscribed, I'd like to catch up on the previous postings, 8 | but the archive link seems to be bogus? 9 | 10 | Thanks, 11 | Aron 12 | 13 | -------------------------------------------------------------------------------- /test/corpus/bar/baz/cur/25:2,: -------------------------------------------------------------------------------- 1 | From: "Stewart Smith" 2 | To: notmuch@notmuchmail.org 3 | Date: Wed, 18 Nov 2009 12:05:53 +1100 4 | Subject: [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ 5 | libs. 6 | Message-ID: <1258506353-20352-1-git-send-email-stewart@flamingspork.com> 7 | 8 | Previously, Ubuntu 9.10, gcc 4.4.1 was getting: 9 | 10 | ccache gcc `pkg-config --libs glib-2.0 gmime-2.4 talloc` `xapian-config --libs` notmuch.o notmuch-config.o notmuch-dump.o notmuch-new.o notmuch-reply.o notmuch-restore.o notmuch-search.o notmuch-setup.o notmuch-show.o notmuch-tag.o notmuch-time.o gmime-filter-reply.o query-string.o show-message.o lib/notmuch.a -o notmuch 11 | /usr/bin/ld: lib/notmuch.a(database.o): in function global constructors keyed to BOOLEAN_PREFIX_INTERNAL:database.cc(.text+0x3a): error: undefined reference to 'std::ios_base::Init::Init()' 12 | --- 13 | Makefile.local | 2 +- 14 | 1 files changed, 1 insertions(+), 1 deletions(-) 15 | 16 | diff --git a/Makefile.local b/Makefile.local 17 | index f824bed..dbd3e20 100644 18 | --- a/Makefile.local 19 | +++ b/Makefile.local 20 | @@ -18,7 +18,7 @@ notmuch_client_srcs = \ 21 | 22 | notmuch_client_modules = $(notmuch_client_srcs:.c=.o) 23 | notmuch: $(notmuch_client_modules) lib/notmuch.a 24 | - $(CC) $(LDFLAGS) $^ -o $@ 25 | + $(CXX) $(LDFLAGS) $^ -o $@ 26 | 27 | notmuch.1.gz: 28 | gzip --stdout notmuch.1 > notmuch.1.gz 29 | -- 30 | 1.6.3.3 31 | 32 | 33 | -------------------------------------------------------------------------------- /test/corpus/bar/baz/new/27:2,: -------------------------------------------------------------------------------- 1 | From: "Keith Packard" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 17:59:49 -0800 4 | Subject: [notmuch] New to the list 5 | In-Reply-To: <1258498485-sup-142@elly> 6 | References: <1258498485-sup-142@elly> 7 | Message-ID: 8 | 9 | On Tue, 17 Nov 2009 23:57:18 +0100, Israel Herraiz wrote: 10 | 11 | > "Not much" sounds interesting, and I wonder whether it could be 12 | > integrated with the views of Sup (inbox, threads, etc). So I have 13 | > subscribed to the list to keep an eye on what's going on here. 14 | 15 | We've tried to clone much of the sup UI inside emacs, including the 16 | inbox and threaded message presentation. Of course, we had to "improve" 17 | it a bit, as much due to the differences between curses and emacs as due 18 | to personal preferences... 19 | 20 | -keith 21 | 22 | -------------------------------------------------------------------------------- /test/corpus/bar/baz/new/28:2,: -------------------------------------------------------------------------------- 1 | From: "Keith Packard" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 18:03:17 -0800 4 | Subject: [notmuch] Introducing myself 5 | In-Reply-To: <20091118002059.067214ed@hikari> 6 | References: <20091118002059.067214ed@hikari> 7 | Message-ID: 8 | 9 | On Wed, 18 Nov 2009 00:20:59 +0100, Adrian Perez de Castro wrote: 10 | 11 | > Some time ago I thought 12 | > about doing something like Not Much and in fact I played a bit with the 13 | > Python+Xapian and the Python+Whoosh combinations, because I find relaxing 14 | > to code things in Python when I am not working and also it is installed 15 | > by default on most distribution. I got to have some mailboxes indexed and 16 | > basic searching working a couple of months ago. 17 | 18 | Sup certainly started a lot of people thinking... 19 | 20 | > Also, I would like to share one idea I had in mind, that you might find 21 | > interesting: One thing I have found very annoying is having to re-tag my 22 | > mail when the indexes get b0rked (it happened a couple of times to me while 23 | > using Sup), so I was planning to mails as read/unread and adding the tags 24 | > not just to the index, but to the mail text itself, e.g. by adding a 25 | > "X-Tags" header field or by reusing the "Keywords" one. 26 | 27 | Easier than that, notmuch (and sup too), provide a 'dump' command which 28 | just lists all of the message IDs and their associated tags. Makes 29 | saving tags easy and doesn't involve rewriting messages. I do this once 30 | a day just before my computer is backed up to an external drive. 31 | 32 | If the index is destroyed, you can reindex the messages and then reapply 33 | all of the tags with 'notmuch restore'. 34 | 35 | -- 36 | keith.packard at intel.com 37 | 38 | 39 | -------------------------------------------------------------------------------- /test/corpus/cur/29:2,: -------------------------------------------------------------------------------- 1 | From: "Keith Packard" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 18:04:31 -0800 4 | Subject: [notmuch] archive 5 | In-Reply-To: <20091117232137.GA7669@griffis1.net> 6 | References: <20091117232137.GA7669@griffis1.net> 7 | Message-ID: 8 | 9 | On Tue, 17 Nov 2009 18:21:38 -0500, Aron Griffis wrote: 10 | 11 | > Just subscribed, I'd like to catch up on the previous postings, 12 | > but the archive link seems to be bogus? 13 | 14 | Yeah, the archive appears broken and will need to wait until Carl 15 | arrives in Barcelona to get fixed. 16 | 17 | -- 18 | keith.packard at intel.com 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/corpus/cur/31:2,: -------------------------------------------------------------------------------- 1 | From: "Jjgod Jiang" 2 | To: notmuch@notmuchmail.org 3 | Date: Wed, 18 Nov 2009 11:50:17 +0800 4 | Subject: [notmuch] Mac OS X/Darwin compatibility issues 5 | Message-ID: 6 | 7 | Hi, 8 | 9 | When I tried to compile notmuch under Mac OS X 10.6, several issues 10 | arisen: 11 | 12 | 1. g++ reports 'warning: command line option "-Wmissing-declarations" 13 | is valid for C/ObjC but not for C++' 14 | 15 | 2. 16 | notmuch-reply.c: In function ?address_is_users?: 17 | notmuch-reply.c:87: warning: passing argument 2 of 18 | ?notmuch_config_get_user_other_email? from incompatible pointer type 19 | 20 | That's due to the size incompatibility of 'unsigned int' and 'size_t' 21 | (size_t is uint64_t in Mac OS X). 22 | 23 | 3. Several errors about missing GNU extensions like getline() and strndup(): 24 | 25 | warning: implicit declaration of function ?getline? 26 | error: ?strndup? was not declared in this scope 27 | 28 | We can implement these with fgets() and strncpy() though. 29 | 30 | - Jiang 31 | 32 | -------------------------------------------------------------------------------- /test/corpus/cur/33:2,: -------------------------------------------------------------------------------- 1 | From: "Rolland Santimano" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 21:12:23 -0800 (PST) 4 | Subject: [notmuch] Link to mailing list archives ? 5 | Message-ID: <736613.51770.qm@web113505.mail.gq1.yahoo.com> 6 | 7 | The link[1] provided on the list page[2] is broken: 8 | [1] http://notmuchmail.org/pipermail/notmuch/ 9 | [2] http://notmuchmail.org/mailman/listinfo/notmuch 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/corpus/cur/34:2,: -------------------------------------------------------------------------------- 1 | From: "Alexander Botero-Lowry" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 21:45:36 -0800 4 | Subject: [notmuch] Mac OS X/Darwin compatibility issues 5 | In-Reply-To: 6 | References: 7 | Message-ID: <86einw2xof.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me> 8 | 9 | On Wed, 18 Nov 2009 11:50:17 +0800, Jjgod Jiang wrote: 10 | > Hi, 11 | > 12 | > When I tried to compile notmuch under Mac OS X 10.6, several issues 13 | > arisen: 14 | > 15 | > 1. g++ reports 'warning: command line option "-Wmissing-declarations" 16 | > is valid for C/ObjC but not for C++' 17 | > 18 | I got that too. I presume it's newly supported in GCC4.4? 19 | 20 | > 3. Several errors about missing GNU extensions like getline() and strndup(): 21 | > 22 | strndup from V8: 23 | 24 | char* strndup(char* str, size_t n) { 25 | // Stupid implementation of strndup since macos isn't born with 26 | // one. 27 | size_t len = strlen(str); 28 | if (len <= n) 29 | return StrDup(str); 30 | char* result = new char[n+1]; 31 | size_t i; 32 | for (i = 0; i <= n; i++) 33 | result[i] = str[i]; 34 | result[i] = '\0'; 35 | return result; 36 | } 37 | 38 | > warning: implicit declaration of function ?getline? 39 | > error: ?strndup? was not declared in this scope 40 | > 41 | for getline do you mind trying #define _GNU_SOURCE 1 42 | before #include in the offending files? The FreeBSD man pages 43 | mentions that as a way of enabling the GNU version of getline(). 44 | 45 | Alex 46 | 47 | -------------------------------------------------------------------------------- /test/corpus/cur/35:2,: -------------------------------------------------------------------------------- 1 | From: "Jjgod Jiang" 2 | To: notmuch@notmuchmail.org 3 | Date: Wed, 18 Nov 2009 14:14:27 +0800 4 | Subject: [notmuch] Mac OS X/Darwin compatibility issues 5 | In-Reply-To: <86einw2xof.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me> 6 | References: 7 | <86einw2xof.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me> 8 | Message-ID: 9 | 10 | Hi, 11 | 12 | On Wed, Nov 18, 2009 at 1:45 PM, Alexander Botero-Lowry 13 | wrote: 14 | > for getline do you mind trying #define _GNU_SOURCE 1 15 | > before #include in the offending files? The FreeBSD man pages 16 | > mentions that as a way of enabling the GNU version of getline(). 17 | 18 | It seems even _GNU_SOURCE is defined, getline is still not present. 19 | the C lib in Mac OS X simply doesn't have it. See also [1]. 20 | 21 | - Jiang 22 | 23 | [1] http://stackoverflow.com/questions/1117108/compiling-c-code-using-gnu-c-getline-on-mac-osx 24 | 25 | -------------------------------------------------------------------------------- /test/corpus/cur/36:2,: -------------------------------------------------------------------------------- 1 | From: "Alexander Botero-Lowry" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 22:19:29 -0800 4 | Subject: [notmuch] Mac OS X/Darwin compatibility issues 5 | In-Reply-To: 6 | References: 7 | <86einw2xof.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me> 8 | 9 | Message-ID: <86d43g2w3y.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me> 10 | 11 | On Wed, 18 Nov 2009 14:14:27 +0800, Jjgod Jiang wrote: 12 | > Hi, 13 | > 14 | > On Wed, Nov 18, 2009 at 1:45 PM, Alexander Botero-Lowry 15 | > wrote: 16 | > > for getline do you mind trying #define _GNU_SOURCE 1 17 | > > before #include in the offending files? The FreeBSD man pages 18 | > > mentions that as a way of enabling the GNU version of getline(). 19 | > 20 | > It seems even _GNU_SOURCE is defined, getline is still not present. 21 | > the C lib in Mac OS X simply doesn't have it. See also [1]. 22 | > 23 | Alas. Since it's ostensibly based on the FreeBSD one, I figured there 24 | was a chance that would fix the problem. :/ 25 | 26 | -------------------------------------------------------------------------------- /test/corpus/cur/37:2,: -------------------------------------------------------------------------------- 1 | From: "Alexander Botero-Lowry" 2 | To: notmuch@notmuchmail.org 3 | Date: Wed, 18 Nov 2009 00:02:56 -0800 4 | Subject: [notmuch] request for pull 5 | Message-ID: <86aayk2rbj.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me> 6 | 7 | The following changes since commit e8c9c3e6a534fc6c2919c2c1de63cea7250eb488: 8 | Ingmar Vanhassel (1): 9 | Makefile: Manual pages shouldn't be executable 10 | 11 | are available in the git repository at: 12 | 13 | git://alexbl.net/notmuch.git master 14 | 15 | Alexander Botero-Lowry (2): 16 | Error out if no query is supplied to search instead of going into an infinite loop 17 | set a local truncate-line variable in notmuch-search-mode, so that subjects don't wrap and make the output look weird 18 | 19 | notmuch-search.c | 5 +++++ 20 | notmuch.el | 1 + 21 | 2 files changed, 6 insertions(+), 0 deletions(-) 22 | 23 | -------------------------------------------------------------------------------- /test/corpus/cur/38:2,: -------------------------------------------------------------------------------- 1 | From: "Keith Packard" 2 | To: notmuch@notmuchmail.org 3 | Date: Wed, 18 Nov 2009 00:29:59 -0800 4 | Subject: [notmuch] [PATCH] Create a default notmuch-show-hook that 5 | highlights URLs and uses word-wrap 6 | Message-ID: <1258532999-9316-1-git-send-email-keithp@keithp.com> 7 | 8 | I created the notmuch-show-hook precisely so I could add these two 9 | options, but I suspect most people will want them, so I just made them 10 | the default. If you don't want them, you can use remove-hook to get 11 | rid of this. 12 | 13 | Signed-off-by: Keith Packard 14 | --- 15 | notmuch.el | 8 ++++++++ 16 | 1 files changed, 8 insertions(+), 0 deletions(-) 17 | 18 | diff --git a/notmuch.el b/notmuch.el 19 | index 1bb1294..c95cb43 100644 20 | --- a/notmuch.el 21 | +++ b/notmuch.el 22 | @@ -698,6 +698,14 @@ view, (remove the \"inbox\" tag from each), with either 23 | :options '(goto-address) 24 | :group 'notmuch) 25 | 26 | +; Make show mode a bit prettier, highlighting URLs and using word wrap 27 | + 28 | +(defun notmuch-show-pretty-hook () 29 | + (goto-address-mode 1) 30 | + (visual-line-mode)) 31 | + 32 | +(add-hook 'notmuch-show-hook 'notmuch-show-pretty-hook) 33 | + 34 | (defun notmuch-show (thread-id &optional parent-buffer) 35 | "Run \"notmuch show\" with the given thread ID and display results. 36 | 37 | -- 38 | 1.6.5.2 39 | 40 | 41 | -------------------------------------------------------------------------------- /test/corpus/cur/39:2,: -------------------------------------------------------------------------------- 1 | From: "Alexander Botero-Lowry" 2 | To: notmuch@notmuchmail.org 3 | Date: Wed, 18 Nov 2009 00:52:34 -0800 4 | Subject: [notmuch] [PATCH] Create a default notmuch-show-hook that 5 | highlights URLs and uses word-wrap 6 | In-Reply-To: <1258532999-9316-1-git-send-email-keithp@keithp.com> 7 | References: <1258532999-9316-1-git-send-email-keithp@keithp.com> 8 | Message-ID: <867hto2p0t.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me> 9 | 10 | On Wed, 18 Nov 2009 00:29:59 -0800, Keith Packard wrote: 11 | > I created the notmuch-show-hook precisely so I could add these two 12 | > options, but I suspect most people will want them, so I just made them 13 | > the default. If you don't want them, you can use remove-hook to get 14 | > rid of this. 15 | > 16 | Yes, hooks should be added for search as well. :) 17 | 18 | > +; Make show mode a bit prettier, highlighting URLs and using word wrap 19 | > + 20 | > +(defun notmuch-show-pretty-hook () 21 | > + (goto-address-mode 1) 22 | > + (visual-line-mode)) 23 | > + 24 | visual-line-mode turns out to make subject look pretty ugly if there is a 25 | continuation. It doesn't do much good for the citation headers 26 | either. We probably need to do our own intelligent wrapping rather then 27 | use visual-line-mode to make this actually look right. 28 | 29 | goto-address-mode is important though. :) 30 | 31 | alex 32 | 33 | -------------------------------------------------------------------------------- /test/corpus/cur/40:2,: -------------------------------------------------------------------------------- 1 | From: "Carl Worth" 2 | To: notmuch@notmuchmail.org 3 | Date: Wed, 18 Nov 2009 01:42:02 -0800 4 | Subject: [notmuch] [PATCH 1/2] Close message file after parsing message 5 | headers 6 | In-Reply-To: 7 | References: <1258471718-6781-1-git-send-email-dottedmag@dottedmag.net> 8 | <87lji5cbwo.fsf@yoom.home.cworth.org> 9 | Message-ID: <87pr7gqidx.fsf@yoom.home.cworth.org> 10 | 11 | On Tue, 17 Nov 2009 13:15:25 -0800, Keith Packard wrote: 12 | > Threading the message also involves displaying the from and to contents, 13 | > which requires opening the message file. The alternative to the fix I 14 | > provided is to just parse all of the message headers when first opening 15 | > the message; it could then be immediately closed and the hash referred 16 | > to for all header data. Given the choice, just having the caller say 17 | > when it has finished with a message is probably a reasonable option... 18 | 19 | Hi Keith, 20 | 21 | Once I finally got back on the ground again, I pushed out a revised 22 | version of your patch, (didn't need the reply-to stuff anymore since I 23 | had fixed that differently in the meantime). 24 | 25 | I'm pretty happy with the state of this portion of the code now. 26 | 27 | Thanks Keith and Mikhail for your input on and code to fix this bug. 28 | 29 | -Carl 30 | 31 | 32 | -------------------------------------------------------------------------------- /test/corpus/cur/41:2,: -------------------------------------------------------------------------------- 1 | From: "Carl Worth" 2 | To: notmuch@notmuchmail.org 3 | Date: Wed, 18 Nov 2009 02:08:10 -0800 4 | Subject: [notmuch] Working with Maildir storage? 5 | In-Reply-To: <20091117190054.GU3165@dottiness.seas.harvard.edu> 6 | References: <20091117190054.GU3165@dottiness.seas.harvard.edu> 7 | Message-ID: <87ocn0qh6d.fsf@yoom.home.cworth.org> 8 | 9 | On Tue, 17 Nov 2009 14:00:54 -0500, Lars Kellogg-Stedman wrote: 10 | > I saw the LWN article and decided to take a look at notmuch. I'm 11 | > currently using mutt and mairix to index and read a collection of 12 | > Maildir mail folders (around 40,000 messages total). 13 | 14 | Welcome, Lars! 15 | 16 | I hadn't even seen that Keith's blog post had been picked up by lwn.net. 17 | That's very interesting. So, thanks for coming and trying out notmuch. 18 | 19 | > Error opening 20 | > /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S: 21 | > Too many open files 22 | 23 | Sadly, the lwn article coincided with me having just introduced this 24 | bug, and then getting on a Trans-Atlantic flight. So I fixed the bug 25 | fairly quickly, but there was quite a bit of latency before I could push 26 | the fix out. It should be fixed now. 27 | 28 | > I'm curious if this is expected behavior (i.e., notmuch does not work 29 | > with Maildir) or if something else is going on. 30 | 31 | Notmuch works just fine with maildir---it's one of the things that it 32 | likes the best. 33 | 34 | Happy hacking, 35 | 36 | -Carl 37 | 38 | -------------------------------------------------------------------------------- /test/corpus/cur/42:2,: -------------------------------------------------------------------------------- 1 | From: "Carl Worth" 2 | To: notmuch@notmuchmail.org 3 | Date: Wed, 18 Nov 2009 02:19:26 -0800 4 | Subject: [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands 5 | remove inbox (and unread) tags 6 | In-Reply-To: <1258493565-13508-1-git-send-email-keithp@keithp.com> 7 | References: <1258493565-13508-1-git-send-email-keithp@keithp.com> 8 | Message-ID: <87k4xoqgnl.fsf@yoom.home.cworth.org> 9 | 10 | On Tue, 17 Nov 2009 13:32:45 -0800, Keith Packard wrote: 11 | > When closing a thread view, mark the thread as archived by removing 12 | > the "inbox" tag, and for the 'x' variant, the "unread" tag as well, 13 | > then kill the buffer and update the search window view as well. 14 | > 15 | > This makes 'x' much the same as 'a', but instead of taking you to the 16 | > next message, it takes you back to the search window instead. 17 | 18 | I don't like this---but that's because I use 'x' precisely *because* it 19 | preserves these tags. 20 | 21 | Otherwise, you might as well just remove inbox and unread as soon as the 22 | message is presented to the user. And that's a bug in a lot of other 23 | email programs that I'm unwilling to replicate. 24 | 25 | We may run into a need to define different ways that people like to work 26 | with their email here. (I know that so far I've just been coding up the 27 | way I want my mail to work.) 28 | 29 | -Carl 30 | 31 | -------------------------------------------------------------------------------- /test/corpus/cur/43:2,: -------------------------------------------------------------------------------- 1 | From: "Carl Worth" 2 | To: notmuch@notmuchmail.org 3 | Date: Wed, 18 Nov 2009 02:22:12 -0800 4 | Subject: [notmuch] archive 5 | In-Reply-To: 6 | References: <20091117232137.GA7669@griffis1.net> 7 | 8 | Message-ID: <87iqd8qgiz.fsf@yoom.home.cworth.org> 9 | 10 | On Tue, 17 Nov 2009 18:04:31 -0800, Keith Packard wrote: 11 | > On Tue, 17 Nov 2009 18:21:38 -0500, Aron Griffis wrote: 12 | > 13 | > > Just subscribed, I'd like to catch up on the previous postings, 14 | > > but the archive link seems to be bogus? 15 | > 16 | > Yeah, the archive appears broken and will need to wait until Carl 17 | > arrives in Barcelona to get fixed. 18 | 19 | Fixed it in transit in Frankfurt---with only moments to spare on my 20 | battery and no outlets in sight. 21 | 22 | Thanks for the report, Aron. And welcome to notmuch! 23 | 24 | -Carl (who wants to reply to a lot more mail, but will have to wait 25 | until later for that) 26 | 27 | -------------------------------------------------------------------------------- /test/corpus/cur/44:2,: -------------------------------------------------------------------------------- 1 | From: "Carl Worth" 2 | To: notmuch@notmuchmail.org 3 | Date: Wed, 18 Nov 2009 02:43:50 -0800 4 | Subject: [notmuch] [PATCH] Older versions of install do not support -C. 5 | In-Reply-To: <1258496327-12086-1-git-send-email-jan@ryngle.com> 6 | References: <1258496327-12086-1-git-send-email-jan@ryngle.com> 7 | Message-ID: <87hbssqfix.fsf@yoom.home.cworth.org> 8 | 9 | On Tue, 17 Nov 2009 23:18:47 +0100, Jan Janak wrote: 10 | > Do not use -C cmdline option of install, older versions, commonly found in 11 | > distributions like Debian, do not seem to support it. Running make install 12 | > on such systems (tested on Debian Lenny) fails. 13 | > 14 | > Signed-off-by: Jan Janak 15 | 16 | Thanks, Jan. This is pushed now. 17 | 18 | And did I say welcome to notmuch yet? (It's easy to lose track with all 19 | the newcomers---which I'm not complaining about---especially since so 20 | many are sharing code.) 21 | 22 | -Carl 23 | 24 | PS. I actually really like the behavior of -C (especially when 25 | installing a low-level library to avoid big waterfalls of needless 26 | recompiles). But since we're *not* actually installing a library (yet) 27 | I'm happy with this patch rather than writing code in configure to check 28 | if "install -C" works or not. 29 | 30 | -------------------------------------------------------------------------------- /test/corpus/cur/45:2,: -------------------------------------------------------------------------------- 1 | From: "Carl Worth" 2 | To: notmuch@notmuchmail.org 3 | Date: Wed, 18 Nov 2009 02:49:52 -0800 4 | Subject: [notmuch] What a great idea! 5 | In-Reply-To: 6 | References: 7 | Message-ID: <87fx8cqf8v.fsf@yoom.home.cworth.org> 8 | 9 | On Tue, 17 Nov 2009 23:35:30 +0100, Jan Janak wrote: 10 | > First of all, notmuch is a wonderful idea, both the cmdline tool and 11 | > the emacs interface! Thanks a lot for writing it, I was really excited 12 | > when I read the announcement today. 13 | 14 | Ah, here's where I planned a nice welcome. So welcome (again), Jan! :-) 15 | 16 | I've been having a lot of fun with notmuch already, (though there have 17 | been some days of pain before it was functional enough and my 18 | email-reply latency went way up). But regardless---I got through that, 19 | and I'm able to work more efficiently with notmuch now than I could with 20 | sup before. So I'm happy. 21 | 22 | And I'm delighted when other people find this interesting as well. 23 | 24 | > Have you considered sending an announcement to the org-mode mailing list? 25 | > http://orgmode.org 26 | 27 | Thanks for the idea. I think I may have looked into org-mode years ago, 28 | (when I was investigating planner-mode and various emacs "personal wiki" 29 | systems for keeping random notes and what-not). 30 | 31 | > Various ways of searching/referencing emails from emacs were discussed 32 | > there several times and none of them were as elegant as notmuch (not 33 | > even close). Maybe notmuch would attract some of the developers 34 | > there.. 35 | 36 | Yeah. I'll drop them a mail. Having a real emacs wizard on board would 37 | be nice. (I'm afraid the elisp I've written so far for this project is 38 | fairly grim.) 39 | 40 | -Carl 41 | 42 | -------------------------------------------------------------------------------- /test/corpus/cur/48:2,: -------------------------------------------------------------------------------- 1 | From: "Carl Worth" 2 | To: notmuch@notmuchmail.org 3 | Date: Wed, 18 Nov 2009 03:22:32 -0800 4 | Subject: [notmuch] [PATCH] Typsos 5 | In-Reply-To: <1258500222-32066-1-git-send-email-ingmar@exherbo.org> 6 | References: <1258500222-32066-1-git-send-email-ingmar@exherbo.org> 7 | Message-ID: <878we4qdqf.fsf@yoom.home.cworth.org> 8 | 9 | On Wed, 18 Nov 2009 00:23:42 +0100, Ingmar Vanhassel wrote: 10 | > 17 files changed, 30 insertions(+), 30 deletions(-) 11 | 12 | Yikes. That's a lot of typos. 13 | 14 | Thanks Ingmar, for cleaning up after my sloppy keyboarding. Pushed. 15 | 16 | -Carl 17 | 18 | -------------------------------------------------------------------------------- /test/corpus/cur/49:2,: -------------------------------------------------------------------------------- 1 | From: "Carl Worth" 2 | To: notmuch@notmuchmail.org 3 | Date: Wed, 18 Nov 2009 03:31:23 -0800 4 | Subject: [notmuch] [PATCH] Error out if no query is supplied to search 5 | instead of going into an infinite loop 6 | In-Reply-To: 7 | References: 8 | Message-ID: <877htoqdbo.fsf@yoom.home.cworth.org> 9 | 10 | On Tue, 17 Nov 2009 16:23:53 -0800, Alex Botero-Lowry wrote: 11 | > In this case error out when no query is supplied. There seems to be an 12 | > infinite-loop casued by i think notmuch_query_search_threads having 13 | > an exception: 14 | > A Xapian exception occurred: Syntax: AND 15 | > A Xapian exception occurred: Syntax: AND 16 | > A Xapian exception occurred: Syntax: AND 17 | > 18 | > I'll look into that bug specifically a bit later. 19 | > 20 | > It might be better to do a usage instead of just throwing an error here? 21 | 22 | Definitely. 23 | 24 | Priit Laes reported the same thing in IRC and I've just committed a 25 | patch to give a nice error message: 26 | 27 | $ ./notmuch search 28 | Error: notmuch search requires at least one search term. 29 | 30 | Thanks for the report! 31 | 32 | -Carl 33 | 34 | -------------------------------------------------------------------------------- /test/corpus/cur/50:2,: -------------------------------------------------------------------------------- 1 | From: "Chris Wilson" 2 | To: notmuch@notmuchmail.org 3 | Date: Wed, 18 Nov 2009 11:34:54 +0000 4 | Subject: [notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once 5 | Message-ID: <1258544095-16616-1-git-send-email-chris@chris-wilson.co.uk> 6 | 7 | Currently the same `pkg-config ...` is executed for every target, so 8 | just store the results in a variable. 9 | --- 10 | Makefile | 9 +++++---- 11 | 1 files changed, 5 insertions(+), 4 deletions(-) 12 | 13 | diff --git a/Makefile b/Makefile 14 | index 96aaa73..023b2ec 100644 15 | --- a/Makefile 16 | +++ b/Makefile 17 | @@ -4,15 +4,16 @@ CFLAGS=-O2 18 | 19 | # Additional flags that we will append to whatever the user set. 20 | # These aren't intended for the user to manipulate. 21 | -extra_cflags = `pkg-config --cflags glib-2.0 gmime-2.4 talloc` 22 | -extra_cxxflags = `xapian-config --cxxflags` 23 | +extra_cflags := $(shell pkg-config --cflags glib-2.0 gmime-2.4 talloc) 24 | +extra_cxxflags := $(shell xapian-config --cxxflags) 25 | 26 | # Now smash together user's values with our extra values 27 | override CFLAGS += $(WARN_FLAGS) $(extra_cflags) 28 | override CXXFLAGS += $(WARN_FLAGS) $(extra_cflags) $(extra_cxxflags) 29 | 30 | -override LDFLAGS += `pkg-config --libs glib-2.0 gmime-2.4 talloc` \ 31 | - `xapian-config --libs` 32 | +override LDFLAGS += \ 33 | + $(shell pkg-config --libs glib-2.0 gmime-2.4 talloc) \ 34 | + $(shell xapian-config --libs) 35 | 36 | # Include our local Makefile.local first so that its first target is default 37 | include Makefile.local 38 | -- 39 | 1.6.5.2 40 | -------------------------------------------------------------------------------- /test/corpus/cur/51:2,: -------------------------------------------------------------------------------- 1 | From: "Aron Griffis" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 18:21:38 -0500 4 | Subject: [notmuch] archive 5 | Message-ID: <20091117232137.GA7669@griffis1.net> 6 | 7 | Just subscribed, I'd like to catch up on the previous postings, 8 | but the archive link seems to be bogus? 9 | 10 | Thanks, 11 | Aron 12 | 13 | -------------------------------------------------------------------------------- /test/corpus/cur/52:2,: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclements/notmuch/658a00e7c809cc4e3076aab28e105d3761086451/test/corpus/cur/52:2, -------------------------------------------------------------------------------- /test/corpus/cur/53:2,: -------------------------------------------------------------------------------- 1 | From: Olivier Berger 2 | To: olivier.berger@it-sudparis.eu 3 | Subject: Essai =?iso-8859-1?Q?accentu=E9?= 4 | User-Agent: Notmuch/0.10.1 (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu) 5 | X-Draft-From: ("nnimap+localdovecot:INBOX" 44228) 6 | Date: Fri, 16 Dec 2010 16:49:59 +0100 7 | Message-ID: <877h1wv7mg.fsf@inf-8657.int-evry.fr> 8 | MIME-Version: 1.0 9 | Content-Type: text/plain; charset=iso-8859-1 10 | Content-Transfer-Encoding: quoted-printable 11 | 12 | Du texte accentu=E9 pour =E7a ... 13 | 14 | =E0 la bonne heure ! 15 | --=20 16 | Olivier BERGER=20 17 | http://www-public.it-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8 18 | Ingenieur Recherche - Dept INF 19 | Institut TELECOM, SudParis (http://www.it-sudparis.eu/), Evry (France) 20 | 21 | -------------------------------------------------------------------------------- /test/corpus/foo/06:2,: -------------------------------------------------------------------------------- 1 | From: "Carl Worth" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 12:19:24 -0800 4 | Subject: [notmuch] preliminary FreeBSD support 5 | In-Reply-To: 6 | References: 7 | Message-ID: <87lji4lx9v.fsf@yoom.home.cworth.org> 8 | 9 | On Tue, 17 Nov 2009 11:36:14 -0800, Alex Botero-Lowry wrote: 10 | > I saw the announcement this morning, and was very excited, as I had been 11 | > hoping sup would be turned into a library, 12 | > since I like the concept more than the UI (I'd rather an emacs interface). 13 | 14 | Hi Alex, 15 | 16 | That's great! It's good to hear that there are like-minded people out 17 | there. I hope that Notmuch will be useful for you. 18 | 19 | > I did a preliminary compile which worked out fine, but 20 | > sysconf(_SC_SC_GETPW_R_SIZE_MAX) returns -1 on 21 | > FreeBSD, so notmuch_config_open segfaulted. 22 | > 23 | > Attached is a patch that supplies a default buffer size of 64 in cases where 24 | > -1 is returned. 25 | 26 | Thanks for the patch. As we discussed in IRC[*], we should probably 27 | do the correct thing and check for ERANGE and loop as necessary (even if 28 | sysconf returns a positive value). Example code here: 29 | 30 | http://www.opengroup.org/austin/docs/austin_328.txt 31 | 32 | -Carl 33 | 34 | [*] #notmuch on irc.freenode.net for those who didn't just guess that 35 | already, (and I'll add that to the website soon). 36 | 37 | -------------------------------------------------------------------------------- /test/corpus/foo/baz/11:2,: -------------------------------------------------------------------------------- 1 | From: "Keith Packard" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 13:15:25 -0800 4 | Subject: [notmuch] [PATCH 1/2] Close message file after parsing message 5 | headers 6 | In-Reply-To: <87lji5cbwo.fsf@yoom.home.cworth.org> 7 | References: <1258471718-6781-1-git-send-email-dottedmag@dottedmag.net> 8 | <87lji5cbwo.fsf@yoom.home.cworth.org> 9 | Message-ID: 10 | 11 | On Tue, 17 Nov 2009 09:13:27 -0800, Carl Worth wrote: 12 | 13 | > I didn't apply Keith's fix yet, because I think I'd rather just fix the 14 | > indexer to store the In-Reply-To header in a separate term prefix from 15 | > the term used for the References header[*]. That will then let us lookup 16 | > the in-reply-to value later for thread constructions without having to 17 | > open the original email file at all. 18 | 19 | Threading the message also involves displaying the from and to contents, 20 | which requires opening the message file. The alternative to the fix I 21 | provided is to just parse all of the message headers when first opening 22 | the message; it could then be immediately closed and the hash referred 23 | to for all header data. Given the choice, just having the caller say 24 | when it has finished with a message is probably a reasonable option... 25 | 26 | -keith 27 | 28 | -------------------------------------------------------------------------------- /test/corpus/foo/baz/12:2,: -------------------------------------------------------------------------------- 1 | From: "Keith Packard" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 13:24:13 -0800 4 | Subject: [notmuch] Working with Maildir storage? 5 | In-Reply-To: <20091117203301.GV3165@dottiness.seas.harvard.edu> 6 | References: <20091117190054.GU3165@dottiness.seas.harvard.edu> 7 | <87iqd9rn3l.fsf@vertex.dottedmag> 8 | <20091117203301.GV3165@dottiness.seas.harvard.edu> 9 | Message-ID: 10 | 11 | On Tue, 17 Nov 2009 15:33:01 -0500, Lars Kellogg-Stedman wrote: 12 | > > See the patch just posted here. 13 | 14 | I've also pushed a slightly more complicated (and complete) fix to my 15 | private notmuch repository 16 | 17 | git://keithp.com/git/notmuch 18 | 19 | > Is the list archived anywhere? 20 | 21 | Oops. Looks like Carl's mail server is broken. He's traveling to 22 | Barcelona today and so it won't get fixed for a while. 23 | 24 | Thanks to everyone for trying out notmuch! 25 | 26 | -keith 27 | 28 | -------------------------------------------------------------------------------- /test/corpus/foo/baz/cur/14:2,: -------------------------------------------------------------------------------- 1 | From: "Jan Janak" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 23:18:47 +0100 4 | Subject: [notmuch] [PATCH] Older versions of install do not support -C. 5 | Message-ID: <1258496327-12086-1-git-send-email-jan@ryngle.com> 6 | 7 | Do not use -C cmdline option of install, older versions, commonly found in 8 | distributions like Debian, do not seem to support it. Running make install 9 | on such systems (tested on Debian Lenny) fails. 10 | 11 | Signed-off-by: Jan Janak 12 | --- 13 | Makefile.local | 8 ++++---- 14 | 1 files changed, 4 insertions(+), 4 deletions(-) 15 | 16 | diff --git a/Makefile.local b/Makefile.local 17 | index f824bed..f51f1d1 100644 18 | --- a/Makefile.local 19 | +++ b/Makefile.local 20 | @@ -27,11 +27,11 @@ install: all notmuch.1.gz 21 | for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(prefix)/share/man/man1 \ 22 | $(DESTDIR)/etc/bash_completion.d/ ; \ 23 | do \ 24 | - install -C -d $$d ; \ 25 | + install -d $$d ; \ 26 | done ; 27 | - install -C notmuch $(DESTDIR)$(prefix)/bin/ 28 | - install -C -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/ 29 | - install -C notmuch-completion.bash \ 30 | + install notmuch $(DESTDIR)$(prefix)/bin/ 31 | + install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/ 32 | + install notmuch-completion.bash \ 33 | $(DESTDIR)/etc/bash_completion.d/notmuch 34 | 35 | SRCS := $(SRCS) $(notmuch_client_srcs) 36 | -- 37 | 1.6.3.3 38 | 39 | 40 | -------------------------------------------------------------------------------- /test/corpus/foo/baz/new/15:2,: -------------------------------------------------------------------------------- 1 | From: "Jan Janak" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 23:35:30 +0100 4 | Subject: [notmuch] What a great idea! 5 | Message-ID: 6 | 7 | Hello, 8 | 9 | First of all, notmuch is a wonderful idea, both the cmdline tool and 10 | the emacs interface! Thanks a lot for writing it, I was really excited 11 | when I read the announcement today. 12 | 13 | Have you considered sending an announcement to the org-mode mailing list? 14 | http://org-mode.org 15 | 16 | Various ways of searching/referencing emails from emacs were discussed 17 | there several times and none of them were as elegant as notmuch (not 18 | even close). Maybe notmuch would attract some of the developers 19 | there.. 20 | 21 | -- Jan 22 | 23 | -------------------------------------------------------------------------------- /test/corpus/foo/baz/new/16:2,: -------------------------------------------------------------------------------- 1 | From: "Jan Janak" 2 | To: notmuch@notmuchmail.org 3 | Date: Tue, 17 Nov 2009 23:38:47 +0100 4 | Subject: [notmuch] What a great idea! 5 | In-Reply-To: 6 | References: 7 | Message-ID: 8 | 9 | On Tue, Nov 17, 2009 at 11:35 PM, Jan Janak wrote: 10 | > Hello, 11 | > 12 | > First of all, notmuch is a wonderful idea, both the cmdline tool and 13 | > the emacs interface! Thanks a lot for writing it, I was really excited 14 | > when I read the announcement today. 15 | > 16 | > Have you considered sending an announcement to the org-mode mailing list? 17 | > http://org-mode.org 18 | 19 | Sorry, wrong URL, the correct one is: http://orgmode.org 20 | 21 | > Various ways of searching/referencing emails from emacs were discussed 22 | > there several times and none of them were as elegant as notmuch (not 23 | > even close). Maybe notmuch would attract some of the developers 24 | > there.. 25 | 26 | -- Jan 27 | 28 | -------------------------------------------------------------------------------- /test/corpus/foo/new/09:2,: -------------------------------------------------------------------------------- 1 | From: "Mikhail Gusarov" 2 | To: notmuch@notmuchmail.org 3 | Date: Wed, 18 Nov 2009 02:50:48 +0600 4 | Subject: [notmuch] Working with Maildir storage? 5 | In-Reply-To: <20091117203301.GV3165@dottiness.seas.harvard.edu> (Lars 6 | Kellogg-Stedman's message of "Tue, 17 Nov 2009 15:33:01 -0500") 7 | References: <20091117190054.GU3165@dottiness.seas.harvard.edu> 8 | <87iqd9rn3l.fsf@vertex.dottedmag> 9 | <20091117203301.GV3165@dottiness.seas.harvard.edu> 10 | Message-ID: <87fx8can9z.fsf@vertex.dottedmag> 11 | 12 | 13 | Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu did gyre and gimble: 14 | 15 | LK> Is the list archived anywhere? The obvious archives 16 | LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I 17 | LK> think I subscribed too late to get the patch (I only just saw the 18 | LK> discussion about it). 19 | 20 | LK> It doesn't look like the patch is in git yet. 21 | 22 | Just has been pushed 23 | 24 | -- 25 | http://fossarchy.blogspot.com/ 26 | -------------- next part -------------- 27 | A non-text attachment was scrubbed... 28 | Name: not available 29 | Type: application/pgp-signature 30 | Size: 834 bytes 31 | Desc: not available 32 | URL: 33 | 34 | -------------------------------------------------------------------------------- /test/database-test.h: -------------------------------------------------------------------------------- 1 | #ifndef _DATABASE_TEST_H 2 | #define _DATABASE_TEST_H 3 | /* Add a new stub message to the given notmuch database. 4 | * 5 | * At least the following return values are possible: 6 | * 7 | * NOTMUCH_STATUS_SUCCESS: Message successfully added to database. 8 | * 9 | * NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: Message has the same message 10 | * ID as another message already in the database. 11 | * 12 | * NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in read-only 13 | * mode so no message can be added. 14 | */ 15 | 16 | notmuch_status_t 17 | notmuch_database_add_stub_message (notmuch_database_t *database, 18 | const char *message_id, 19 | const char **tag_list); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /test/emacs-address-cleaning.el: -------------------------------------------------------------------------------- 1 | (defun notmuch-test-address-cleaning-1 () 2 | (notmuch-test-expect-equal (notmuch-show-clean-address "dme@dme.org") 3 | "dme@dme.org")) 4 | 5 | (defun notmuch-test-address-cleaning-2 () 6 | (let* ((input '("foo@bar.com" 7 | "" 8 | "Foo Bar " 9 | "foo@bar.com " 10 | "\"Foo Bar\" ")) 11 | (expected '("foo@bar.com" 12 | "foo@bar.com" 13 | "Foo Bar " 14 | "foo@bar.com" 15 | "Foo Bar ")) 16 | (output (mapcar #'notmuch-show-clean-address input))) 17 | (notmuch-test-expect-equal output expected))) 18 | 19 | (defun notmuch-test-address-cleaning-3 () 20 | (let* ((input '("ДБ " 21 | "foo (at home) " 22 | "foo [at home] " 23 | "Foo Bar" 24 | "'Foo Bar' " 25 | "\"'Foo Bar'\" " 26 | "'\"Foo Bar\"' " 27 | "'\"'Foo Bar'\"' " 28 | "Fred Dibna \\[extraordinaire\\] ")) 29 | (expected '("ДБ " 30 | "foo (at home) " 31 | "foo [at home] " 32 | "Foo Bar" 33 | "Foo Bar " 34 | "Foo Bar " 35 | "Foo Bar " 36 | "Foo Bar " 37 | "Fred Dibna [extraordinaire] ")) 38 | (output (mapcar #'notmuch-show-clean-address input))) 39 | (notmuch-test-expect-equal output expected))) 40 | -------------------------------------------------------------------------------- /test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-off: -------------------------------------------------------------------------------- 1 | Lars Kellogg-Stedman (2009-11-17) (inbox signed unread) 2 | Subject: [notmuch] Working with Maildir storage? 3 | Mikhail Gusarov (2009-11-17) (inbox signed unread) 4 | Lars Kellogg-Stedman (2009-11-17) (inbox signed) 5 | Subject: Re: [notmuch] Working with Maildir storage? 6 | To: Mikhail Gusarov 7 | Cc: notmuch@notmuchmail.org 8 | Date: Tue, 17 Nov 2009 15:33:01 -0500 9 | 10 | [ multipart/mixed ] 11 | [ multipart/signed ] 12 | [ text/plain ] 13 | > See the patch just posted here. 14 | 15 | Is the list archived anywhere? The obvious archives 16 | (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I 17 | think I subscribed too late to get the patch (I only just saw the 18 | discussion about it). 19 | 20 | It doesn't look like the patch is in git yet. 21 | 22 | -- Lars 23 | 24 | [ 4-line signature. Click/Enter to show. ] 25 | [ application/pgp-signature ] 26 | [ text/plain ] 27 | [ 4-line signature. Click/Enter to show. ] 28 | Mikhail Gusarov (2009-11-17) (inbox unread) 29 | Keith Packard (2009-11-17) (inbox unread) 30 | Lars Kellogg-Stedman (2009-11-18) (inbox signed unread) 31 | Carl Worth (2009-11-18) (inbox unread) 32 | -------------------------------------------------------------------------------- /test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-on: -------------------------------------------------------------------------------- 1 | Lars Kellogg-Stedman (2009-11-17) (inbox signed unread) 2 | Subject: [notmuch] Working with Maildir storage? 3 | Mikhail Gusarov (2009-11-17) (inbox signed unread) 4 | Lars Kellogg-Stedman (2009-11-17) (inbox signed) 5 | Subject: Re: [notmuch] Working with Maildir storage? 6 | To: Mikhail Gusarov 7 | Cc: notmuch@notmuchmail.org 8 | Date: Tue, 17 Nov 2009 15:33:01 -0500 9 | 10 | [ multipart/mixed ] 11 | [ multipart/signed ] 12 | [ Unknown key ID 0xD74695063141ACD8 or unsupported algorithm ] 13 | [ text/plain ] 14 | > See the patch just posted here. 15 | 16 | Is the list archived anywhere? The obvious archives 17 | (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I 18 | think I subscribed too late to get the patch (I only just saw the 19 | discussion about it). 20 | 21 | It doesn't look like the patch is in git yet. 22 | 23 | -- Lars 24 | 25 | [ 4-line signature. Click/Enter to show. ] 26 | [ application/pgp-signature ] 27 | [ text/plain ] 28 | [ 4-line signature. Click/Enter to show. ] 29 | Mikhail Gusarov (2009-11-17) (inbox unread) 30 | Keith Packard (2009-11-17) (inbox unread) 31 | Lars Kellogg-Stedman (2009-11-18) (inbox signed unread) 32 | Carl Worth (2009-11-18) (inbox unread) 33 | -------------------------------------------------------------------------------- /test/emacs.expected-output/attachment: -------------------------------------------------------------------------------- 1 | From e3bc4bbd7b9d0d086816ab5f8f2d6ffea1dd3ea4 Mon Sep 17 00:00:00 2001 2 | From: Alexander Botero-Lowry 3 | Date: Tue, 17 Nov 2009 11:30:39 -0800 4 | Subject: [PATCH] Deal with situation where sysconf(_SC_GETPW_R_SIZE_MAX) returns -1 5 | 6 | --- 7 | notmuch-config.c | 2 ++ 8 | 1 files changed, 2 insertions(+), 0 deletions(-) 9 | 10 | diff --git a/notmuch-config.c b/notmuch-config.c 11 | index 248149c..e7220d8 100644 12 | --- a/notmuch-config.c 13 | +++ b/notmuch-config.c 14 | @@ -77,6 +77,7 @@ static char * 15 | get_name_from_passwd_file (void *ctx) 16 | { 17 | long pw_buf_size = sysconf(_SC_GETPW_R_SIZE_MAX); 18 | + if (pw_buf_size == -1) pw_buf_size = 64; 19 | char *pw_buf = talloc_zero_size (ctx, pw_buf_size); 20 | struct passwd passwd, *ignored; 21 | char *name; 22 | @@ -101,6 +102,7 @@ static char * 23 | get_username_from_passwd_file (void *ctx) 24 | { 25 | long pw_buf_size = sysconf(_SC_GETPW_R_SIZE_MAX); 26 | + if (pw_buf_size == -1) pw_buf_size = 64; 27 | char *pw_buf = talloc_zero_size (ctx, pw_buf_size); 28 | struct passwd passwd, *ignored; 29 | char *name; 30 | -- 31 | 1.6.5.2 32 | 33 | -------------------------------------------------------------------------------- /test/emacs.expected-output/notmuch-hello: -------------------------------------------------------------------------------- 1 | Welcome to notmuch. You have 52 messages. 2 | 3 | Saved searches: [edit] 4 | 5 | 52 inbox 52 unread 52 all mail 6 | 7 | Search: . 8 | 9 | All tags: [show] 10 | 11 | Type a search query and hit RET to view matching threads. 12 | Edit saved searches with the `edit' button. 13 | Hit RET or click on a saved search or tag name to view matching threads. 14 | `=' to refresh this screen. `s' to search messages. `q' to quit. 15 | Customize this page. 16 | -------------------------------------------------------------------------------- /test/emacs.expected-output/notmuch-hello-empty-custom-queries-section: -------------------------------------------------------------------------------- 1 | : [hide] 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/emacs.expected-output/notmuch-hello-empty-custom-tags-section: -------------------------------------------------------------------------------- 1 | : [hide] 2 | 3 | 4 attachment 7 signed 4 | 52 inbox 52 unread 5 | 6 | -------------------------------------------------------------------------------- /test/emacs.expected-output/notmuch-hello-long-names: -------------------------------------------------------------------------------- 1 | Welcome to notmuch. You have 52 messages. 2 | 3 | Saved searches: [edit] 4 | 5 | 52 inbox 52 unread 52 all mail 6 | 7 | Search: . 8 | 9 | All tags: [hide] 10 | 11 | 52 a-very-long-tag 52 inbox 52 unread 12 | 4 attachment 7 signed 13 | 14 | Type a search query and hit RET to view matching threads. 15 | Edit saved searches with the `edit' button. 16 | Hit RET or click on a saved search or tag name to view matching threads. 17 | `=' to refresh this screen. `s' to search messages. `q' to quit. 18 | Customize this page. 19 | -------------------------------------------------------------------------------- /test/emacs.expected-output/notmuch-hello-new-section: -------------------------------------------------------------------------------- 1 | Test: [hide] 2 | 3 | 52 inbox 4 | 5 | -------------------------------------------------------------------------------- /test/emacs.expected-output/notmuch-hello-no-saved-searches: -------------------------------------------------------------------------------- 1 | Welcome to notmuch. You have 52 messages. 2 | 3 | Search: . 4 | 5 | All tags: [show] 6 | 7 | Type a search query and hit RET to view matching threads. 8 | Edit saved searches with the `edit' button. 9 | Hit RET or click on a saved search or tag name to view matching threads. 10 | `=' to refresh this screen. `s' to search messages. `q' to quit. 11 | Customize this page. 12 | -------------------------------------------------------------------------------- /test/emacs.expected-output/notmuch-hello-section-counts: -------------------------------------------------------------------------------- 1 | Test-with-counts: [hide] 2 | 3 | 2 attachment 7 signed 4 | 7 inbox 7 unread 5 | 6 | -------------------------------------------------------------------------------- /test/emacs.expected-output/notmuch-hello-section-hidden-tag: -------------------------------------------------------------------------------- 1 | Test-with-filtered: [hide] 2 | 3 | 4 attachment 52 inbox 7 signed 4 | 5 | -------------------------------------------------------------------------------- /test/emacs.expected-output/notmuch-hello-section-with-empty: -------------------------------------------------------------------------------- 1 | Test-with-empty: [hide] 2 | 3 | 52 inbox 4 | 5 | -------------------------------------------------------------------------------- /test/emacs.expected-output/notmuch-hello-with-empty: -------------------------------------------------------------------------------- 1 | Welcome to notmuch. You have 52 messages. 2 | 3 | Saved searches: [edit] 4 | 5 | 52 inbox 52 unread 0 empty 6 | 7 | Search: . 8 | 9 | All tags: [show] 10 | 11 | Type a search query and hit RET to view matching threads. 12 | Edit saved searches with the `edit' button. 13 | Hit RET or click on a saved search or tag name to view matching threads. 14 | `=' to refresh this screen. `s' to search messages. `q' to quit. 15 | Customize this page. 16 | -------------------------------------------------------------------------------- /test/emacs.expected-output/notmuch-show-message-with-headers-hidden: -------------------------------------------------------------------------------- 1 | Jan Janak (2009-11-17) (inbox unread) 2 | Subject: [notmuch] What a great idea! 3 | Jan Janak (2009-11-17) (inbox) 4 | 5 | On Tue, Nov 17, 2009 at 11:35 PM, Jan Janak wrote: 6 | > Hello, 7 | > 8 | > First of all, notmuch is a wonderful idea, both the cmdline tool and 9 | [ 2 more citation lines. Click/Enter to show. ] 10 | > 11 | > Have you considered sending an announcement to the org-mode mailing list? 12 | > http://org-mode.org 13 | 14 | Sorry, wrong URL, the correct one is: http://orgmode.org 15 | 16 | > Various ways of searching/referencing emails from emacs were discussed 17 | > there several times and none of them were as elegant as notmuch (not 18 | > even close). Maybe notmuch would attract some of the developers 19 | > there.. 20 | 21 | -- Jan 22 | Carl Worth (2009-11-18) (inbox unread) 23 | -------------------------------------------------------------------------------- /test/emacs.expected-output/notmuch-show-message-with-headers-visible: -------------------------------------------------------------------------------- 1 | Jan Janak (2009-11-17) (inbox unread) 2 | Subject: [notmuch] What a great idea! 3 | Jan Janak (2009-11-17) (inbox) 4 | Subject: [notmuch] What a great idea! 5 | To: notmuch@notmuchmail.org 6 | Date: Tue, 17 Nov 2009 23:38:47 +0100 7 | 8 | On Tue, Nov 17, 2009 at 11:35 PM, Jan Janak wrote: 9 | > Hello, 10 | > 11 | > First of all, notmuch is a wonderful idea, both the cmdline tool and 12 | [ 2 more citation lines. Click/Enter to show. ] 13 | > 14 | > Have you considered sending an announcement to the org-mode mailing list? 15 | > http://org-mode.org 16 | 17 | Sorry, wrong URL, the correct one is: http://orgmode.org 18 | 19 | > Various ways of searching/referencing emails from emacs were discussed 20 | > there several times and none of them were as elegant as notmuch (not 21 | > even close). Maybe notmuch would attract some of the developers 22 | > there.. 23 | 24 | -- Jan 25 | Carl Worth (2009-11-18) (inbox unread) 26 | -------------------------------------------------------------------------------- /test/emacs.expected-output/notmuch-show-thread-with-all-messages-collapsed: -------------------------------------------------------------------------------- 1 | Jan Janak (2009-11-17) (inbox) 2 | Subject: [notmuch] What a great idea! 3 | Jan Janak (2009-11-17) (inbox) 4 | Carl Worth (2009-11-18) (inbox unread) 5 | -------------------------------------------------------------------------------- /test/emacs.expected-output/notmuch-show-thread-with-hidden-messages: -------------------------------------------------------------------------------- 1 | Jan Janak (2009-11-17) (inbox unread) 2 | Subject: [notmuch] What a great idea! 3 | Jan Janak (2009-11-17) (inbox) 4 | Carl Worth (2009-11-18) (inbox unread) 5 | -------------------------------------------------------------------------------- /test/gen-threads.py: -------------------------------------------------------------------------------- 1 | # Generate all possible single-root message thread structures of size 2 | # argv[1]. Each output line is a thread structure, where the n'th 3 | # field is either a number giving the parent of message n or "None" 4 | # for the root. 5 | 6 | import sys 7 | from itertools import chain, combinations 8 | 9 | def subsets(s): 10 | return chain.from_iterable(combinations(s, r) for r in range(len(s)+1)) 11 | 12 | nodes = set(range(int(sys.argv[1]))) 13 | 14 | # Queue of (tree, free, to_expand) where tree is a {node: parent} 15 | # dictionary, free is a set of unattached nodes, and to_expand is 16 | # itself a queue of nodes in the tree that need to be expanded. 17 | # The queue starts with all single-node trees. 18 | queue = [({root: None}, nodes - {root}, (root,)) for root in nodes] 19 | 20 | # Process queue 21 | while queue: 22 | tree, free, to_expand = queue.pop() 23 | 24 | if len(to_expand) == 0: 25 | # Only print full-sized trees 26 | if len(free) == 0: 27 | print(" ".join(map(str, [msg[1] for msg in sorted(tree.items())]))) 28 | else: 29 | # Expand node to_expand[0] with each possible set of children 30 | for children in subsets(free): 31 | ntree = dict(tree, **{child: to_expand[0] for child in children}) 32 | nfree = free.difference(children) 33 | queue.append((ntree, nfree, to_expand[1:] + tuple(children))) 34 | -------------------------------------------------------------------------------- /test/gnupg-secret-key.NOTE: -------------------------------------------------------------------------------- 1 | How the crypto test gnupg secret was generated: 2 | 3 | GNUPGHOME=gnupghome gpg --quick-random --gen-key 4 | kind: 1 (RSA/RSA) 5 | size: 1024 6 | expire: 0 7 | name: Notmuch Test Suite 8 | email: test_suite@notmuchmail.org 9 | (no passphrase) 10 | -------------------------------------------------------------------------------- /test/make-db-version.cc: -------------------------------------------------------------------------------- 1 | /* Create an empty notmuch database with a specific version and 2 | * features. */ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | int main(int argc, char **argv) 12 | { 13 | if (argc != 4) { 14 | fprintf (stderr, "Usage: %s mailpath version features\n", argv[0]); 15 | exit (2); 16 | } 17 | 18 | std::string nmpath (argv[1]); 19 | nmpath += "/.notmuch"; 20 | if (mkdir (nmpath.c_str (), 0777) < 0) { 21 | perror (("failed to create " + nmpath).c_str ()); 22 | exit (1); 23 | } 24 | 25 | try { 26 | Xapian::WritableDatabase db ( 27 | nmpath + "/xapian", Xapian::DB_CREATE_OR_OPEN); 28 | db.set_metadata ("version", argv[2]); 29 | db.set_metadata ("features", argv[3]); 30 | db.commit (); 31 | } catch (const Xapian::Error &e) { 32 | fprintf (stderr, "%s\n", e.get_description ().c_str ()); 33 | exit (1); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test/notmuch-test: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Run tests 4 | # 5 | # Copyright (c) 2005 Junio C Hamano 6 | # 7 | # Adapted from a Makefile to a shell script by Carl Worth (2010) 8 | 9 | if [ ${BASH_VERSINFO[0]} -lt 4 ]; then 10 | echo "Error: The notmuch test suite requires a bash version >= 4.0" 11 | echo "due to use of associative arrays within the test suite." 12 | echo "Please try again with a newer bash (or help us fix the" 13 | echo "test suite to be more portable). Thanks." 14 | exit 1 15 | fi 16 | 17 | cd $(dirname "$0") 18 | 19 | TESTS=${NOTMUCH_TESTS:-`echo T[0-9][0-9][0-9]-*.sh`} 20 | 21 | # Clean up any results from a previous run 22 | rm -r test-results >/dev/null 2>/dev/null 23 | 24 | # test for timeout utility 25 | if command -v timeout >/dev/null; then 26 | TEST_TIMEOUT_CMD="timeout 2m " 27 | echo "INFO: using 2 minute timeout for tests" 28 | else 29 | TEST_TIMEOUT_CMD="" 30 | fi 31 | 32 | trap 'e=$?; kill $!; exit $e' HUP INT TERM 33 | # Run the tests 34 | for test in $TESTS; do 35 | $TEST_TIMEOUT_CMD ./$test "$@" & 36 | wait $! 37 | # If the test failed without producing results, then it aborted, 38 | # so we should abort, too. 39 | RES=$? 40 | if [[ $RES != 0 && ! -e "test-results/${test%.sh}" ]]; then 41 | exit $RES 42 | fi 43 | done 44 | trap - HUP INT TERM 45 | 46 | # Report results 47 | echo 48 | ./aggregate-results.sh test-results/* 49 | ev=$? 50 | 51 | # Clean up 52 | rm -rf test-results corpus.mail 53 | 54 | exit $ev 55 | -------------------------------------------------------------------------------- /test/symbol-test.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | int main() { 7 | notmuch_database_t *notmuch; 8 | notmuch_database_open("fakedb", NOTMUCH_DATABASE_MODE_READ_ONLY, ¬much); 9 | 10 | try { 11 | (void) new Xapian::WritableDatabase("./nonexistant", Xapian::DB_OPEN); 12 | } catch (const Xapian::Error &error) { 13 | printf("caught %s\n", error.get_msg().c_str()); 14 | return 0; 15 | } 16 | 17 | return 1; 18 | } 19 | -------------------------------------------------------------------------------- /test/test-databases/.gitignore: -------------------------------------------------------------------------------- 1 | *.tar.xz 2 | -------------------------------------------------------------------------------- /test/test-databases/Makefile: -------------------------------------------------------------------------------- 1 | # See Makefile.local for the list of files to be compiled in this 2 | # directory. 3 | all: 4 | $(MAKE) -C ../.. all 5 | 6 | .DEFAULT: 7 | $(MAKE) -C ../.. $@ 8 | -------------------------------------------------------------------------------- /test/test-databases/Makefile.local: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | 3 | TEST_DATABASE_MIRROR=http://notmuchmail.org/releases/test-databases 4 | 5 | dir := test/test-databases 6 | 7 | test_databases := $(dir)/database-v1.tar.xz 8 | 9 | %.tar.xz: 10 | wget -nv -O $@ ${TEST_DATABASE_MIRROR}/$(notdir $@); 11 | 12 | download-test-databases: ${test_databases} 13 | 14 | DATACLEAN := $(DATACLEAN) ${test_databases} 15 | -------------------------------------------------------------------------------- /test/test-databases/database-v1.tar.xz.sha256: -------------------------------------------------------------------------------- 1 | 4299e051b10e1fa7b33ea2862790a09ebfe96859681804e5251e130f800e69d2 database-v1.tar.xz 2 | -------------------------------------------------------------------------------- /test/test-verbose: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | test_description='the verbosity options of the test framework itself.' 4 | 5 | . ./test-lib.sh 6 | 7 | test_expect_success 'print something in test_expect_success and pass' ' 8 | echo "hello stdout" && 9 | echo "hello stderr" >&2 && 10 | true 11 | ' 12 | test_expect_success 'print something in test_expect_success and fail' ' 13 | echo "hello stdout" && 14 | echo "hello stderr" >&2 && 15 | false 16 | ' 17 | test_begin_subtest 'print something between test_begin_subtest and test_expect_equal and pass' 18 | echo "hello stdout" 19 | echo "hello stderr" >&2 20 | test_expect_equal "a" "a" 21 | 22 | test_begin_subtest 'print something test_begin_subtest and test_expect_equal and fail' 23 | echo "hello stdout" 24 | echo "hello stderr" >&2 25 | test_expect_equal "a" "b" 26 | 27 | test_done 28 | -------------------------------------------------------------------------------- /test/test.expected-output/test-verbose-no: -------------------------------------------------------------------------------- 1 | 2 | test-verbose: Testing the verbosity options of the test framework itself. 3 | PASS print something in test_expect_success and pass 4 | FAIL print something in test_expect_success and fail 5 | 6 | echo "hello stdout" && 7 | echo "hello stderr" >&2 && 8 | false 9 | 10 | hello stdout 11 | hello stderr 12 | PASS print something between test_begin_subtest and test_expect_equal and pass 13 | FAIL print something test_begin_subtest and test_expect_equal and fail 14 | --- test-verbose.4.expected 2010-11-14 21:41:12.738189710 +0000 15 | +++ test-verbose.4.output 2010-11-14 21:41:12.738189710 +0000 16 | @@ -1 +1 @@ 17 | -b 18 | +a 19 | hello stdout 20 | hello stderr 21 | 22 | -------------------------------------------------------------------------------- /test/test.expected-output/test-verbose-yes: -------------------------------------------------------------------------------- 1 | 2 | test-verbose: Testing the verbosity options of the test framework itself. 3 | hello stdout 4 | hello stderr 5 | PASS print something in test_expect_success and pass 6 | hello stdout 7 | hello stderr 8 | FAIL print something in test_expect_success and fail 9 | 10 | echo "hello stdout" && 11 | echo "hello stderr" >&2 && 12 | false 13 | 14 | hello stdout 15 | hello stderr 16 | PASS print something between test_begin_subtest and test_expect_equal and pass 17 | hello stdout 18 | hello stderr 19 | FAIL print something test_begin_subtest and test_expect_equal and fail 20 | --- test-verbose.4.expected 2010-11-14 21:41:06.650023289 +0000 21 | +++ test-verbose.4.output 2010-11-14 21:41:06.650023289 +0000 22 | @@ -1 +1 @@ 23 | -b 24 | +a 25 | 26 | -------------------------------------------------------------------------------- /test/tree.expected-output/notmuch-tree-show-window: -------------------------------------------------------------------------------- 1 | Lars Kellogg-Stedman (2009-11-17) (inbox signed) 2 | Subject: [notmuch] Working with Maildir storage? 3 | To: notmuch@notmuchmail.org 4 | Date: Tue, 17 Nov 2009 14:00:54 -0500 5 | 6 | [ multipart/mixed ] 7 | [ multipart/signed ] 8 | [ text/plain ] 9 | I saw the LWN article and decided to take a look at notmuch. I'm 10 | currently using mutt and mairix to index and read a collection of 11 | Maildir mail folders (around 40,000 messages total). 12 | 13 | notmuch indexed the messages without complaint, but my attempt at 14 | searching bombed out. Running, for example: 15 | 16 | notmuch search storage 17 | 18 | Resulted in 4604 lines of errors along the lines of: 19 | 20 | Error opening 21 | /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S: 22 | Too many open files 23 | 24 | I'm curious if this is expected behavior (i.e., notmuch does not work 25 | with Maildir) or if something else is going on. 26 | 27 | Cheers, 28 | 29 | [ 4-line signature. Click/Enter to show. ] 30 | -- 31 | Lars Kellogg-Stedman 32 | Senior Technologist, Computing and Information Technology 33 | Harvard University School of Engineering and Applied Sciences 34 | [ application/pgp-signature ] 35 | [ text/plain ] 36 | [ 4-line signature. Click/Enter to show. ] 37 | _______________________________________________ 38 | notmuch mailing list 39 | notmuch@notmuchmail.org 40 | http://notmuchmail.org/mailman/listinfo/notmuch 41 | -------------------------------------------------------------------------------- /test/tree.expected-output/notmuch-tree-single-thread: -------------------------------------------------------------------------------- 1 | 2009-11-17 Mikhail Gusarov ┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox) 2 | 2009-11-17 Mikhail Gusarov ├─►[notmuch] [PATCH 2/2] Include to get uint32_t in C++ file with gcc 4.4 (inbox unread) 3 | 2009-11-17 Carl Worth ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread) 4 | 2009-11-17 Keith Packard ╰┬► ... (inbox unread) 5 | 2009-11-18 Carl Worth ╰─► ... (inbox unread) 6 | End of search results. 7 | -------------------------------------------------------------------------------- /test/valgrind/suppressions: -------------------------------------------------------------------------------- 1 | { 2 | zlib inflation uses uninitialize values 3 | Memcheck:Cond 4 | fun:inflateReset2 5 | fun:inflateInit2_ 6 | } -------------------------------------------------------------------------------- /test/valgrind/valgrind.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | base=$(basename "$0") 4 | 5 | TRACK_ORIGINS= 6 | 7 | VALGRIND_VERSION=$(valgrind --version) 8 | VALGRIND_MAJOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*\([0-9]*\)') 9 | VALGRIND_MINOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*[0-9]*\.\([0-9]*\)') 10 | test 3 -gt "$VALGRIND_MAJOR" || 11 | test 3 -eq "$VALGRIND_MAJOR" -a 4 -gt "$VALGRIND_MINOR" || 12 | TRACK_ORIGINS=--track-origins=yes 13 | 14 | exec valgrind -q --error-exitcode=126 \ 15 | --leak-check=no \ 16 | --suppressions="$GIT_VALGRIND/suppressions" \ 17 | --gen-suppressions=all \ 18 | $TRACK_ORIGINS \ 19 | --log-fd=4 \ 20 | --input-fd=4 \ 21 | $GIT_VALGRIND_OPTIONS \ 22 | "$GIT_VALGRIND"/../../"$base" "$@" 23 | -------------------------------------------------------------------------------- /util/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | $(MAKE) -C .. all 3 | 4 | .DEFAULT: 5 | $(MAKE) -C .. $@ 6 | -------------------------------------------------------------------------------- /util/Makefile.local: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | 3 | dir := util 4 | extra_cflags += -I$(srcdir)/$(dir) 5 | 6 | libutil_c_srcs := $(dir)/xutil.c $(dir)/error_util.c $(dir)/hex-escape.c \ 7 | $(dir)/string-util.c $(dir)/talloc-extra.c $(dir)/zlib-extra.c \ 8 | $(dir)/util.c 9 | 10 | libutil_modules := $(libutil_c_srcs:.c=.o) 11 | 12 | $(dir)/libutil.a: $(libutil_modules) 13 | $(call quiet,AR) rcs $@ $^ 14 | 15 | SRCS := $(SRCS) $(libutil_c_srcs) 16 | CLEAN := $(CLEAN) $(libutil_modules) $(dir)/libutil.a 17 | -------------------------------------------------------------------------------- /util/endian-util.h: -------------------------------------------------------------------------------- 1 | /* this file mimics the macros present in recent GCC and CLANG */ 2 | 3 | #ifndef _ENDIAN_UTIL_H 4 | #define _ENDIAN_UTIL_H 5 | 6 | /* This are prefixed with UTIL to avoid collisions 7 | * 8 | * You can use something like the following to define UTIL_BYTE_ORDER 9 | * in a configure script. 10 | */ 11 | #if 0 12 | #include 13 | #include 14 | uint32_t test = 0x34333231; 15 | int main() { printf("%.4s\n", (const char*)&test); return 0; } 16 | #endif 17 | 18 | #define UTIL_ORDER_BIG_ENDIAN 4321 19 | #define UTIL_ORDER_LITTLE_ENDIAN 1234 20 | 21 | 22 | #if !defined(UTIL_BYTE_ORDER) || ((UTIL_BYTE_ORDER != UTIL_ORDER_BIG_ENDIAN) && \ 23 | (UTIL_BYTE_ORDER != UTIL_ORDER_LITTLE_ENDIAN)) 24 | #undef UTIL_BYTE_ORDER 25 | #ifdef __BYTE_ORDER__ 26 | # if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) 27 | # define UTIL_BYTE_ORDER UTIL_ORDER_LITTLE_ENDIAN 28 | # elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) 29 | # define UTIL_BYTE_ORDER UTIL_ORDER_BIG_ENDIAN 30 | # else 31 | # error "Unsupported __BYTE_ORDER__" 32 | # endif 33 | #else 34 | # error "UTIL_BYTE_ORDER not correctly defined and __BYTE_ORDER__ not defined." 35 | #endif 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /util/error_util.c: -------------------------------------------------------------------------------- 1 | /* error_util.c - internal error utilities for notmuch. 2 | * 3 | * Copyright © 2009 Carl Worth 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/ . 17 | * 18 | * Author: Carl Worth 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #include "error_util.h" 26 | 27 | void 28 | _internal_error (const char *format, ...) 29 | { 30 | va_list va_args; 31 | 32 | va_start (va_args, format); 33 | 34 | fprintf (stderr, "Internal error: "); 35 | vfprintf (stderr, format, va_args); 36 | 37 | exit (1); 38 | } 39 | 40 | -------------------------------------------------------------------------------- /util/error_util.h: -------------------------------------------------------------------------------- 1 | /* error_util.h - Provide the INTERNAL_ERROR macro 2 | * 3 | * Copyright © 2009 Carl Worth 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/ . 17 | * 18 | * Author: Carl Worth 19 | */ 20 | 21 | #ifndef ERROR_UTIL_H 22 | #define ERROR_UTIL_H 23 | 24 | #include 25 | 26 | #include "function-attributes.h" 27 | 28 | /* There's no point in continuing when we've detected that we've done 29 | * something wrong internally (as opposed to the user passing in a 30 | * bogus value). 31 | * 32 | * Note that PRINTF_ATTRIBUTE comes from talloc.h 33 | */ 34 | void 35 | _internal_error (const char *format, ...) PRINTF_ATTRIBUTE (1, 2) NORETURN_ATTRIBUTE; 36 | 37 | /* There's no point in continuing when we've detected that we've done 38 | * something wrong internally (as opposed to the user passing in a 39 | * bogus value). 40 | * 41 | * Note that __location__ comes from talloc.h. 42 | */ 43 | #define INTERNAL_ERROR(format, ...) \ 44 | _internal_error (format " (%s).\n", \ 45 | ##__VA_ARGS__, __location__) 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /util/hex-escape.h: -------------------------------------------------------------------------------- 1 | #ifndef _HEX_ESCAPE_H 2 | #define _HEX_ESCAPE_H 3 | 4 | typedef enum hex_status { 5 | HEX_SUCCESS = 0, 6 | HEX_SYNTAX_ERROR, 7 | HEX_OUT_OF_MEMORY 8 | } hex_status_t; 9 | 10 | /* 11 | * The API for hex_encode() and hex_decode() is modelled on that for 12 | * getline. 13 | * 14 | * If 'out' points to a NULL pointer a char array of the appropriate 15 | * size is allocated using talloc, and out_size is updated. 16 | * 17 | * If 'out' points to a non-NULL pointer, it assumed to describe an 18 | * existing char array, with the size given in *out_size. This array 19 | * may be resized by talloc_realloc if needed; in this case *out_size 20 | * will also be updated. 21 | * 22 | * Note that it is an error to pass a NULL pointer for any parameter 23 | * of these routines. 24 | */ 25 | 26 | hex_status_t 27 | hex_encode (void *talloc_ctx, const char *in, char **out, 28 | size_t *out_size); 29 | 30 | hex_status_t 31 | hex_decode (void *talloc_ctx, const char *in, char **out, 32 | size_t *out_size); 33 | 34 | /* 35 | * Non-allocating hex decode to decode 's' in-place. The length of the 36 | * result is always equal to or shorter than the length of the 37 | * original. 38 | */ 39 | hex_status_t 40 | hex_decode_inplace (char *s); 41 | #endif 42 | -------------------------------------------------------------------------------- /util/talloc-extra.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "talloc-extra.h" 3 | 4 | char * 5 | talloc_strndup_named_const (void *ctx, const char *str, 6 | size_t len, const char *name) 7 | { 8 | char *ptr = talloc_strndup (ctx, str, len); 9 | 10 | if (ptr) 11 | talloc_set_name_const (ptr, name); 12 | 13 | return ptr; 14 | } 15 | -------------------------------------------------------------------------------- /util/talloc-extra.h: -------------------------------------------------------------------------------- 1 | #ifndef _TALLOC_EXTRA_H 2 | #define _TALLOC_EXTRA_H 3 | 4 | #include 5 | 6 | /* Like talloc_strndup, but take an extra parameter for the internal talloc 7 | * name (for debugging) */ 8 | 9 | char * 10 | talloc_strndup_named_const (void *ctx, const char *str, 11 | size_t len, const char *name); 12 | 13 | /* use the __location__ macro from talloc.h to name a string according to its 14 | * source location */ 15 | 16 | #define talloc_strndup_debug(ctx, str, len) talloc_strndup_named_const (ctx, str, len, __location__) 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /util/util.c: -------------------------------------------------------------------------------- 1 | #include "util.h" 2 | #include "error_util.h" 3 | #include 4 | #include 5 | 6 | const char * 7 | util_error_string (util_status_t errnum) 8 | { 9 | switch (errnum) { 10 | case UTIL_SUCCESS: 11 | return "success"; 12 | case UTIL_OUT_OF_MEMORY: 13 | return "out of memory"; 14 | case UTIL_EOF: 15 | return "end of file"; 16 | case UTIL_ERRNO: 17 | return strerror (errno); 18 | case UTIL_GZERROR: 19 | /* we lack context to be more informative here */ 20 | return "zlib error"; 21 | default: 22 | INTERNAL_ERROR("unexpected error status %d", errnum); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /util/util.h: -------------------------------------------------------------------------------- 1 | #ifndef _UTIL_H 2 | #define _UTIL_H 3 | 4 | typedef enum util_status { 5 | /** 6 | * No error occurred. 7 | */ 8 | UTIL_SUCCESS = 0, 9 | /** 10 | * Out of memory. 11 | */ 12 | UTIL_OUT_OF_MEMORY, 13 | /** 14 | * End of stream reached while attempting to read. 15 | */ 16 | UTIL_EOF, 17 | /** 18 | * Low level error occured, consult errno. 19 | */ 20 | UTIL_ERRNO, 21 | /** 22 | * Zlib error occured, call gzerror for details. 23 | */ 24 | UTIL_GZERROR 25 | } util_status_t; 26 | 27 | const char * 28 | util_error_string (util_status_t status); 29 | #endif 30 | -------------------------------------------------------------------------------- /util/xutil.h: -------------------------------------------------------------------------------- 1 | /* xutil.h - Various wrapper functions to abort on error. 2 | * 3 | * Copyright © 2009 Carl Worth 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see http://www.gnu.org/licenses/ . 17 | * 18 | * Author: Carl Worth 19 | */ 20 | 21 | #ifndef NOTMUCH_XUTIL_H 22 | #define NOTMUCH_XUTIL_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | /* xutil.c */ 29 | void * 30 | xcalloc (size_t nmemb, size_t size); 31 | 32 | void * 33 | xmalloc (size_t size); 34 | 35 | void * 36 | xrealloc (void *ptrr, size_t size); 37 | 38 | char * 39 | xstrdup (const char *s); 40 | 41 | char * 42 | xstrndup (const char *s, size_t n); 43 | 44 | /* Returns 0 for successful compilation, 1 otherwise */ 45 | int 46 | xregcomp (regex_t *preg, const char *regex, int cflags); 47 | 48 | int 49 | xregexec (const regex_t *preg, const char *string, 50 | size_t nmatch, regmatch_t pmatch[], int eflags); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /util/zlib-extra.h: -------------------------------------------------------------------------------- 1 | #ifndef _ZLIB_EXTRA_H 2 | #define _ZLIB_EXTRA_H 3 | 4 | #include "util.h" 5 | #include 6 | 7 | /* Like getline, but read from a gzFile. Allocation is with talloc. 8 | * Returns: 9 | * 10 | * UTIL_SUCCESS, UTIL_OUT_OF_MEMORY, UTIL_ERRNO, UTIL_GZERROR 11 | * Consult util.h for description 12 | * 13 | * UTIL_EOF End of file encountered before 14 | * any characters read 15 | */ 16 | util_status_t 17 | gz_getline (void *ctx, char **lineptr, ssize_t *bytes_read, gzFile stream); 18 | 19 | /* return a suitable error string based on the return status 20 | * from gz_readline 21 | */ 22 | 23 | const char * 24 | gz_error_string (util_status_t status, gzFile stream); 25 | #endif 26 | -------------------------------------------------------------------------------- /version: -------------------------------------------------------------------------------- 1 | 0.18.1 2 | -------------------------------------------------------------------------------- /vim/Makefile: -------------------------------------------------------------------------------- 1 | prefix = $(HOME)/.vim 2 | 3 | INSTALL = install -v -D -m644 4 | D = $(DESTDIR) 5 | 6 | all: 7 | @echo "Nothing to build" 8 | 9 | install: 10 | $(INSTALL) $(CURDIR)/notmuch.vim $(D)$(prefix)/plugin/notmuch.vim 11 | $(INSTALL) $(CURDIR)/notmuch.txt $(D)$(prefix)/doc/notmuch.txt 12 | @$(foreach file,$(wildcard syntax/*), \ 13 | $(INSTALL) $(CURDIR)/$(file) $(D)$(prefix)/$(file);) 14 | 15 | .PHONY: all install 16 | -------------------------------------------------------------------------------- /vim/README: -------------------------------------------------------------------------------- 1 | == notmuch vim ruby == 2 | 3 | This is a vim plug-in that provides a fully usable mail client interface, 4 | utilizing the notmuch framework, through it's ruby bindings. 5 | 6 | == install == 7 | 8 | Simply run 'make install'. However, check that you have the depencies below. 9 | 10 | === vim +ruby === 11 | 12 | Make sure your vim version has ruby support: check for +ruby in 'vim --version' 13 | features. 14 | 15 | === ruby bindings === 16 | 17 | Check if you are able to run the following command cleanly: 18 | 19 | % ruby -e "require 'notmuch'" 20 | 21 | If you don't see any errors, it means it's working and you can go to the next 22 | section. 23 | 24 | If it's not, you would need to compile them. Go to the 'bindings/ruby' 25 | directory in the notmuch source tree. 26 | 27 | === mail gem === 28 | 29 | Since libnotmuch library concentrates on things other than handling mail, we 30 | need a library to do that, and for Ruby the best library for that is called 31 | 'mail'. The easiest way to install it is with ruby's gem. In most distro's the 32 | package is called 'rubygems'. 33 | 34 | Once you have gem, run: 35 | 36 | % gem install mail 37 | 38 | In some systems gems are installed on a per-user basis by default, so make sure 39 | you are running as the same user as the one that installed them. 40 | 41 | This gem is not mandatory, but it's extremely recommended. 42 | 43 | == Running == 44 | 45 | Simple: 46 | 47 | % gvim -c ':NotMuch' 48 | 49 | Enjoy ;) 50 | 51 | == More stuff == 52 | 53 | As an example to configure a key mapping to add the tag 'to-do' and archive, 54 | this is what I use: 55 | 56 | let g:notmuch_rb_custom_search_maps = { 57 | \ 't': 'search_tag("+to-do -inbox")', 58 | \ } 59 | 60 | let g:notmuch_rb_custom_show_maps = { 61 | \ 't': 'show_tag("+to-do -inbox")', 62 | \ } 63 | -------------------------------------------------------------------------------- /vim/notmuch.yaml: -------------------------------------------------------------------------------- 1 | addon: notmuch 2 | description: "notmuch mail user interface" 3 | files: 4 | - plugin/notmuch.vim 5 | - doc/notmuch.txt 6 | - syntax/notmuch-compose.vim 7 | - syntax/notmuch-folders.vim 8 | - syntax/notmuch-git-diff.vim 9 | - syntax/notmuch-search.vim 10 | - syntax/notmuch-show.vim 11 | -------------------------------------------------------------------------------- /vim/syntax/notmuch-compose.vim: -------------------------------------------------------------------------------- 1 | runtime! syntax/mail.vim 2 | 3 | syntax region nmComposeHelp contains=nmComposeHelpLine start='^Notmuch-Help:\%1l' end='^\(Notmuch-Help:\)\@!' 4 | syntax match nmComposeHelpLine /Notmuch-Help:/ contained 5 | 6 | highlight link nmComposeHelp Include 7 | highlight link nmComposeHelpLine Error 8 | -------------------------------------------------------------------------------- /vim/syntax/notmuch-folders.vim: -------------------------------------------------------------------------------- 1 | " notmuch folders mode syntax file 2 | 3 | syntax region nmFoldersCount start='^' end='\%10v' 4 | syntax region nmFoldersName start='\%11v' end='\%31v' 5 | syntax match nmFoldersSearch /([^()]\+)$/ 6 | 7 | highlight link nmFoldersCount Statement 8 | highlight link nmFoldersName Type 9 | highlight link nmFoldersSearch String 10 | 11 | highlight CursorLine term=reverse cterm=reverse gui=reverse 12 | 13 | -------------------------------------------------------------------------------- /vim/syntax/notmuch-git-diff.vim: -------------------------------------------------------------------------------- 1 | syn match diffRemoved "^-.*" 2 | syn match diffAdded "^+.*" 3 | 4 | syn match diffSeparator "^---$" 5 | syn match diffSubname " @@..*"ms=s+3 contained 6 | syn match diffLine "^@.*" contains=diffSubname 7 | 8 | syn match diffFile "^diff .*" 9 | syn match diffNewFile "^+++ .*" 10 | syn match diffOldFile "^--- .*" 11 | 12 | hi def link diffOldFile diffFile 13 | hi def link diffNewFile diffFile 14 | 15 | hi def link diffFile Type 16 | hi def link diffRemoved Special 17 | hi def link diffAdded Identifier 18 | hi def link diffLine Statement 19 | hi def link diffSubname PreProc 20 | 21 | syntax match gitDiffStatLine /^ .\{-}\zs[+-]\+$/ contains=gitDiffStatAdd,gitDiffStatDelete 22 | syntax match gitDiffStatAdd /+/ contained 23 | syntax match gitDiffStatDelete /-/ contained 24 | 25 | hi def link gitDiffStatAdd diffAdded 26 | hi def link gitDiffStatDelete diffRemoved 27 | -------------------------------------------------------------------------------- /vim/syntax/notmuch-search.vim: -------------------------------------------------------------------------------- 1 | syntax region nmSearch start=/^/ end=/$/ oneline contains=nmSearchDate 2 | syntax match nmSearchDate /^.\{-13}/ contained nextgroup=nmSearchNum 3 | syntax match nmSearchNum /.\{-4}/ contained nextgroup=nmSearchFrom 4 | syntax match nmSearchFrom /.\{-21}/ contained nextgroup=nmSearchSubject 5 | syntax match nmSearchSubject /.\{0,}\(([^()]\+)$\)\@=/ contained nextgroup=nmSearchTags 6 | syntax match nmSearchTags /.\+$/ contained 7 | 8 | highlight link nmSearchDate Statement 9 | highlight link nmSearchNum Type 10 | highlight link nmSearchFrom Include 11 | highlight link nmSearchSubject Normal 12 | highlight link nmSearchTags String 13 | -------------------------------------------------------------------------------- /vim/syntax/notmuch-show.vim: -------------------------------------------------------------------------------- 1 | " notmuch show mode syntax file 2 | 3 | syntax cluster nmShowMsgDesc contains=nmShowMsgDescWho,nmShowMsgDescDate,nmShowMsgDescTags 4 | syntax match nmShowMsgDescWho /[^)]\+)/ contained 5 | syntax match nmShowMsgDescDate / ([^)]\+[0-9]) / contained 6 | syntax match nmShowMsgDescTags /([^)]\+)$/ contained 7 | 8 | syntax cluster nmShowMsgHead contains=nmShowMsgHeadKey,nmShowMsgHeadVal 9 | syntax match nmShowMsgHeadKey /^[^:]\+: / contained 10 | syntax match nmShowMsgHeadVal /^\([^:]\+: \)\@<=.*/ contained 11 | 12 | syntax cluster nmShowMsgBody contains=@nmShowMsgBodyMail,@nmShowMsgBodyGit 13 | syntax include @nmShowMsgBodyMail syntax/mail.vim 14 | 15 | silent! syntax include @nmShowMsgBodyGit syntax/notmuch-git-diff.vim 16 | 17 | highlight nmShowMsgDescWho term=reverse cterm=reverse gui=reverse 18 | highlight link nmShowMsgDescDate Type 19 | highlight link nmShowMsgDescTags String 20 | 21 | highlight link nmShowMsgHeadKey Macro 22 | "highlight link nmShowMsgHeadVal NONE 23 | 24 | highlight Folded term=reverse ctermfg=LightGrey ctermbg=Black guifg=LightGray guibg=Black 25 | --------------------------------------------------------------------------------