Commit graph

535 commits

Author SHA1 Message Date
Chris Wilson
986f6c9824 notmuch-new: Only install SIGALRM if not running under gdb
I felt sorry for Carl trying to step through an exception from xapian
and suffering from the SIGALARMs..

We can detect if the user launched notmuch under a debugger by either
checking our cmdline for the presence of the gdb string or querying if
valgrind is controlling our process. For the latter we need to add a
compile time check for the valgrind development library, and so add the
initial support to build Makefile.config from configure.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Carl Worth <cworth@cworth.org>
[ickle: And do not install the timer when under the debugger]
2009-11-22 05:36:36 +01:00
Chris Wilson
3e4ab913db lib/database.cc: coding style
Carl claims he must have been distracted when he wrote this...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-11-22 05:26:59 +01:00
Carl Worth
1266d8511e Makefile: Fix to work even with GZIP environment variable set.
The rule here was written to assume that if the GZIP environment
variable was set that it would be the gzip binary to execute,
(similar to the CC and CXX variables). But GZIP is actually used
to pass arguments to gzip, so we have to use a different name.
2009-11-22 04:45:16 +01:00
Chris Wilson
530df68258 Makefile: Magic silent rules.
Use the facilities of GNU make to create a magic function that will
on the first invocation print a description of how to enable verbose
compile lines and then print the quiet rule.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Carl Worth <cworth@cworth.org>
Cc: Mikhail Gusarov <dottedmag@dottedmag.net>

[ickle: Rebased, and duplicate command string eliminated.]
[ickle: Fixed verbose bug pointed out by Mikhail]
2009-11-22 04:29:29 +01:00
Carl Worth
5d56e931b9 add_message: Use sha-1 in place of overly long message ID.
Since Xapian has a limit on the maximum length of a term, we have
to check for that before trying to add the message ID as a term.

This fixes the bug reported by Mike Hommey here:

	<20091120132625.GA19246@glandium.org>

I've also constructed 20 files with a range of message ID lengths
centered around the Xapian term-length limit which I'll use to seed a
new test suite soon.
2009-11-22 04:03:49 +01:00
Carl Worth
f336ee034b get_timestamp: Ensure that return value is 0 in case of exception.
Just to be on the safe side of things.
2009-11-22 03:55:39 +01:00
Carl Worth
e2341cbc09 Catch and optionally print about exception at database->flush.
If an earlier exception occurred, then it's not unexpected for the
flush to fail as well. So in that case, we'll silently catch the
exception. Otherwise, make some noise about things going wrong at the
time of flush.
2009-11-22 03:54:20 +01:00
Carl Worth
717279fbcf Add a missing print after catching an exception.
Without this, trying to debug this exception was *really* confusing.
2009-11-22 03:52:55 +01:00
Carl Worth
591f901241 Print information about where Xapian exception occurred.
Previously, our Xapian exception reports where identical so they
were hard to track down.
2009-11-22 03:51:35 +01:00
Holger Freyther
6c7ec294bb notmuch-config: Fix memleaks.
While talloc is great we need to free the g_error by hand.

Tested-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Holger Freyther <zecke@selfish.org>
2009-11-22 00:14:48 +01:00
Chris Wilson
b5d7632000 notmuch new: Fix to actually open the database READ_WRITE.
Chris claims he must have been distracted when he wrote this.
2009-11-22 00:13:24 +01:00
Carl Worth
b725481cb3 Fix freak case problem that broke the compile.
I think I must have bumped some emacs keybinding that changed the case
of a word here.
2009-11-21 22:29:31 +01:00
Carl Worth
637f99d8f3 Rename NOTMUCH_DATABASE_MODE_WRITABLE to NOTMUCH_DATABASE_MODE_READ_WRITE
And correspondingly, READONLY to READ_ONLY.
2009-11-21 22:10:18 +01:00
Chris Wilson
f379aa5284 Permit opening the notmuch database in read-only mode.
We only rarely need to actually open the database for writing, but we
always create a Xapian::WritableDatabase. This has the effect of
preventing searches and like whilst updating the index.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Carl Worth <cworth@cworth.org>
2009-11-21 22:04:49 +01:00
Carl Worth
aac1d60352 INSTALL/notmuch.el: More details on how to install/run notmuch.el
Hopefully this will save some people some head-scratching trying
to figure out how to use it.
2009-11-21 21:40:57 +01:00
Stefan Schmidt
0414c774d2 INSTALL: emacs install dokumentation.
Write down the steps needed to install and actuall use notmuch in emacs. Should
help emacs newbies.

Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
2009-11-21 21:34:25 +01:00
Carl Worth
5939490f64 Revert "notmuch: Add Maildir directory name as tag name for messages"
This reverts commit 9794f19017.

