Commit graph

2701 commits

Author SHA1 Message Date
Jani Nikula
e7328d7b00 cli: drop unused code from notmuch count
Remove unused code within #if 0 blocks from notmuch count.

Signed-off-by: Jani Nikula <jani@nikula.org>
2011-11-15 19:19:28 -04:00
Jani Nikula
796b629c3b cli: add options --offset and --limit to notmuch search
Add options --offset=[-]N and --limit=M to notmuch search to determine the
first result and maximum number of results to display.

Option --limit=M limits the maximum number of results to display to M.

Option --offset=[-]N skips the first N results; with the leading '-' skip
until the Nth result from the end.

Note that --offset with a negative N for thread or summary output requires
counting the number of matching threads in advance.

Signed-off-by: Jani Nikula <jani@nikula.org>
2011-11-15 19:17:24 -04:00
Jani Nikula
00c60fbcb3 lib: add function to get the number of threads matching a search
Add function notmuch_query_count_threads() to get the number of threads
matching a search. This is done by performing a search and figuring out the
number of unique thread IDs in the matching messages, a significantly
heavier operation than notmuch_query_count_messages().

Signed-off-by: Jani Nikula <jani@nikula.org>
2011-11-15 19:12:32 -04:00
Austin Clements
ed20210b6d test: Add a test script for "notmuch tag" 2011-11-14 21:21:22 -04:00
Austin Clements
7a306e12c8 news: Store "from" and "subject" headers in the database. 2011-11-14 21:14:41 -04:00
Austin Clements
567bcbc294 Store "from" and "subject" headers in the database.
This is a rebase and cleanup of Istvan Marko's patch from
id:m3pqnj2j7a.fsf@zsu.kismala.com

Search retrieves these headers for every message in the search
results.  Previously, this required opening and parsing every message
file.  Storing them directly in the database significantly reduces IO
and computation, speeding up search by between 50% and 10X.

