notmuch
11 years agonotmuch new: Detect deleted (renamed) files and directories.
Carl Worth [Wed, 6 Jan 2010 01:43:03 +0000 (17:43 -0800)]
notmuch new: Detect deleted (renamed) files and directories.

This takes advantage of the notmuch_directory_t interfaces added
recently (with cooresponding storage of directory documents in the
database) to detect when files or entire directories are deleted or
renamed within the mail store.

This also fixes the recent regression where *all* files would be
processed by every run of "notmuch new", (now only new files are
processed once again).

The deleted files and directories are only detected so far. They
aren't properly removed from the database.

11 years agoadd_files_recursive: Make the maildir detection more efficient.
Carl Worth [Wed, 6 Jan 2010 00:42:14 +0000 (16:42 -0800)]
add_files_recursive: Make the maildir detection more efficient.

Previously, we were re-scanning the entire list of entries for every
directory entry. Instead, we can simply check if the entries look like
a maildir once, up-front.

11 years agoadd_files_recursive: Separate scanning for directories and files for legibility.
Carl Worth [Wed, 6 Jan 2010 00:35:02 +0000 (16:35 -0800)]
add_files_recursive: Separate scanning for directories and files for legibility.

We now do two scans over the entries returned from scandir. The first
scan is looking for directories (and making the recursive call). The
second scan is looking for new files to add to the database.

This is easier to read than the previous code which had a single loop
and some if statements with ridiculously long bodies. It also has the
advantage that once the directory scan is complete we can do a single
comparison of the filesystem and database mtimes and entirely skip the
second scan if it's not needed.

11 years agoadd_files_recursive: Use consistent naming for array and count variables.
Carl Worth [Wed, 6 Jan 2010 00:15:43 +0000 (16:15 -0800)]
add_files_recursive: Use consistent naming for array and count variables.

Previously we had an array named "namelist" and its count named
"num_entries". We now use an array name of "fs_entries" and a count
named "num_fs_entries" to try to preserve sanity.

11 years agonotmuch new: Remove an unnecessary stat of every regular file in the mail store.
Carl Worth [Wed, 6 Jan 2010 00:06:46 +0000 (16:06 -0800)]
notmuch new: Remove an unnecessary stat of every regular file in the mail store.

We were previousl using the stat for two reasons. One was to obtain
the mtime of the file. This usage was removed in the previous commit,
(since the mtime is unreliable in the case of a file being moved into
the mail store).

The second reason was to identify regular and directory file
types. But this information is already available in the result we get
from scandir.

What's left is simply a stat for each directory in the mailstore,
(which we are still using to compare filesystem mtime with the mtime
stored in the database).

11 years agonotmuch new: Eliminate the check on the mtime of regular files before adding.
Carl Worth [Tue, 5 Jan 2010 23:59:11 +0000 (15:59 -0800)]
notmuch new: Eliminate the check on the mtime of regular files before adding.

This check was buggy in that moving a pre-existing file into the mail
store, (where the file existed before the last run of "notmuch new"),
does not update the mtime of the file. So the message would never be
added to the database.

The fix here is not practical in the long run, (since it causes *all*
files in the mail store to be processed in every run of "notmuch new"
(!)). But this change will let us drop a stat() call that we don't
otherwise need and will help move us toward proper database-backed
detection of new files, (which will fix the bug without the
performance impact of the current fix).

11 years agonotmuch new: Fix internal documentation of add_files_recursive.
Carl Worth [Tue, 5 Jan 2010 23:52:59 +0000 (15:52 -0800)]
notmuch new: Fix internal documentation of add_files_recursive.

To make it more clear that the mtime of a directory does not affect
whether further sub-directories are examined, (they are examined
unconditionally).

11 years agonotmuch new: Rename the various timestamp variables to be more clear.
Carl Worth [Tue, 5 Jan 2010 23:31:56 +0000 (15:31 -0800)]
notmuch new: Rename the various timestamp variables to be more clear.

The previous name of "path_mtime" was very ambiguous. The new names
are much more obvious (fs_mtime is the mtime from the filesystem and
db_mtime is the mtime from the database).

11 years agonotmuch new: Avoid updating directory timestamp if interrupted.
Carl Worth [Tue, 5 Jan 2010 23:23:52 +0000 (15:23 -0800)]
notmuch new: Avoid updating directory timestamp if interrupted.

This was a very dangerous bug. An interrupted "notmuch new" session
would still update the timestamp for the directory in the
database. This would result in mail files that were not processed due
to the original interruption *never* being picked up by future runs of
"notmuch new". Yikes!

11 years agonotmuch-new: Remove dead add_files_callback code.
Carl Worth [Tue, 5 Jan 2010 23:13:16 +0000 (15:13 -0800)]
notmuch-new: Remove dead add_files_callback code.

Always satisfying to delete code (even if tiny).

11 years agoMake the add_files function static within notmuch-new.c.
Carl Worth [Tue, 5 Jan 2010 23:11:21 +0000 (15:11 -0800)]
Make the add_files function static within notmuch-new.c.

No other files need this function so we don't need it exported in
notmuch-client.h.

11 years agoMakefiles: Use .DEFAULT to support arbitrary targets from sub directories.
Carl Worth [Tue, 5 Jan 2010 23:05:57 +0000 (15:05 -0800)]
Makefiles: Use .DEFAULT to support arbitrary targets from sub directories.