The feature makes a lot of sense for the initial import, but it's not
as clear whether it makes sense for ongoing "notmuch new" runs. We
might need to make this opt-in by configuration.
2009-11-21 21:21:58 +01:00
Carl Worth
b088370920 TODO: Add notes on portability, and remove completed tasks.
It's better to have things in TODO rather than mails with a todo
tag in my notmuch database.
2009-11-21 19:54:24 +01:00
Carl Worth
d746688beb TODO: Several updates. 2009-11-21 19:52:43 +01:00
Carl Worth
6732aa1b14 INSTALL: Mention that xapian-config might be named xapian-config-1.1
As reported on the mailing list.
2009-11-21 19:52:06 +01:00
Aneesh Kumar K.V
9794f19017 notmuch: Add Maildir directory name as tag name for messages
This patch adds maildir directory name as the tag name for
messages. This helps in adding tags using filtering already
provided by procmail.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2009-11-21 13:28:24 +01:00
Carl Worth
21f3252436 Makefile: Fix the fallback emacs install path.
When pkg-config can't be used to find out where to install emacs
files, we fallback to a hard-coded directory. Only, we were falling
back to the wrong thing, (one that emacs doesn't look into by
default).
2009-11-21 11:40:37 +01:00
Jed Brown
49132ebc76 Drop redundant CFLAGS, was already included in CXXFLAGS 2009-11-21 01:17:31 +01:00
Carl Worth
e94bd8506b notmuch reply: Include text parts in reply, even with disposition attachment.
If it's text, (such as a patch), then I want it quoted in my reply,
(so that I can comment on it).
2009-11-21 01:14:01 +01:00
Carl Worth
268da2cf19 notmuch show: Don't hide text parts, even with disposition attachment.
If it's text, (such as a patch), then I want to see it.
2009-11-21 01:10:25 +01:00
Carl Worth
67bad3483f notmuch show: Don't hide a digital signature.
This was a bug that was introduced in copying the indexing code over
into notmuch-show.c. When indexing, we want to ignore the signature,
(it has no interesting terms). But when presenting the message, it's
important to present the signature to the user.

(And would be even better if we presented whether or not the signature
is good.)
2009-11-21 01:00:41 +01:00
Carl Worth
882a58de5f notmuch.el: Don't use end-of-buffer which is inappropriate from programs
The documentation is quite clear about this case.