Taking full advantage of this requires a database rebuild, but it will
fall back to the old behavior for messages that do not have headers
stored in the database.
2011-11-14 17:10:58 -04:00
Tomi Ollila
9cda22c39b test/atomicity: change shebang to '#!/usr/bin/env bash' 2011-11-14 17:08:53 -04:00
Jameson Graef Rollins
edd2f3f0a8 emacs: add notmuch-show-worker function for specifying crypto processing directly
The main reason to introduce this new unexposed function is to allow
the buffer redisplay crypto switch to behaving in a more expected way.
The prefix to notmuch-show-redisplay buffer now switches the crypto
processing of the current show buffer, as opposed to switching the
logic of the notmuch-crypto-process-mime customization variable.  This
behavior is more intuitive.
2011-11-13 15:22:16 -04:00
Jameson Graef Rollins
b00e27bd99 emacs: add documentation for notmuch-show crypto-switch option 2011-11-13 15:21:58 -04:00
Tom Prince
74f16571e8 Link libutil using filenmae, rather than using -l.
glibc includes a libutil, so if the wrong -L options get passed, we
will pick up glibc's version, rather than our own.
2011-11-13 14:58:21 -04:00
Thomas Jost
cb7270b27a test: make smtp-dummy work with Emacs 24
In Emacs 24, a space is expected after a SMTP response code. If we don't respect
that, smtpmail-send-it will wait forever.
2011-11-13 13:48:02 -04:00
Dmitry Kurochkin
5964a760a5 test: do not hide test_emacs errors
Do not redirect test_emacs stderr to /dev/null.  Test_emacs uses
emacsclient(1) now and it does not print unwanted messages (like
those from `message') to stderr.  But it does print useful
errors, e.g. when emacs server connection fails, given expression
is not valid or undefined function is called.
2011-11-13 09:44:36 -04:00
Tomi Ollila
085d45e389 exec emacs at the end of run_emacs script
In the last line of run_emacs, exec the emacs process.
With one fork less the process list is (also) neater.
2011-11-12 23:21:44 -04:00
David Bremner
ebd1adc55b contrib/nmbug: new script for sharing tags with a given prefix.
The main idea is consider the notmuch database as analogous to the
work-tree. A bare git repo is maintained in the users home directory,
with a tree of the form tags/$message-id/$tag

Like notmuch and git, we have a set of subcommnds, mainly modelled on
git.

Implementation wise, the heavy lifting is in the following functions.

   commit	xapian -> git
   checkout	git -> xapian
   merge	fetched git + git -> xapian
   status	find differences between xapian, git, and remote git.

The central implementation trick, from an idea I think due to
tomprince on IRC is manipulate the git index directly from the xapian
tag information.  The merge routine is still done using a temporary
checkout as I wasn't able to get it working with the index only.

There are also some convenience wrappers around git commands, like "fetch"
that essential just set GIT_DIR in the environment.

In order to encode tags (viewed as octet sequences) into filenames,
we whitelist a smallish set of characters and %hex escape anything outside.

The prefix is omitted in git, which lets one save and restore to
different prefixes (although this is only lightly tested).

Thanks to Tomi Ollila for a huge amount of feedback and patches while
putting this together.
2011-11-12 21:24:25 -04:00
Jameson Graef Rollins
9207f90f52 emacs: update notmuch-crypto-process-mime config variable documentation.
This mentions the fact that prefix arguments are now used to enable to
crypto switch.
2011-11-12 20:50:22 -04:00
Jameson Graef Rollins
07022714eb emacs: Unbind M-RET as display of thread with crypto switch.
Use prefix argument instead to set switch.
2011-11-12 20:42:25 -04:00
Pieter Praet
64febdf71c test: stashing in notmuch-{show,search}
Should provide full test coverage of the stashing feature.

Signed-off-by: Pieter Praet <pieter@praet.org>
2011-11-12 20:32:47 -04:00
Pieter Praet
f9764bfacc emacs: add keybind and function to stash Message-ID without prefix
Add function `notmuch-show-stash-message-id-stripped'
which stashes a Message-ID after ripping off the prefix and quotes,
add bind it to "I" key in `notmuch-show-stash-map'.

Simplifying `notmuch-show-get-message-id' instead might seem better,
but that would require concat'ing in 9 places instead of 1.

Signed-off-by: Pieter Praet <pieter@praet.org>
2011-11-12 20:29:04 -04:00
David Bremner
fd700ec961 NEWS: mention dtach instead of screen in the description of testing changes
This brings NEWS back in line with the actual code.
2011-11-12 10:46:13 -05:00
Dmitry Kurochkin
e972d752c0 emacs: add invisible space after the search widget field in notmuch-hello
It is very convenient when C-e (bound to `widget-end-of-line') ignores
trailing spaces inside the search widget.  But it only does so if a
widget is not followed by a newline (that is why it works in the saved
search widgets).  The patch just adds an invisible space after the
search widget to get the desirable behavior of `widget-end-of-line'.
The extra space is also added to expected results of emacs tests.
2011-11-12 10:34:53 -05:00
Austin Clements
a2d78fba20 emacs: Use a single buffer invisibility spec to fix quadratic search cost.
Buffer redisplay requires traversing the buffer's invisibility spec
for every part of the display that has an 'invisible text or overlay
property.  Previously, the search buffer's invisibility spec list
contained roughly one entry for each search result.  As a result,
redisplay took O(NM) time where N is the number of visible lines and M
is the total number of results.  On a slow computer, this is enough to
make even buffer motion noticeably slow.  Worse, during a search
operation, redisplay is triggered for each search result (even if
there are no visible buffer changes), so search was quadratic
(O(NM^2)) in the number of search results.

This change switches to using a single element buffer invisibility
spec.  To un-hide authors, instead of removing an entry from the
invisibility spec, it simply removes the invisibility overlay from
those authors.

I tested using a query with 6633 results on a 9 year old machine.
Before this patch, Emacs took 70 seconds to fill the search buffer;
toward the end of the search, Emacs consumed 10-20x as much CPU as
notmuch; and moving point in the buffer took about a second.  With
this patch, the same query takes 40 seconds, Emacs consumes ~3x the
CPU of notmuch by the end, and there's no noticeable lag to moving
point.  (There's still some source of non-linearity, because Emacs and
notmuch consume roughly the same amount of CPU early in the search.)
2011-11-12 09:21:03 -05:00
Tomi Ollila
ac46c6fdc2 smtp-dummy: clear sockaddr_in structure before use in bind()
Any junk bytes in sockaddr_in structure before passing that
to bind() system call may cause problems.
2011-11-12 07:48:00 -05:00
Jameson Graef Rollins
1351fc7384 debian: update build dependency on dtach instead of screen
This reflects a modification to the test suite to use dtach instead of
screen.
2011-11-11 18:31:44 -05:00
Jameson Graef Rollins
5dda92f778 debian: clean up Uploaders and Build-Depends fields in debian/control
No functional change, but this will make for cleaner diffs down the
line.
2011-11-11 18:30:32 -05:00
Tomi Ollila
2f2ea8a49a test: use dtach(1) instead of screen(1) in emacs tests
dtach is simpler than screen and is not setuid/setgid program so
TMPDIR does not get cleared by dynamic loader when executed
2011-11-11 18:24:53 -05:00
Michal Sojka
0234a16b56 Do not query on notmuch-search exit
Emacs 23.2 queries by default about killing existing processes. This
is annoying when one wants to interrupt long search with 'q' key.
Disable this behavior for notmuch.
2011-11-08 14:25:07 -04:00
Dmitry Kurochkin
34aa8e8a9c emacs: remove unused `point-invisible-p' function
`point-invisible-p' does not work correctly when `invisible'
property is a list.  There are standard `invisible-p' and related
functions that should be used instead.
2011-11-07 20:38:37 -04:00
Dmitry Kurochkin
8809e09dcc emacs: remove no longer used functions from notmuch-show.el
Remove `notmuch-show-move-past-invisible-backward' and
`notmuch-show-move-past-invisible-forward' functions which are
unused.
2011-11-07 20:38:37 -04:00
Dmitry Kurochkin
6e6cb68b80 emacs: improve hidden signatures handling in notmuch-show-advance-and-archive
Use `previous-single-char-property-change' instead of going
through each character by hand and testing it's visibility.  This
fixes `notmuch-show-advance-and-archive' to work for the last
message in thread with hidden signature.
2011-11-07 20:38:37 -04:00
Dmitry Kurochkin
9689656351 test: `notmuch-show-advance-and-archive' with invisible signature
Add Emacs test to check that `notmuch-show-advance-and-archive'
works for the last message in thread with invisible signature.
2011-11-07 20:38:37 -04:00
David Bremner
760b311bb5 NEWS: tentative news item about requiring screen to run the test suite.
Hopefully this will be fixed before release, but for the moment,
explain to people why their test suite might not be working like it
used to.
2011-11-05 22:10:51 -03:00
David Bremner
a824fe1da6 debian: build-depend on screen.
This is needed for emacs tests, now that those are run in screen.
2011-11-05 22:08:00 -03:00
Dmitry Kurochkin
95cf33cc78 test: do not set frame width in emacs
No need for `set-frame-width' in emacs tests since it runs in
screen now.
2011-11-05 21:55:57 -03:00
Dmitry Kurochkin
746a13e6f4 test: avoid using screen(1) configuration files
Set SCREENRC and SYSSCREENRC environment variables to "/dev/null"
as suggested by Jim Paris to avoid potential problems with
screen(1) configuration files.
2011-11-05 21:54:40 -03:00
Dmitry Kurochkin
a1ea4e914f test: run emacs inside screen
Before the change, emacs run in daemon mode without any visible
buffers.  Turns out that this affects emacs behavior in some
cases.  In particular, `window-end' function returns `point-max'
instead of the last visible position.  That makes it hard or
impossible to implement some tests.  The patch runs emacs in a
detached screen(1) session.  So that it works exactly as if it
has a visible window.

Note: screen terminates when emacs exits.  So the patch does not
introduce new "running processes left behind" issues.
2011-11-05 20:49:27 -03:00
Dmitry Kurochkin
749abb74f2 test: json show format of message with inline attachment with filename
The patch adds a test to check that json show format includes
filenames for attachments with inline disposition.
2011-11-05 20:15:00 -03:00
Ali Polatel
5a446f4765 notmuch-deliver: update gitignore 2011-11-05 01:12:35 +02:00
Thomas Schwinge
c39fd2a479 notmuch-deliver: Don't read errno inappropriately.
Signed-off-by: Thomas Schwinge <thomas@schwinge.name>
2011-11-05 01:12:35 +02:00
Thomas Schwinge
8935c83c56 notmuch-deliver: Won't deliver to more than one folder.
Signed-off-by: Thomas Schwinge <thomas@schwinge.name>
2011-11-05 01:12:35 +02:00
Thomas Schwinge
47ddec5034 notmuch-deliver: Advance imported files to maildrop-2.5.2 release. 2011-11-05 01:12:35 +02:00
Thomas Schwinge
f0c3f7a995 notmuch-deliver: Import said files from maildrop-2.2.0 release.
We won't use all of the included build infrastructure files, but adding them
nevertheless helps to track changes that are applied to them upstream.

Signed-off-by: Thomas Schwinge <thomas@schwinge.name>
2011-11-05 01:12:35 +02:00
Thomas Schwinge
38b245b46a Move files copied from maildrop to a separate hierarchy.
Signed-off-by: Thomas Schwinge <thomas@schwinge.name>
2011-11-05 01:12:35 +02:00
Thomas Schwinge
5f53ce3e2b Make it build in a separate build directory.
Signed-off-by: Thomas Schwinge <thomas@schwinge.name>
2011-11-05 01:12:35 +02:00
Ali Polatel
01478051aa notmuch-deliver: Add mailmap 2011-11-05 01:12:35 +02:00
alip
5a74347025 notmuch-deliver: Fix utter failure 2011-11-05 01:12:35 +02:00
Ali Polatel
73258fec79 notmuch-deliver: Use splice() if it's available
NOTMUCH_DELIVER_NO_SPLICE environment variable may be set to fallback to
the read/write method.
2011-11-05 01:12:35 +02:00
Ali Polatel
c145323120 notmuch-deliver: Add --enable-{gprof,gcov} options to configure 2011-11-05 01:12:35 +02:00
Ali Polatel
649db5eab6 More debug messages 2011-11-05 01:12:35 +02:00
Ali Polatel
d478384dfb notmuch-deliver: Fix typos in option context description 2011-11-05 01:12:35 +02:00
Ali Polatel
50d5caacc9 notmuch-deliver: Fix copy/paste fail 2011-11-05 01:12:34 +02:00