Taking advantage of the .DEFAULT construct means that we won't need to
explicitly list targets such as "clean", etc. in each sub-Makefile.

11 years agoAdd missing comment for NOTMUCH_STATUS_READONLY_DATABASE.
Carl Worth [Tue, 5 Jan 2010 23:01:58 +0000 (15:01 -0800)]
Add missing comment for NOTMUCH_STATUS_READONLY_DATABASE.

And adjust the string representation of the same to match.

11 years agolib: Implement new notmuch_directory_t API.
Carl Worth [Tue, 5 Jan 2010 21:29:23 +0000 (13:29 -0800)]
lib: Implement new notmuch_directory_t API.

This new directory ojbect provides all the infrastructure needed to
detect when files or directories are deleted or renamed. There's still
code needed on top of this (within "notmuch new") to actually do that
detection.

11 years agoRevamp the proposed directory-tracking API slightly.
Carl Worth [Tue, 5 Jan 2010 21:06:24 +0000 (13:06 -0800)]
Revamp the proposed directory-tracking API slightly.

This commit contains my changes to the API proposed by Keith. Nothing
is dramatically different. There are minor things like changing
notmuch_files_t to notmuch_filenames_t and then various things needed
for completeness as noticed while implementing this, (such as
notmuch_directory_destroy and notmuch_directory_set_mtime).

11 years agoPrototypes for directory tracking
Keith Packard [Wed, 9 Dec 2009 08:51:52 +0000 (00:51 -0800)]
Prototypes for directory tracking

There's no functionality here yet---just a sketch of what the
interface could look like.

11 years agodatabase: Add new, public notmuch_database_remove_message
Carl Worth [Mon, 21 Dec 2009 23:14:32 +0000 (15:14 -0800)]
database: Add new, public notmuch_database_remove_message

This will allow applications to support the removal of messages, (such
as when a file is deleted from the mail store). No removal support is
provided yet in commands such as "notmuch new".

11 years agodatabase: Add new find_doc_ids_for_term interface.
Carl Worth [Mon, 21 Dec 2009 23:12:52 +0000 (15:12 -0800)]
database: Add new find_doc_ids_for_term interface.

The existing find_doc_ids function is convenient when the caller
doesn't want to be bothered constructing a term. But when the caller
*does* have the term already, that interface is just wasteful. So we
export a lower-level interface that maps a pre-constructed term to a
document-ID iterators.

11 years agodatabase: Make find_unique_doc_id enforce uniqueness (for a debug build)
Carl Worth [Mon, 21 Dec 2009 23:11:32 +0000 (15:11 -0800)]
database: Make find_unique_doc_id enforce uniqueness (for a debug build)

Catching any violation of this unique-ness constraint is very much in
line with similar, existing INTERNAL_ERROR cases.

11 years agodatabase: Abstract _filename_to_direntry from _add_message
Carl Worth [Mon, 21 Dec 2009 23:09:56 +0000 (15:09 -0800)]
database: Abstract _filename_to_direntry from _add_message

The code to map a filename to a direntry is something that we're going
to want in a future _remove_message function, so put it in a new
function _notmuch_database_filename_to_direntry .

11 years agodatabase: Allowing storing multiple filenames for a single message ID.
Carl Worth [Mon, 21 Dec 2009 20:08:46 +0000 (12:08 -0800)]
database: Allowing storing  multiple filenames for a single message ID.

The library interface is unchanged so far, (still just
notmuch_database_add_message), but internally, the old
_set_filename function is now _add_filename instead.

11 years agodatabase: Store mail filename as a new 'direntry' term, not as 'data'.
Carl Worth [Mon, 21 Dec 2009 16:23:26 +0000 (08:23 -0800)]
database: Store mail filename as a new 'direntry' term, not as 'data'.

Instead of storing the complete message filename in the data portion
of a mail document we now store a 'direntry' term that contains the
document ID of a directory document and also the basename of the
message filename within that directory. This will allow us to easily
store multple filenames for a single message, and will also allow us
to find mail documents for files that previously existed in a
directory but that have since been deleted.

11 years agodatabase: Split _find_parent_id into _split_path and _find_directory_id
Carl Worth [Mon, 21 Dec 2009 16:14:52 +0000 (08:14 -0800)]
database: Split _find_parent_id into _split_path and _find_directory_id

Some pending commits want the _split_path functionality separate from
mapping a directory to a document ID. The split_path function now
returns the basename as well as the directory name.

11 years agodatabase: Store directory path in 'data' of directory documents.
Carl Worth [Sun, 20 Dec 2009 23:46:41 +0000 (15:46 -0800)]
database: Store directory path in 'data' of directory documents.

We're planning to have mail documents refer to directory documents for
the path of the containing directory. To support this, we need the
path in the data, (since the path in the 'directory' term can be
irretrievable as it will be the SHA1 sum of the path for a very long
path).

11 years agodatabase: Export _notmuch_database_find_parent_id for internal use.
Carl Worth [Sat, 19 Dec 2009 23:11:55 +0000 (15:11 -0800)]
database: Export _notmuch_database_find_parent_id for internal use.

We'll soon have mail documents referring to their parent directory's
directory documents, so we'll need access to _find_parent_id in files
such as message.cc.

11 years agodatabase: Store the parent ID for each directory document.
Carl Worth [Sat, 19 Dec 2009 21:20:26 +0000 (13:20 -0800)]
database: Store the parent ID for each directory document.