With this, we can now byte compile without warnings.
2009-11-21 00:58:16 +01:00
Carl Worth
aa46a34408 notmuch.el: Fix stale reference to non-existing variable.
We changed from "query" to "thread-id" a while ago, and broke this
error message at the time. Fix it now.
2009-11-21 00:53:27 +01:00
Carl Worth
d295f50ac7 notmuch.el: Add many missing defvar calls.
Without these, emacs was complaining about "assignment to free variable",
(though only when byte compiling, which is why we didn't notice earlier).
2009-11-21 00:52:23 +01:00
Eric Anholt
59c241ebd0 When a search query triggers a Xapian exception, log what the query was.
In my script containing a series of queries to be run on new mail for
setting up tags, it's nice to see which query I typed wrong.

Signed-off-by: Eric Anholt <eric@anholt.net>
2009-11-21 00:18:15 +01:00
James Rowe
a8e0d4f25f Make bash completion directory configurable.
Some systems install completion scripts in /usr/share/bash-completion, make the
location configurable from Makefile.config.
2009-11-21 00:14:06 +01:00
Carl Worth
3ae12b1e28 add_message: Re-fix handling of non-mail files.
More fallout from _get_header now returning "" for missing headers.

The bug here is that we would no longer detect that a file is not an
email message and give up on it like we should.

And this time, I actually audited all callers to
notmuch_message_get_header, so hopefully we're done fixing this
bug over and over.
2009-11-20 21:46:37 +01:00
Carl Worth
656e4c413d notmuch_database_add_message: Add missing error-value propagation.
Thanks to Mike Hommey for doing the analysis that led to noticing that
this was missing.
2009-11-20 21:02:11 +01:00
Carl Worth
52292c5485 add_message: Properly handle missing Message-ID once again.
There's been a fair amount of fallout from when we changed
message_file_get_header from returning NULL to returning "" for
missing headers. This is yet more fallout from that, (where we were
accepting an empty message-ID rather than generating one like we want
to).
2009-11-20 19:36:01 +01:00
Alexander Botero-Lowry
5d0a01dceb Checkin some command-only tcsh completions
Modified-by Carl Worth <cworth@cworth.org>: Just moved the file down
into contrib where the other completion scripts are.
2009-11-20 18:15:19 +01:00
Ingmar Vanhassel
14807ed2de bash-completion: Move to contrib
Signed-off-by: Ingmar Vanhassel <ingmar@exherbo.org>
2009-11-20 18:05:51 +01:00
Ingmar Vanhassel
8923ea0755 zsh-completion: Initial zsh-completion for notmuch
Signed-off-by: Ingmar Vanhassel <ingmar@exherbo.org>
2009-11-20 18:05:48 +01:00
Mikhail Gusarov
4dec742eba Add notmuch.1.gz to files to be cleaned
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2009-11-20 17:06:58 +01:00
Carl Worth
1728fe2a0a TODO: Add a couple of notes about fixing the completion script.
I'm throwing away a half-finished fix of this now, and just want to
ensure I don't forget about it.
2009-11-20 17:04:29 +01:00
Jan Janak
5150b15b87 Makefile: Make object targets depend on Makefiles
All objects need to be recompiled when any of the Makefiles changes, so
we make them all depend on all the Makefiles.

Signed-off-by: Jan Janak <jan@ryngle.com>
2009-11-20 13:44:09 +01:00
Mikhail Gusarov
dbb29a77fa Allow to redefine notmuch binary name and path in elisp mode
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2009-11-20 13:37:54 +01:00
Carl Worth
2cc3165163 notmuch.el: Don't use literal control characters in strings.
Avoding these is nicer to users, text editors, and our poor little
notmuch.el code itself that would get confused when seeing a copy of
itself in email. (Of course, we should still fix that bug, but this
workaround is good nonetheless.)
2009-11-20 13:09:58 +01:00
Carl Worth
0a575c9580 Makefile: Hard-code emacs_lispdir if emacs pkg-config file not available
Using pkg-config to find this variable is nice if it works. Go back to
the previously used value if it doesn't.
2009-11-20 13:07:42 +01:00
Carl Worth
1ddba66a3f Makefile: Remove unused variable emacs_startdir
This was added in a prelimnary version of a previous commit that would
automatically load notmuch.el for anyone running emacs. It's not used
at all in the current Makefile.
2009-11-20 12:58:42 +01:00
Carl Worth
31b54bc787 Avoid access of a Xapian iterator's object when there's nothing there.
This eliminates a crash when a message (either corrupted or a non-mail
file that wasn't properly detected as not being mail) has no In-Reply-To
header, (and so few terms that trying to skip to the prefix of the
In-Reply-To terms actually brings us to the end of the termlist).
2009-11-20 12:06:11 +01:00
Carl Worth
f6ca697e27 Revert inadvertently committed code.
This was accidentally included with commit:

	ddac17343a

(It was a dirty chunk in my directory that I accidentally amended into
the submitted patch.)
2009-11-20 11:12:42 +01:00
Jeffrey C. Ollie
c05c3f1584 notmuch build: add a RPM spec file
Add a spec file for building RPM packages.

Signed-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>
2009-11-20 10:37:38 +01:00
Jeffrey C. Ollie
dad3dd64b7 Add a .desktop file entry.
This will add an entry in your window manager's menus that will create
up a new emacs process and start notmuch.

Signed-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>
2009-11-20 10:36:15 +01:00
Jeffrey C. Ollie
d98718d104 Improve installation of emacs mode.
1) Add a separate targets to build and install emacs mode.

2) Don't hardcode the installation directory, instead use emacs'
   pkg-config module.

3) Install a byte compiled version of the emacs mode.

4) Install the emacs mode in emacs' site-lisp directory.  Put
   "(require 'notmuch)" in your .emacs to load it automatically.

5) Ignore byte-compiled emacs files.

Signed-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>
Reviewed-by: Ingmar Vanhassel <ingmar@exherbo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
2009-11-20 10:34:29 +01:00
Rolland Santimano
19d951ee16 Have git ignore tags & cscope files 2009-11-20 10:30:05 +01:00