Storing the document ID of the parent of each directory document will
allow us to find all child-directory documents for a given directory
document. We will need this in order to detect directories that have
been removed from the mail store, (though we aren't yet doing this).

11 years agodatabase: Rename internal directory value from XTIMESTAMP to XDIRECTORY.
Carl Worth [Sat, 19 Dec 2009 21:18:18 +0000 (13:18 -0800)]
database: Rename internal directory value from XTIMESTAMP to XDIRECTORY.

The recent change from storing absolute paths to relative paths means
that new directory documents will already be created, (and the old
ones will just linger stale in the database). Given that, we might as
well put a clean name on the term in the new documents, (and no real
flag day is needed).

11 years agodatabase: Store directory paths as relative, not absolute.
Carl Worth [Sat, 19 Dec 2009 21:11:00 +0000 (13:11 -0800)]
database: Store directory paths as relative, not absolute.

We were already storing relative mail filenames, so this is consistent
with that. Additionally, it means that directory documents remain
valid even if the database is relocated within its containing
filesystem.

11 years agolib: Document that the filename is stored in the 'data' of a mail document
Carl Worth [Sat, 19 Dec 2009 21:05:06 +0000 (13:05 -0800)]
lib: Document that the filename is stored in the 'data' of a mail document

Our database schema documentation previously didn't give any
indication of where this most essential piece of information is
stored.

11 years agolib: Rename set/get_timestamp to set/get_directory_mtime.
Carl Worth [Thu, 17 Dec 2009 22:33:34 +0000 (14:33 -0800)]
lib: Rename set/get_timestamp to set/get_directory_mtime.

I've been suitably scolded by Keith for doing a premature
generalization that ended up just making the documentation more
convoluted. Fix that.

11 years agolib: Abstract the extraction of a relative path from set_filename
Carl Worth [Sat, 19 Dec 2009 20:32:11 +0000 (12:32 -0800)]
lib: Abstract the extraction of a relative path from set_filename

We'll soon be having multiple entry points that accept a filename
path, so we want common code for getting a relative path from a
potentially absolute path.

11 years agonotmuch new: Remove hack to ignore read-only directories in mail store.
Carl Worth [Mon, 14 Dec 2009 23:57:44 +0000 (15:57 -0800)]
notmuch new: Remove hack to ignore read-only directories in mail store.

This was really the last thing keeping the initial run of "notmuch
new" being different from all other runs. And I'm taking a fresh
look at the performance of "notmuch new" anyway, so I think we can
safely drop this optimization.

11 years agolib: Add missing value to notmuch_private_status_t enum.
Carl Worth [Sat, 19 Dec 2009 20:34:06 +0000 (12:34 -0800)]
lib: Add missing value to notmuch_private_status_t enum.

And fix the initialization such that the private enum will always have
distinct values from the public enum even if we similarly miss the
addition of a new public value in the future.

11 years agonotmuch new: Restrict the "not much" pun to the first run.
Carl Worth [Tue, 15 Dec 2009 00:06:37 +0000 (16:06 -0800)]
notmuch new: Restrict the "not much" pun to the first run.

Several people complained that the humor wore thin very quickly.  The
most significant case of "not much mail" is when counting the user's
initial mail collection. We've promised on the web page that no matter
how much mail the user has, notmuch will consider it to be "not much"
so let's say so. (This message was in place very early on, but was
inadvertently dropped at some point.)

11 years agoconfigure: Look for both Xapian 1.1 and 1.0 and allow user override.
Carl Worth [Sun, 13 Dec 2009 23:17:35 +0000 (15:17 -0800)]
configure: Look for both Xapian 1.1 and 1.0 and allow user override.

The in-development version of Xapian provides a config program named
xapian-config-1.1 while the released version provides a program named
xapian-config instead. By default, we now try each of these in turn,
and we also allow the user to set a XAPIAN_CONFIG environment variable
to explicitly specify a particular program.

11 years agoemacs: Add instructions to the hidden citations/signatures.
Carl Worth [Fri, 11 Dec 2009 23:52:40 +0000 (15:52 -0800)]
emacs: Add instructions to the hidden citations/signatures.

We've received a user report that the hidden citations were annoying
since the user couldn't tell what was being referred to by subsequent
text. Apparently it wasn't obvious enough that the hidden citation
could be revealed by clicking or by pressing Enter. So make the button
text say as much.

11 years agoemacs: Don't insert extra line after citations.
Carl Worth [Fri, 11 Dec 2009 23:36:41 +0000 (15:36 -0800)]
emacs: Don't insert extra line after citations.

This extra line had been annoying me for a while, so I'm glad to see
it go away.

11 years agoemacs: Don't regard a manually indented '>' as introducing a citation.
Carl Worth [Fri, 11 Dec 2009 23:31:10 +0000 (15:31 -0800)]
emacs: Don't regard a manually indented '>' as introducing a citation.

In the message mentioned in the previous commit, an ASCII diagram was
included in which '>' was used as the first non-whitespace character
in a line. Notmuch previously (and mistakenly) regarded this as a
citation.

We fix this by only regarding a '>' in the first column of an email as
introducing a citation.

11 years agoemacs: Avoid infinite loop when marking up citations.
Carl Worth [Fri, 11 Dec 2009 23:25:55 +0000 (15:25 -0800)]
emacs: Avoid infinite loop when marking up citations.

Thanks to Dirk Hohndel for reporting the bug. The infinite loop was first
noticed in the following message (available from the Linux kernel mailing list):

alpine.LFD.2.00.0912081304070.3560@localhost.localdomain

Note that the bug does not show up when viewing the message in
isolation---the bug was triggered only when viewing this file indented
to a depth of at least 13.

The fix is simply to use a marker rather than an integer position when
recording a point we plan to move back to later, (since inserting the
indented button causes the buffer position of the desired marker to
change).

11 years agoExpand scope of items considered when saving attachments
Keith Amidon [Sat, 5 Dec 2009 22:53:59 +0000 (14:53 -0800)]
Expand scope of items considered when saving attachments

Previously only mime parts that indicated specified a "disposition" of
"attachment" were saved.  However there are time when it is important
to be able to save inline content as well.  After this commit any mime
part that specifies a filename will be considered when saving
attachments.

11 years agoemacs: Fix '+' and '-' in case of thread no longer matching current search.
Carl Worth [Thu, 10 Dec 2009 18:35:18 +0000 (10:35 -0800)]
emacs: Fix '+' and '-' in case of thread no longer matching current search.

Similar to the way thread-viewing was broken after a thread was
archived, (and recently fixed), tag manipulation has also been broken
when the thread no longer matches the current search.

This also means that the behavior of '+' and '-' are now different
than that of '*'. The '+' and '-' bindings now return to the previous
behavior old affecting all messages in the thread, (and not simply
those matching the search).

I actually prefer this behavior, since otherwise a '-' operation on a
thread might not actually remove the tag from the thread, (since it
could operate on a subset of the thread and not hit all messages with
the given tag).

So I'd now like to fix '*' to be consistent with '+' and '-', for
which we add an item to TODO.

11 years agonotmuch.el: patch notmuch-show to call notmuch show without query-context (i.e. witho...
David Bremner [Thu, 10 Dec 2009 15:14:35 +0000 (11:14 -0400)]
notmuch.el: patch notmuch-show to call notmuch show without query-context (i.e. without tag:inbox) if the first query returns nothing.

This fixes the annoying bug of archiving a thread, and then going back
to open it and getting an error.  It needs the notmuch-show API
changing patch of 1259979997-31544-3-git-send-email-david@tethera.net.

11 years agonotmuch-show: add optional argument for query context instead of using global binding...
David Bremner [Sat, 5 Dec 2009 02:26:37 +0000 (22:26 -0400)]
notmuch-show: add optional argument for query context instead of using global binding notmuch-search-query-string

Also modify the one call to notmuch-show in notmuch.el.  This makes
the call (notmuch-show thread-id) will work when there is no binding
for notmuch-search-query-string; e.g. when called from user code
outside notmuch.

11 years agonotmuch-search-process-filter: add text properties for authors and subject to each...
David Bremner [Sat, 5 Dec 2009 02:26:36 +0000 (22:26 -0400)]
notmuch-search-process-filter: add text properties for authors and subject to each line

Add functions notmuch-search-find-authors and notmuch-find-subject to
match notmuch-find-thread-id.  These functions are just a wrapper
around get-text-property, but in principle that could change.

11 years agoTODO: Add idea for an --exclude-threads options to "notmuch search".
Carl Worth [Wed, 9 Dec 2009 22:03:03 +0000 (14:03 -0800)]
TODO: Add idea for an --exclude-threads options to "notmuch search".

This would provide support for "muted" threads, as well as allowing for negative
filtering based on messages not matched by the original search, (but present in
threads that do have at least one matched message).

11 years agoNuke the remainings of _notmuch_message_add_thread_id.
Fernando Carrijo [Wed, 9 Dec 2009 19:09:01 +0000 (17:09 -0200)]
Nuke the remainings of _notmuch_message_add_thread_id.

The function _notmuch_message_add_thread_id has been removed
from the private interface of notmuch. There's no reason for
one to keep a declaration of its prototype in the code base.
Also, lets update a commentary that referenced that function
and escaped from previous scrutiny.

Signed-off-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
11 years agoTODO: Note that we should report when two "copies" of a message differ.
Carl Worth [Wed, 9 Dec 2009 06:12:43 +0000 (22:12 -0800)]
TODO: Note that we should report when two "copies" of a message differ.

Marten Veldthuis pointed out on the mailing list that intentional
spoofing is something that the user should be told about.

11 years agoRevert "Add some very rudimentary support for handling html parts"
Carl Worth [Mon, 7 Dec 2009 17:34:06 +0000 (09:34 -0800)]
Revert "Add some very rudimentary support for handling html parts"

This reverts commit ed16edc94d6a50ca86ff1575d9ea6fb9168b2e81.

The performance hit is just far too severe, (threads with many HTML
messages make emacs stop and pause for seconds before displaying the
thread even if most of the HTML messages are entirely hidden).

11 years agofix Makefile.local to install bash completion definitions as not executable
Jameson Graef Rollins [Sat, 28 Nov 2009 23:57:37 +0000 (18:57 -0500)]
fix Makefile.local to install bash completion definitions as not executable

11 years agoMakefile: Mention "./configure --help" now that it exists.
Carl Worth [Sat, 5 Dec 2009 00:09:40 +0000 (16:09 -0800)]
Makefile: Mention "./configure --help" now that it exists.

Since we're directing the user to ./confgiure for more options,
actually tell the user how to discover what those options are.

11 years agoconfigure: Implement a --help option to document --prefix.
Carl Worth [Sat, 5 Dec 2009 00:05:12 +0000 (16:05 -0800)]
configure: Implement a --help option to document --prefix.

Also document that values for CC, CFLAGS, etc. can be specified
via environment variables.

11 years agoMakefile: Silence compiler errors during dependency generation.
Carl Worth [Fri, 4 Dec 2009 23:37:39 +0000 (15:37 -0800)]
Makefile: Silence compiler errors during dependency generation.

We have a bootstrapping issue with our dependency generation. When the
Makefile.config doesn't exist yet, the complete compilation flags are
not yet available for passing to the compiler to generate the
dependencies.

But we don't have explicit rules to create these dependency files,
(just the implicit rule that is created by the -include), so we can't
control when make will attempt to create them.

We do have a dependency of the dependency files on Makefile.config, so
make should eventually call the compiler with the correct flags and
everything should be good. So in the meantime, silence any complaints.

11 years agoMakefile: Inform user that they might want to call ./configure explicitly.
Carl Worth [Fri, 4 Dec 2009 23:32:05 +0000 (15:32 -0800)]
Makefile: Inform user that they might want to call ./configure explicitly.

If the Makefile does this for the user, then no arguments are passed. So
it's only polite to let the user know that it's possible to get pass those
arguments.

11 years agoconfigure: Support the capturing of CFLAGS and CXXFLAGS at configure time.
Carl Worth [Fri, 4 Dec 2009 23:20:12 +0000 (15:20 -0800)]
configure: Support the capturing of CFLAGS and CXXFLAGS at configure time.

These variables can now be set via configure time via environment
variables like so:

CFLAGS=-g ./configure

and subsequent builds will remember these values. The values can
still be overridden at compile time by passing make variables:

      make CFLAGS=-O2

The CXXFLAGS variable is optional. If unset at either configure
time or at compile time, it will inherit its value from the
CFLAGS variable. (Though if explicitly set at configure time
it must be explicitly overriden at compile time---just overriding
CFLAGS will not override CXXFLAGS as well.)

11 years agoFix quiet compilation to print the user's CFLAGS, CXXFLAGS, LDFLAGS.
Carl Worth [Fri, 4 Dec 2009 23:08:37 +0000 (15:08 -0800)]
Fix quiet compilation to print the user's CFLAGS, CXXFLAGS, LDFLAGS.

The only reason I ever call "make V=1" myself, (other than when
debugging the compiler command-line for some reason), is to ensure
whether my CFLAGS, (like "-g -O0" or "-O2"), are actually making it to
the command-line.

But these are hard to find in the V=1 output, and really, we should
just print these even in the quiet case. So do that.

11 years agoTODO: Note about adding "notmuch search --matching"
Carl Worth [Fri, 4 Dec 2009 22:52:32 +0000 (14:52 -0800)]
TODO: Note about adding "notmuch search --matching"

This bug was recently discussed on the mailing list:

id:878wdifu13.fsf@yoom.home.cworth.org

so note one idea for fixing it.

11 years agoFix option parsing for the case of a value with '='.
Carl Worth [Fri, 4 Dec 2009 22:50:49 +0000 (14:50 -0800)]
Fix option parsing for the case of a value with '='.

To support this we need to match the longest-possible suffix and then
strip the shortest-possible prefix.

11 years agoFix configure script to handle --prefix=
Jameson Graef Rollins [Sat, 28 Nov 2009 23:57:35 +0000 (18:57 -0500)]
Fix configure script to handle --prefix=

Reviewed-by: Carl Worth <cworth@cworth.org>:
This is really the fundamental thing that people expect a configure
script to do, so it's important to support it.

11 years ago* notmuch-config: fix small leak from 'g_key_file_to_data'
Dirk-Jan C. Binnema [Wed, 2 Dec 2009 07:11:24 +0000 (09:11 +0200)]
* notmuch-config: fix small leak from 'g_key_file_to_data'

Signed-off-by: Dirk-Jan C. Binnema <djcb.bulk@gmail.com>
11 years agoMake search filters handle disjunctive queries.
Jed Brown [Wed, 2 Dec 2009 11:00:35 +0000 (12:00 +0100)]
Make search filters handle disjunctive queries.

notmuch-search-filter now accepts an arbitrary query and will group if
necessary so that we get

  tag:inbox AND (gravy OR biscuits)

instead of the former

  tag:inbox AND gravy OR biscuits

Signed-off-by: Jed Brown <jed@59A2.org>
11 years agoRemove unused notmuch_parse_date function prototype.
Jeffrey C. Ollie [Sat, 28 Nov 2009 20:11:16 +0000 (14:11 -0600)]
Remove unused notmuch_parse_date function prototype.

notmuch_parse_date is not implemented, so remove the unused function
prototype.

Signed-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>
11 years agoconfigure: Tweak the working of the example commands slightly.
Carl Worth [Fri, 4 Dec 2009 00:52:18 +0000 (16:52 -0800)]
configure: Tweak the working of the example commands slightly.

Basically just getting better parallelism between the descriptions of
the Defora and Debian commands. (And fixing a nearby typo.)

11 years agoAdd some text to configure on how to install dependencies with yum.
Jeffrey C. Ollie [Sat, 28 Nov 2009 14:20:08 +0000 (08:20 -0600)]
Add some text to configure on how to install dependencies with yum.

Add some text on how to install dependencies with yum for Fedora or
other systems that use yum for package management.  Since the named of
the required packages on Fedora are slightly different from Debian
this will help get new users of notmuch that use Fedora going quicker.

Signed-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>
11 years agonotmuch-reply: Display reply message part using UTF-8.
Kan-Ru Chen [Sat, 28 Nov 2009 11:58:29 +0000 (19:58 +0800)]
notmuch-reply: Display reply message part using UTF-8.

Pass the message through the charset filter so that we can view
messages wrote in different charset encoding.

Signed-off-by: Kan-Ru Chen <kanru@kanru.info>
11 years agovim: preserve the 'show everything' flag when finding next/prev buffer
Bart Trojanowski [Sat, 28 Nov 2009 02:31:12 +0000 (21:31 -0500)]
vim: preserve the 'show everything' flag when finding next/prev buffer

When show mode is invoked it could be displaying just the matched messages
or everything.  This flag is passed to NM_search_show_thread().  It is then
stored in a buffer variable, b:nm_show_everything, and used for subsequent
calls to NM_search_show_thread() triggered by <Space>, <C-n> and <C-p>.

Signed-off-by: Bart Trojanowski <bart@jukie.net>
11 years agoemacs: Open only matched (and unread) messages when displaying a thread.
Carl Worth [Thu, 3 Dec 2009 19:38:05 +0000 (11:38 -0800)]
emacs: Open only matched (and unread) messages when displaying a thread.

This is the long-awaited feature that when viewing a thread resulting
from a search, only the messages that actually match the search will
be opened initially (in addition to unread messages).

So now, it's finally useful to tag a single message in a giant thread,
and then do a search later and easily find just the single tagged
message.

11 years agoemacs: Make message-summary button extend to very beginning of message.
Carl Worth [Thu, 3 Dec 2009 19:34:01 +0000 (11:34 -0800)]
emacs: Make message-summary button extend to very beginning of message.

There's no visible change here---we're just making the button extend
through the invisible portions of the message before the
message-summary line. The reason this is important is that it's easy
for the user to position point at the (invisible) `point-min', so we
want to ensure that there's a valid button there.

11 years agoSince we know what these buttons do it seems like the underlines are
Alexander Botero-Lowry [Thu, 3 Dec 2009 18:52:58 +0000 (10:52 -0800)]
Since we know what these buttons do it seems like the underlines are
unnecessary.

11 years agoemacs: notmuch-fontify-headers: Remove unneeded progn and indent correctly.
Carl Worth [Thu, 3 Dec 2009 18:39:33 +0000 (10:39 -0800)]
emacs: notmuch-fontify-headers: Remove unneeded progn and indent correctly.

The defun special form doesn't require a progn. And the remainder
of the function was previously indented in a misleading way, (as
if each "if" was always evaluated, rather than each only being
evaluated if all the previous evaluated to nil).

11 years agoemacs: Make message-summary button begin at beginning of line.
Carl Worth [Thu, 3 Dec 2009 18:37:35 +0000 (10:37 -0800)]
emacs: Make message-summary button begin at beginning of line.

Otherwise, RET is unreliable for opening/closing messages when
navigating through messages with 'n' and 'p'.

11 years agoemacs: Highlight message-summary with background-color instead of inverse video.
Carl Worth [Thu, 3 Dec 2009 17:52:43 +0000 (09:52 -0800)]
emacs: Highlight message-summary with background-color instead of inverse video.

Also, do this with a notmuch-message-summary-face variable so that
the user can easily customize the desried effect.

11 years agoemacs: Make the message-summary highlighting extend to end of visible line.
Carl Worth [Thu, 3 Dec 2009 17:48:00 +0000 (09:48 -0800)]
emacs: Make the message-summary highlighting extend to end of visible line.

This will look much nicer than the highlighting terminating at the
end of the summary text.

11 years agoemacs: Fix notmuch-show-next-open-message.
Carl Worth [Thu, 3 Dec 2009 15:37:40 +0000 (07:37 -0800)]
emacs: Fix notmuch-show-next-open-message.

This function was still implemented in terms of the old, global toggle
for visibility of unread messages, (which no longer exists). Fix it to
use the local 'invisibility-spec property on the button controlling
message visibility.

11 years agoTODO, emacs: Correct a few typos.
Carl Worth [Thu, 3 Dec 2009 15:30:26 +0000 (07:30 -0800)]
TODO, emacs: Correct a few typos.

Sometime I'll stop misspelling things so much, honets.

11 years agoTODO: Add some tasks, delete some tasks.
Carl Worth [Thu, 3 Dec 2009 01:18:51 +0000 (17:18 -0800)]
TODO: Add some tasks, delete some tasks.

A new item from IRC discussion, (speeding up "notmuch restore"), as
well as a bug I just hit myself, (content from citations is not being
indexed).

While here, notce that several items have recently been completed ('?'
now displays documentation, not function names; we have a search
binding from notmush-show-mode; and "notmuch new" responds to SIGINT
by flushing). Finally, the item regarding optimizing chunky searching
is irrelevant since we dropped chunky searching in favor of the much
better streamed searching.

11 years agonotmuch show: Preserve thread-ordering and nesting without --entire-thread
Carl Worth [Thu, 3 Dec 2009 00:05:23 +0000 (16:05 -0800)]
notmuch show: Preserve thread-ordering and nesting without --entire-thread

When "notmuch show" was recently modified to not show an entire thread
by default, it also lost all capability to properly order the messages
in a thread and to print their proper depth. For example, the command:

notmuch show thread:6d5e3e276461188c5778c9f219f63782

had dramatically different output than:

notmuch show --entire-thread thread:6d5e3e276461188c5778c9f219f63782

even though both commands were selecting and displaying the same set
of messages. The first command would diplay them "flat", (all with
depth:0), and in strict date order; while the second command would
display them "nested" (with depth based on threading), and in thread
order.

We now fix "notmuch show" without the --entire-thread option to also
display nested and thread-ordered messages.

If some messages in the thread are not included in the displayed
results, then they are not counted when computing depth values.

11 years agonotmuch.1: Document the new --entire-thread option to "notmuch show".
Carl Worth [Wed, 2 Dec 2009 23:48:34 +0000 (15:48 -0800)]
notmuch.1: Document the new --entire-thread option to "notmuch show".

This was added to "notmuch help" earlier, but not to the man page.
Add it there, and use consistent wording in both places.

11 years agoemacs: Add --entire-thread option to "notmuch show" command line.
Carl Worth [Wed, 2 Dec 2009 22:38:00 +0000 (14:38 -0800)]
emacs: Add --entire-thread option to "notmuch show" command line.

We (plan to) do any hiding of messages from within emacs, so don't
let notmuch hide messages from us.

11 years agovim: use notmuch show --entire-thread
Bart Trojanowski [Sat, 28 Nov 2009 02:49:40 +0000 (21:49 -0500)]
vim: use notmuch show --entire-thread

11 years agonotmuch show: limit display to only matching messages
Bart Trojanowski [Sat, 28 Nov 2009 02:49:39 +0000 (21:49 -0500)]
notmuch show: limit display to only matching messages

This patch changes the default behaviour of notmuch show to display only
messages that match the search expression.  However, --entire-thread
option is provided to display all messages in threads that matched the
search expression.

It is deemed that will be more useful for human users on the command line.
Scripts can be modified to include the --entire-thread option so that they
can display all messages once more.

Example:

$ notmuch search subject:git AND thread:23d99d0f364f93e90e15df8b42eddb5b
thread:23d99d0f364f93e90e15df8b42eddb5b      July 31 [4/12] Johan Herland; [RFCv2 00/12] Foreign VCS helper program for CVS repositories (inbox unread)

Note that in this thread 4 out of 12 messages matched.  The default show
behaviour is to show only those messages that match:

$ notmuch show subject:git AND thread:23d99d0f364f93e90e15df8b42eddb5b | grep 'message{' | wc -l
4

With the --entire-thread option the output will contain all dozen
messages:

$ notmuch show --entire-thread subject:git AND thread:23d99d0f364f93e90e15df8b42eddb5b | grep 'message{' | wc -l
12

Signed-off-by: Bart Trojanowski <bart@jukie.net>
11 years agoconfigure: Allow user to specify compiler to be used.
Carl Worth [Wed, 2 Dec 2009 02:33:23 +0000 (18:33 -0800)]
configure: Allow user to specify compiler to be used.

The environment variables CC and CXX can be set at configure time to
specify what compiler to use. This compiler will be used for any
configure-time compilation, and will also be recorded in
Makefile.config to be used during the actual build.

The compiler to be used can still be overridden at build time by using
a make variable such as:

make CC=gcc

11 years agoconfigure: Generate more friendly Makefile.config with separated CFLAGS
Carl Worth [Wed, 2 Dec 2009 02:25:17 +0000 (18:25 -0800)]
configure: Generate more friendly Makefile.config with separated CFLAGS

Each dependency now gets its own variable in the resulting
Makefile.config to make it much easier to debug where the various
flags came from in the case of any problems.

11 years agoconfigure: Clarify pkg-config warning now that Makefile does not invoke pkg-config.
Carl Worth [Wed, 2 Dec 2009 02:13:43 +0000 (18:13 -0800)]
configure: Clarify pkg-config warning now that Makefile does not invoke pkg-config.

It's probably a bit more work to use this configure script without
pkg-config, but it's at least possible, (and we could make it even
easier if this becomes an important use case).

11 years agoconfigure: Generate some documentation into Makefile.config.
Carl Worth [Wed, 2 Dec 2009 02:09:47 +0000 (18:09 -0800)]
configure: Generate some documentation into Makefile.config.

It's just not nice to auto-generate a file without helping out the
poor user who gets stuck trying to figure out what went wrong.

11 years agoconfigure: Resolve all pkg-config flags at configure time.
Carl Worth [Wed, 2 Dec 2009 01:56:39 +0000 (17:56 -0800)]
configure: Resolve all pkg-config flags at configure time.

Previously, we were resolving these within the Makefile. This had
the problem that if pkg-config was not present, the Makefile would
still invoke it resulting in ugly errors before the configure script
was even run, (which would finally present a kind error message about
pkg-config not being present).

11 years agoconfigure: Move getlinetest.c down into config/have_getline.c.
Carl Worth [Wed, 2 Dec 2009 00:56:39 +0000 (16:56 -0800)]
configure: Move getlinetest.c down into config/have_getline.c.

This keeps configure-related clutter out of the main directory, and
also gives a more direct correlation between the name of the test and
the feature being tested for.

11 years agogetdelim: Silence a (bogus) compiler warning.
Carl Worth [Wed, 2 Dec 2009 00:46:21 +0000 (16:46 -0800)]
getdelim: Silence a (bogus) compiler warning.

Some compilers complain that result might be used uninitialized in
this function. I believe such compilers simply aren't looking hard
enough, but it's easy enough to silence them.

11 years agoMakefile: Split warnings into two sets (WARN_CFLAGS and WARN_CXXFLAGS)
Carl Worth [Wed, 2 Dec 2009 00:42:50 +0000 (16:42 -0800)]
Makefile: Split warnings into two sets (WARN_CFLAGS and WARN_CXXFLAGS)

Some C++ compilers complain about -Wmissing-declarations not being
valid, so avoid passing it except when compiling a C file.

11 years agoMakefile: Switch from echo to printf for better portability.
Carl Worth [Wed, 2 Dec 2009 00:38:47 +0000 (16:38 -0800)]
Makefile: Switch from echo to printf for better portability.

Some systems have an echo implementation which doesn't know how to
interpret a sequence of "\n". The word is that printf should be much
more portable, so let's try that instead.

11 years agoconfigure: Assimilate new getlinetest into recent configure conventions.
Carl Worth [Wed, 2 Dec 2009 00:00:31 +0000 (16:00 -0800)]
configure: Assimilate new getlinetest into recent configure conventions.

We're now using printf to print what we're checking before we check. We're
also making variables such as HAVE_GETLINE available to both make and to
the C pre-processor.

With this, the local getline implementation is now only compiled if not
available on the system.

11 years agoAdd test to configure script to detect getline
Jeffrey C. Ollie [Mon, 23 Nov 2009 18:14:15 +0000 (12:14 -0600)]
Add test to configure script to detect getline

Add a simple test to the configure script to detect getline.  It's not
important that the test run, just that it compiles and links without
any errors.

Signed-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>
11 years agoconfigure: Fix valgrind check to take effect, and to work.
Carl Worth [Tue, 1 Dec 2009 23:52:44 +0000 (15:52 -0800)]
configure: Fix valgrind check to take effect, and to work.

We were missing an "override" directive in the assignment of CFLAGS
within Makefile.config so it was actually having no effect. Then, we
were also failing to get the proper include path for valgrind.h so
it wouldn't have worked even it were having effect. Fix both problems.

11 years agoMakefile: Incorporate getline implementation into the build.
Carl Worth [Tue, 1 Dec 2009 23:23:25 +0000 (15:23 -0800)]
Makefile: Incorporate getline implementation into the build.

It's unconditional for a very short time. We expect to soon be
building it only if necessary.

11 years agocompat/getdelim: Silence a warning about mixing of signed/unsigned.
Carl Worth [Tue, 1 Dec 2009 22:12:01 +0000 (14:12 -0800)]
compat/getdelim: Silence a warning about mixing of signed/unsigned.

If the length is ever so large as to overflow, then we'll end up
returning a negative value (which indicates an error anyway).

11 years agocompat: Change includes from config.h to compat.h.
Carl Worth [Tue, 1 Dec 2009 22:09:12 +0000 (14:09 -0800)]
compat: Change includes from config.h to compat.h.

We may switch to using an autoconf-like config.h, but we're not doing
that just yet.

11 years agocompat: Add implementation of getline from gnulib.
Carl Worth [Tue, 1 Dec 2009 22:06:41 +0000 (14:06 -0800)]
compat: Add implementation of getline from gnulib.

These were copied from the gnulib git repository as of:

commit 563c779682040ed4b89c9b4bbe428dcd8157c90a

They come under the GNU GPL v3 (or later) exactly as notmuch is
licensed.

11 years agoxutil: Implement xstrndup without relying on strndup.
Carl Worth [Tue, 1 Dec 2009 20:51:39 +0000 (12:51 -0800)]
xutil: Implement xstrndup without relying on strndup.

Since we need to do this for portability, (some systems don't have a
strndup function), we might as well do it unconditionally. There's
almost no disadvantage to doing so, and this has the advantages of not
requiring a configure-time check nor having two different
implementations, one of which would often be less tested.

11 years agolib/index: Fix memory leak for email addresses without names.
Carl Worth [Tue, 1 Dec 2009 20:40:13 +0000 (12:40 -0800)]
lib/index: Fix memory leak for email addresses without names.

We carefully noted the fact that we had locally allocated the string
here, but then we neglected to free it. Switch to talloc instead
which makes it easier to get the behavior we want. It's simpler since
we can just call talloc_free unconditionally, without having to track
the state of whether we allocated the storage for name or not.

11 years agoconfigure: Use printf to achieve result of "echo -n".
Carl Worth [Tue, 1 Dec 2009 19:39:30 +0000 (11:39 -0800)]
configure: Use printf to achieve result of "echo -n".

We had avoided using "echo -n" originally for portability concerns,
and instead just printed the same string in both conditions, (and
also printed the string late if any check took long). The word is
that printf is quite portable, so we use that instead.

11 years agoMakefile: Add new "install-bash" target for bash completion support
Carl Worth [Tue, 1 Dec 2009 18:14:00 +0000 (10:14 -0800)]
Makefile: Add new "install-bash" target for bash completion support

It was problematic to have this in "make install" since it would
unconditionally try to install to /etc, (even if a non-privileged user
was attempting an install to a prefix in the user's home directory,
for example).